Gist: 03971f5535c5092a9976

Unless otherwise specified, all code here is licensed GPLv2