Housekeeping

My current work involves a lot of reading, and I receive a ton of files from many sources — colleagues, contractors, vendors, document systems, et al. The fact that I have instead tried listening to them in dull monotone1 must be a give away. Last Sunday, I sat down to list all the minor house-keeping annoyances that stop me in my tracks while working, so I could do something about them.

Here are the top five:

1. Split and scattered pdf files in a folder
2. Empty folders
3. File and folder permissions
4. Scattered LaTeX compile files
5. pdf file sizes

I realised that I had solved these problems at one time or the other in the past, but hadn’t joined them up into a single tool belt that I could access with a simple command in one stroke. Like my backup routine before, I realised I could create a Makefile that could make it all possible.

My hkp repository is a result of that. The tool-belt is now accessible from any folder at my finger tips. Here are the available tools:

ckunte at air in ~/hkp (master)
\$ hk
usage: make --file=~/hkp/Makefile <cmd>
<cmd> available:
cmbi  combine all pdf files in the curr folder
cmbs  combine sub-folder-wise pdf files
efd   purge empty folders
ffp   apply permissions: folders (755), files (644)
plcf  purge LaTeX compile files
cmpr  compress all pdf files in the curr folder
cr    delete and recreate master git repository


Among the above, combining files proved troublesome, especially with all kinds of poorly named files. For a while I tried rename, which proved to be dangerous. After a bit of research, I found detox, which does a great job of renaming bad names into sane, parsable ones that the script can handle. While it was easier to install on the Mac via Homebrew (brew) and via Advanced Package Tool (apt) on debian, a Cygwin version proved elusive. In the end, I compiled source (on Cygwin!) to get a working binary in /usr/local/bin. detox’s kung fu is a thing to admire. When you’re not writing regular expressions — to catch a bunch of poorly named files and failing often, it feels like magic.

New CLI tools

I’ve been discovering new tools, written by Rust programmers, with dramatic improvements in utility and speed.

1. bat: A cat(1) clone with wings
2. exa: A modern version of ls
3. fd: A simple, fast and user-friendly alternative to find
4. fzf: A command-line fuzzy finder
5. rg: A fast alternative to grep
6. rga: Search in PDFs, E-Books, Office documents, zip, tar.gz, etc.

The combination of ripgrep (rg) with fzf in live-searching (via) through my files cannot beat anything in Mac or Windows. Happy days!

rg --files | fzf


1. Via text to speech.