Skip to content

Instantly share code, notes, and snippets.

View projectweekend's full-sized avatar

Brian Hines projectweekend

View GitHub Profile
@projectweekend
projectweekend / Dockerfile
Created April 25, 2015 02:04
Example Python 2.7.9 Dockerfile
FROM python:2.7.9
COPY requirements.txt /src/
WORKDIR /src
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
@projectweekend
projectweekend / sinon_method_mock.js
Last active August 29, 2015 14:17
Mocking a "class" method with Sinon
var sinon = require( "sinon" );
var MyClass = require( "./my_package" ).MyClass;
// Stub the method
sinon.stub( MyClass.prototype, "myMethod" ).returns( 0 );
// Restore when done
MyClass.prototype.myMethod.restore();
gpio_service = GPIOService(rabbit_url=RABBIT_URL, device_key=DEVICE_KEY, pin_config=PIN_CONFIG)
gpio_service.start()
@projectweekend
projectweekend / control_client.py
Created February 3, 2015 02:21
A simple example using Pi-Control-Client
from pi_control_client import GPIOClient
RABBIT_URL = 'replace with CloudAMQP connection URL'
DEVICE_KEY = 'my_raspberry_pi'
pins_client = GPIOClient(rabbit_url=RABBIT_URL)
# Turn the LED on
pins_client.on(DEVICE_KEY, 18)
@projectweekend
projectweekend / pin_config.yml
Created February 3, 2015 00:57
A simple configuration file for Pi-Control-Service
18:
mode: OUT
@projectweekend
projectweekend / control_service.py
Created February 2, 2015 22:38
A simple example using Pi-Control-Service
from pi_control_service import GPIOService
RABBIT_URL = 'replace with CloudAMQP connection URL'
DEVICE_KEY = 'my_raspberry_pi'
PIN_CONFIG = './pin_config.yml'

Keybase proof

I hereby claim:

  • I am projectweekend on github.
  • I am projectweekend (https://keybase.io/projectweekend) on keybase.
  • I have a public key whose fingerprint is 9C7D 7388 D363 1E4F C1D8 5B5D D38F 3676 C284 E13D

To claim this, I am signing this object:

@projectweekend
projectweekend / Vagrantfile
Created June 10, 2014 20:20
Vagrantfile VOKAL
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "phusion-open-ubuntu-14.04-amd64"
config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box"
config.vm.provider :vmware_fusion do |f, override|
override.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vmwarefusion.box"
end
#include <Adafruit_NeoPixel.h>
#define PIN 6
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
@projectweekend
projectweekend / startup.js
Last active August 29, 2015 14:01
Simple token-based authentication middleware for Azure Mobile Services
var jwt = require( 'jsonwebtoken' );
var authMiddleware = function ( options ) {
var routesToSkip = [];
if ( typeof options.skip !== "undefined" ) {
routesToSkip = options.skip;
}