Stuff I coded, might be useful to others