Skip to content

Instantly share code, notes, and snippets.

View mose's full-sized avatar

Mose mose

View GitHub Profile
module.exports = (robot) ->
robot.router.post "/#{robot.name}/capture/:feed", (req, res) ->
filepath = path.join process.env.FILE_BRAIN_PATH, "#{req.params.feed}"
payload = req.body
fs.appendFileSync filepath, "\n---------------------\n#{moment().utc().format()}\n\n"
fs.appendFileSync filepath, JSON.stringify(req.body, null, 2), 'utf-8'
res.setHeader 'content-type', 'text/plain'
res.status(200).end ''
@mose
mose / kubesandbox-trick
Last active January 3, 2018 10:30
note about fixing auth problem with bitnami kubesandbox
# on the kubesandbox VM
# sudo apt-get install apache2-utils
NEWHASH=$(echo -n `htpasswd -nb <user> <password>` | base64)
kubectl edit secret basic-auth --namespace=kube-system
# replace data.auth with $NEWHASH
@mose
mose / k8sandbox-remote.md
Last active January 19, 2018 14:37
kubesandbox remote access

As I was testing around with https://bitnami.com/stack/kubernetes-sandbox I wanted to remotely access it

First find the token, by getting on the server, which is configured to trust any local user to be cluster admin with kubectl

TOKEN=$(kubectl get secrets -n kube-system | grep default-token | awk '{print $2}')
kubectl describe secret $TOKEN -n kube-system | grep token:

Now give that default user the cluster admin role

kubectl create clusterrolebinding admin-role --clusterrole=cluster-admin --serviceaccount=kube-system:default
Verifying my Blockstack ID is secured with the address 1NusJpR4yVaWZPVMqtXdp7p2Xy2magjbV5 https://explorer.blockstack.org/address/1NusJpR4yVaWZPVMqtXdp7p2Xy2magjbV5
<?php
foreach($data as $key => $row) {
$categories = array($row['Category']);
foreach($row as $h => $v) {
if (substr($h, 0, 3) == 'pr:') {
$cat = substr($h, 3);
if ($v != '') {
$categories[] = $cat;
}
unset($data[$key][$h]);