Some useful bits of code I've come across in my travels.