Useful Scripts

In this section, I began to publish some (a micro-fraction) of the code I wrote in the past years. There are currently two subsections for the following projects:

Contents

On this very page you can find some of my smaller scripts that I think to be of general use.

lowerfn

You know the problem: You copy files from another computer, a CD-ROM, a flash memory device or similar, and the files are UPPERCA.SED because of archaic operating systems and/or filesystems. Most often this is accompanied by the fact that the files have their executable bits set, although they're clearly just image files for example.

File: lowerfn(7628 bytes; Tue, Dec/02/2008) download 'lowerfn' to disk

When Sven asked me which was the simplest way of downcasing filenames that I knew, I quickly quickly wrote a small Python script, since the problem seemed common enough. The first version was trivial, but then we realized additional features that would be nice to have, thus the current version supports:

Be aware that lowerfn requires Python 2.3 or higher.

File: cvs-chroot(4313 bytes; Tue, Dec/02/2008) download 'cvs-chroot' to disk

cvs-chroot

This small script facilitates changing the cvsroot stored in the CVS/Root files, e.g. in order to change a directory checked out from an anonymous server to you own, personal cvs account or vice versa (e.g. for re-distributing directories using your own account).

It does not have commandline help, but it's very easy to use:

File: urls(2730 bytes; Thu, Mar/20/2008) download 'urls' to disk

urls

This script will search one or more files for urls and output them on stdout. There must be different implementations of this tool out there - but I was not happy with the ones I tried. In contrast to some of them, this script does not rely on <a href=...> or sth. like that, but will simply look for stuff that looks like URLs (i.e. also catches Javascript URLs etc.).

Furthermore, it allows to specify a base URL in order to convert relative URLs to absolute ones. I.e. if you downloaded http://www.example.com/subdir/somefile.html, you would use urls -b http://www.example.com/subdir/somefile.html somefile.html to convert links like ../images/bg.jpg into http://www.example.com/images/bg.jpg. If that's what you're looking for. ;-)


Valid XHTML 1.0! Valid CSS!
This page was last modified: Thursday, July 21, 2011 hacker emblem