Some snippets I wrote to help people at StackOverflow