Hacks

This page contains bits and pieces that don't fit anywhere else and are too small to justify a page to themselves.

run-builds

This is a Perl script used to automatically build a collection of programs on a collection of hosts. It updates an HTML page showing progress. Currently it only supports bzr.

The smilies and green backgrounds indicate that the build and test scripts both worked, and are links to the output from make. Other symbols and colors are used to indicate errors or to show that work is in progress.

To get it:

bzr clone http://www.greenend.org.uk/rjk/bzr/builds.dev/

...and read the README.

HTML rfc-index.txt

I use this fragment of shell and Perl to produce an HTML version of rfc-index.txt, with links to the RFCs in their various formats and internal links for "updates", "obseleted by", etc.

set -e
( 
printf "<html><head><title>RFC Index</title></head><body><pre>" 
perl -pe 's/<>&/sprintf("&#%d;",ord($&))/ge; 
          s/^0*(\d+)/<a name=$1 href=\"rfc$1.txt\">$&<\/a>/ && ($n = $1); 
          $n && s/(TXT|PDF|PS)(=\d+)/<a href=\"rfc$n.\L$1\E\">$1<\/a>$2/g; 
          s/RFC0*(\d+)/<a href=\"\#$1\">$&<\/a>/g' < rfc-index.txt 
printf "</pre></body></html>\n" 
) > rfc-index.html.tmp 
mv rfc-index.html.tmp rfc-index.html

newsreader-count

newsreader-count is a Perl script which counts up the number of different newsreaders in use in a newsgroup and generates a report. It is stuffed full of heuristics to cope with the amazing rubbish people put in their newsreader identification strings. It requires direct access to the news spool.

newsreader-count has two possible modes of operation. The first counts the number of posts each newsreader generates. In this mode a particularly prolific poster could result in their newsreader coming top even if no-one else uses it.

The second, invoked with the --by-from option, only counts each distinct From: field once. Assuming stable From: fields, this will give an idea of how many people are using each newsreader, rather than how many posts are generated. However it could easily be confused by someone who frequently varied their From: field. There's no easy solution to this.

text2ps

text2ps is a Perl script I wrote years ago to translate plain text into Postscript.

dns-mode.el

dns-mode.el is an Emacs major mode for editing DNS zone files. It doesn't do more than highlighting at the moment. Tested with XEmacs 21 and GNU Emacs 21.

rfc-mode.el

rfc-mode.el pops up RFCs in a new frame. It depends on wget and popup.el. Tested with XEmacs 21 and GNU Emacs 21.

Posting Pictures

Someone asked how I generate the HTML and thumbnails for collections of pictures, and the answer is using the ImageMagick tools "convert" and "identify" and some one-line scripts:

for x in dcp*; do convert -scale 10% $x ${x/dcp/t}; done

identify t*| perl -ne '/(\d+\.jpg).*JPEG (\d+)x(\d+)/ && print "<a href=\"dcp$1\"><img src=\"t$1\" width=$2 height=$3></a>\n"'

(The latter only spits out a fragment of HTML, not a complete file.)

I don't use the above any more, now having a more automated solution.


More software I've written

RJK | Contents