Small scripts

The scripts I'm most proud of

minify.py - Simple XHTML minifier

It reads from stdin and writes to stdout. The reason I wrote this script was that the other HTML minifiers I used were over-optimizing the HTML, causing validation errors.

I don't use this script any more, as my new design is based on static XHTML5 being served. (Lighttpd can compress static resources but not the output streams from CGI scripts.)

killbom - Eliminate UTF-8 Byte Order Marks

This script removes all UTF-8 BOMs from all specified files. Even BOMs, that somehow got somewhere else than in the beginning of the file, are also removed.

This script SHOULD NOT be run on binary files due to its very literal operation.

Usage: killbom [file] ...
killbom removes all UTF-8 BOM marks from files.

WARNING: It really removes all sequences of '\0xEF\0xBB\0xBF'.

WARNING: It accepts no options. All arguments are treated as filenames.
shrink-disavow - Minify Google Webmaster Tools / Search Console

It converts multiple complete URLs on the same domain to the domain: syntax.

Usage: script_name {infile} {outfile} [num_of_links]

num_of_links is the number of URLs from the same domain that will are
required for replacing all those URLs with a single 'domain:'.

The default value is two.
mkhtml - The key of my new design

The old design was based on fancy Python scripts generating the content. I made it too automated for too specific types of content.

The objectives for the new design were:

  • Autogenerate the navigation. The only thing I needed to be done automagically.
  • Work like a macro expander.
  • Generate (mostly) static content, but work for scripts too.
  • Be ran from a Makefile.

It still has some downsides:

  • A bit terribly implemented.
  • A bit limited in certain cases.
  • Quite ad-hoc.
  • Weird macro syntax.

Other scripts

monitor
Fail2ban, ps aux | grep ..., °C, loadavg ...