Raspberry Pi -based sensor station

This is mostly documentation for myself. Feel free to use any of it if it helps, though.



Document your target environment with:

"engines": {
  "npm": ">=3.3.12 <4",
  "node": ">=5.5.0 <6"

Then install this:

"devDependencies": {

Understanding Immutable.Record

Functional programming principles and with it immutable data are changing the way we write frontend applications. If the recent de-facto frontend stack of React and Redux feels like it goes perfectly together with immutable data, that's because it's specifically designed for that.

There's several interesting implementations of immutable data for JavaScript, but here I'll be focusing on Facebook's own Immutable.js, and specifically on one of its lesser known features, Records.

Why Records?

Immutable.js provides a beautiful, Clojure-inspired API for dealing with abstract Collections and Sequences, and several concrete data structur

View Component.js
export default renderFromStores(
[ 'fooStore', 'barStore' ],
({ fooStore, barStore, bazActions }) => (
Hola {fooStore.getName()}!
<button onClick={bazActions.doStuff}>Cheap</button>
<button onClick={() => bazActions.doStuffWith(fooStore.getName())}>Expensive</button>

Long Live Icon Fonts!

or, a Quick PSA on icon fonts and ligatures.

tl;dr: keep using icon fonts, they are nice, just enable ligatures

These are my talking notes at the on 2015-12-04:

View eslint-instanceof-hazard.js
module.exports = function(context) {
'use strict';
return {
BinaryExpression: function(node) {
if (node.operator === 'instanceof' && node.left.type === 'UnaryExpression' && node.left.operator === '!') {, "Check dangerous instanceof use (! has higher precedence than instanceof)");

Freaklies goes ES6


Classes are purely syntactic sugar:

class Animal {
  constructor(name) { = name;

Transparent boot2docker on OS X

This is how you can autorun boot2docker on boot, so that you can use docker as you would on Linux, without ever* knowing that the daemon's not running locally.

  1. Install VirtualBox & boot2docker (obviously)
  2. Create a startup script with Automator
  3. Put in /usr/local/bin/boot2docker up && /usr/local/bin/boot2docker shellinit > ~/
  4. Add echo "export DOCKER_IP=$(boot2docker ip 2>/dev/null)" >> ~/ if you want the non-standard but very-convenient DOCKER_IP env-var as well (thanks for the suggestion @city41!)
  5. Update your .profile or equivalent file with source ~/
  6. Reboot your machine

⇐ back to the gist-blog at

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

View PromiseQueue.js
function PromiseQueue() {
var tail = Promise.resolve();
return {
enqueueOperation(op) {
return tail = tail.then(op, op);