Code is in
a gist
.