Efficient Way to Improve Console Productivity

One of the principles of efficiency when programming is to avoid unnecessary repetition (DRY), be it in code, or in physical and mental tasks. My goal is to write at least one tweak per day to my environment, whether a macro in my editor (Emacs), or a shell script or alias in my console environment, which is Z shell. (Note that this applies to other shells also.)

Reading Matthew Might’s article on console hacks inspired me to use that to quickly and easily find candidates for aliases and functions in Z shell.

The following command sorts the history by frequency of use:

% history -1000000 | cut -c8- | sort | uniq -c | sort -n | tail -15

The output from my recent work with DoctorJ is:

     11 cd ~ijdkproj
     12 gitpullall
     12 myprod.rb
     12 rake
     13 ..
     14 gitdfs
     15 c
     15 la
     20 sd
     24 scrub
     27 git status
     28 git push -u origin master
     37 git diff
     39 ls
     51 gct
     52 gitdelta.rb

(If you’re wondering what the “..” command is, that’s an alias for “cd ..”.)

In the frequency list the salient command in terms of length is “git push -u origin master”, executed 28 times. So we can consider an alias for it, such as “gpom”, and see whether it already exists as a function, alias, or program:

% which gpom
gpom not found

Since it doesn’t already exist, we can add it to the list of aliases (mine are in ~/System/Zsh/aliases.zsh):

alias gpom=’git push -u origin master’

On Github I’ve posted my Z shell configuration, with the updated aliases file here.

Projects Now on GitHub

I am in the process of migrating some of my projects to my space at GitHub.

At this point, the following exist:

  • DiffJ – a Java-aware command-line utility for comparing Java files. This program ignores whitespace and comments, and detects added and removed classes, methods, and fields, as well as changes in code.
  • IJDK – extensions to the JDK, primarily motivated by functionality in various Groovy and Ruby libraries.