Python
Here are the first three programs I wrote in Python:
- addMIMETextToHTMLEmail — if you hate HTML-only email (e.g., from Hotmail) because you use a text-based mailreader like mutt this will turn HTML-only email into a MIME multipart message with a text part and an HTML part. Other utilities I’ve found will strip out the HTML or convert it to text, but this leaves the HTML as a separate part in case you need it. Typically you would use this as a procmail filter:
:0fw * ^Content.*html | addMIMETextToHTMLEmail.py
(download).
- addTitlesToLinks — this program will take HTML snippets (or a whole web page) and look up each tag that doesn’t have a ‘target’ element for the title of the webpage referred to. It will then add the title to the tag. You can either use the program as a module and call the function addTitlesToLinks, or use it as a filter (and pipe HTML through it). (download).
- fetchPageAndImages — you can feed this program a URL, a file containing HTML, or pipe HTML into it, and it will go and get each web page that is linked, as well as images on those pages, and pack it all up into a single pickled object. It can also take this object and restore it back to something that could be served to a user. So it’s a simple web caching program. It’s primarily intended to be part of something larger, but it has some command line options to try it out as a stand-alone program. (download).