Software

Here is a selection of my free-as-in-freedom Unix software. I have chosen to list those of my programs that I think other people may find useful, but if you're interested to see more of them, feel free to check out my GitHub profile.

watch

watch is a tool for watching file changes, built for operating systems that support kqueue. The interface is simple:

$ watch document.ms other.html

This will watch the files document.ms and other.html for changes, and whenever a change is detected, the respective filename will be prin­ted on standard out.

watch is written in C and is likely as fast as could be.


dwim

dwim (“do what I mean”) is a Perl script that emulates some of Plan 9's plumbing system. In short, it performs an action depending on the contents of the currently selected text in X11. For example:

  • If watch.c:21 is selected, then watch.c is opened in vi(1) with the cursor on line 21.
  • If http://john.ankarstrom.se is selected, then that address is opened in the web browser.
  • If <stdlib.h> is selected, then /usr/include/stdlib.h is opened with vi(1).
  • If dwim(1) is selected, then the man page dwim, residing in section 1, is opened with man(1).

Because dwim acts on the X11 primary selection, this works with any program. For instance, if you have dwim installed on your system, you can double click any of the examples above, run dwim, and your web browser, text editor or man page viewer would be opened.

I have dwim bound to a global key binding with my window manager.


repl

repl creates a read-eval-print loop for any shell command. It's very common that Unix tools have interfaces like these:

$ git <actual command>
$ ifconfig <actual command>

If you need to run multiple commands in succession, like add, commit, push, you'll find yourself unnecessarily typing git an increasingly an­noying number of times:

$ git add x
$ git commit
$ git add y
$ git commit --amend
$ git log
$ git push

This is the problem repl solves:

$ repl git
git > add x
git > commit
git > add y
git > commit --amend
git > log
git > push

Now, repl types git for you! When you're done, just press C-c and you'll return to the normal shell.


t

t is a simple tool that is very useful to me personally: it opens a termi­nal in the same directory as the currently focused terminal.

By default, t launches urxvtc – to use your own terminal emulator, edit the C source code.

This assumes that the window title of your terminal is always set to the path of the current directory. With ksh(1), this can be achieved by ad­ding the following to your shell configuration:

PS1=$PS1'\[\e]2;$PWD\a\]'

This sets the title to the value of PWD whenever your prompt is written.

(Note: t requires xtitle(1) to be installed.)