Skip to content

Instantly share code, notes, and snippets.

View stianeikeland's full-sized avatar

Stian Eikeland stianeikeland

View GitHub Profile
@stianeikeland
stianeikeland / Coffeetimer-MSP430
Created March 20, 2011 15:02
MSP430 Coffeetimer
/*
* Coffetimer (safetytimer)
*
* Activated when button (pin 4) is grounded.
* Connected to a RF - remote control on pin 5 and 6
* via a couple of transistors, controling the
* coffemakers power outlet.
*
* By Stian Eikeland
*
@stianeikeland
stianeikeland / coffeetimer-msp430.c
Created March 20, 2011 15:06
MSP430 Coffeetimer
/*
* Coffetimer (safetytimer)
*
* Activated when button (pin 4) is grounded.
* Connected to a RF - remote control on pin 5 and 6
* via a couple of transistors, controling the
* coffemakers power outlet.
*
* */
@stianeikeland
stianeikeland / srlink.c
Created September 9, 2012 01:08
Pioneer SR-link control - Raspberry PI
@stianeikeland
stianeikeland / broker.coffee
Created September 10, 2012 19:22
0MQ.. push/pull => pub/sub
# Router / Central hub for home automation.
# Receives events and distributes via pub/sub
zmq = require 'zmq'
inputPort = 'tcp://*:8888'
outputPort = 'tcp://*:9999'
# Pull socket for incoming (push/pull), pub for outgoing (pub/sub)
input = zmq.socket 'pull'
@stianeikeland
stianeikeland / broker.coffee
Created September 24, 2012 15:46
ZeroMQ broker (push/pull + pub/sub)
# Router / Central hub for home automation.
# Receives events and distributes via pub/sub
zmq = require 'zmq'
inputPort = 'tcp://*:8888'
outputPort = 'tcp://*:9999'
# Pull socket for incoming (push/pull), pub for outgoing (pub/sub)
input = zmq.socket 'pull'
@stianeikeland
stianeikeland / subexample.coffee
Created September 24, 2012 16:13
Subscribe to sensor data.
sub = (require 'zmq').socket 'sub'
sub.connect 'tcp://raspberrypi:9999'
sub.subscribe 'sensor'
sub.on 'message', (topic, data) -> console.log "#{topic} => #{data}"
@stianeikeland
stianeikeland / msgbuspower.coffee
Created October 20, 2012 14:31
Power control on the message bus
power = new Power new MessageBus
# Power coffeemaker off 60 minutes after it was powered on:
power.on 'kitchen-coffeemaker', (event) ->
turnOff = () ->
power.send {
command: "off",
location: "kitchen-coffeemaker" }
setTimeout turnOff, 60*60*1000 if event.command is "on"
#!/usr/bin/env bash
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
@stianeikeland
stianeikeland / Program.cs
Created November 30, 2012 10:10
RabbitMQ consumer/producer
using System;
using System.Reactive.Linq;
using System.Text;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
namespace RabbitTest
{
class Program
{
@stianeikeland
stianeikeland / test.md
Created December 20, 2012 11:43
Markdown gist.io test

Dette er en test

Bacon ipsum dolor sit amet meatball tongue turkey ribeye. Ribeye meatball kielbasa pork turkey bresaola pork belly tongue, shoulder andouille beef ribs fatback. Capicola tri-tip bresaola, meatball drumstick leberkas sausage filet mignon andouille tongue beef strip steak jerky cow. Short loin sausage leberkas, ham rump meatball ball tip. Andouille turkey sirloin strip steak kielbasa short ribs, boudin ground round fatback sausage beef doner.

Corned beef cow prosciutto leberkas shankle, capicola boudin. Flank bacon pancetta brisket capicola beef ball tip beef ribs boudin short loin shank tail. Pork pastrami short loin bacon sausage meatball t-bone pork belly bresaola pork chop jerky meatloaf brisket kielbasa. Pork belly ball tip strip steak leberkas tongue. Ball tip jowl meatball brisket.

Sausage flank venison shoulder, meatball brisket jerky capicola salami pancetta pastrami swine pork loin biltong. Spare ribs ground round shank, drumstick t-bone corned beef sausage hamburger. Pork salami