Some code I wrote -- and occasionally use.