Various bits of code I find useful.