Python Hacks
Little Python hacks, collected here so I can find them in the future.- s3 upload - Upload an HTML file to s3 with a given filename. Uses boto.
- lucene.highlight - Do a single search against three documents, and return keyword style 'fragment' output.e
- simplelucene - The simplest possible example I could come up with for PyLucene.
- postdict - Take a string of post data and turn it into a dict
- xml to mysql - if you have Simple XML - like the kind you'll find in most Access Database dumps, for example - this will help you to load the data into a MySQL database
- urlencode.py - Used this for posting a bunch of files to a pwyky installation.
- time-string - Convert a number of seconds to a string of "days, hours, minutes, seconds". First used for julie-witw
- data loader - This is used for the traffic cam testing I've been doing: It loads the format and tries to parse it. A probably better version is available from sbp at #swhack's pastebin