An old dump of a profile generator I wrote way back when