Skip to content

Instantly share code, notes, and snippets.

View geek's full-sized avatar
🏠
Working from home

Wyatt Preul geek

🏠
Working from home
View GitHub Profile
@geek
geek / create-machine
Last active September 2, 2015 02:22 — forked from mikew/00-README.md
docker-machine create -d vmwarefusion
#!/bin/bash
name="${1:-test}"
dir="${HOME}/.docker/machine/machines/${name}"
vmx="${dir}/${name}.vmx"
vmrun="/Applications/VMware Fusion.app/Contents/Library/vmrun"
# Something about the initial run of docker-machine+vmwarefusion needs sudo
sudo docker-machine create -d vmwarefusion "${name}"
@geek
geek / gist:f34ea8d70116487672ec
Created August 20, 2015 01:50
.bashrc extras
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
alias cls="clear"
alias ..="cd .."
alias ?="pwd"
alias ll="ll -l"

Connection after route

var Hapi = require('hapi');

var server = new Hapi.Server();

server.route({ method: 'get', path: '/hello', handler: function (request, reply) {

 reply('World');
#include <MySensor.h>
#include <SPI.h>
#define LED_PIN 8
#define RADIO_ID 20
#define CHILD_ID 1
MySensor gw;
MyMessage lightMsg(CHILD_ID, V_LIGHT);
@geek
geek / sensor-commander.js
Created November 6, 2014 17:12
Run, then start jenny and point to -u http://localhost:8000
var Hapi = require('hapi');
var server = new Hapi.Server(8000);
var commands = [];
server.route({
method: 'GET',
path: '/{path*}',
handler: function (request, reply) {
> process.platform
'darwin'
> process.platform = 'huh'
'huh'
> process.platform
'darwin'
> process.version
'v0.11.13'
{
"pack": {
"cache": "catbox-redis"
},
"servers": [
{
"port": 8080,
"options": {
"labels": ["web"]
}
exports.register = function (plugin, options, callback) {
plugin.expose('util', function () {
console.log('something');
});
callback();
};
exports.register = function (plugin, options, callback) {
plugin.events.on('internalError', function (request, err) {
console.log(err);
});
callback();
};
sortedRoutes = [
'/',
'/user',
'/user/{userId}',
'/users/{userIds*}'
];