Miscellaneous bits of code written mostly out of curiosity