Various bits I wrote to make my life easier.