Some code to accompany a forthcoming blog