miscelaneous code snippets i wrote