Accompanying repository for https://gist.github.com/torgeir/4392014