Brian's Useful Utilities Set

This week I made another long term goal of my blog with the addition of Brian’s Useful Utilities Set. The page has descriptions and source code for about two dozen utility program I’ve written and make use of on almost a weekly basis.

Setting up the page was not without its complications. Due to the way the blog software (nikola) works, I need to maintain a separate copy of the source files in a subdirectory named listings. But I didn’t want the overhead of having to update the listings directory any time I made a change to one of the programs.

My solution was to save SHA1 checksums of the original scripts in a file. As part of building the blog, a script runs that computes the current checksums of the source files and compares them with the stored values. If any are different the script copies the new file into place and updates the checksum.

Then another issue arose. I prefer to indent all my programs using tabs at four space intervals. Howver, the nikola program that generates colour highlighted HTML versions of the source files expands tabs on eight spaces. (The Nikola configuration doesn’t have a setting for this, and I haven’t bothered digging into the code to see if there’s an easy workaround.)

My initial fix was to modify the files as stored in the listings directory to use only spaces. But that caused another problem. Each colourised HTML page includes a link to download the original source file in the listings directory—which gives the user the version that has tabs converted to spaces. But I wanted to make available the version that uses tabs.

So I made another change to the blog build script. Now it initially stores the files with tabs conterted to spaces in the listings direcotry so the highlighter script can generate HTML showing the correct spacing. Once that’s done, I replace the files in listings with original (with tabs) versions.