The Holy Java

Building the right thing, building it right, fast

Tools

(For the index of Tools sub-pages see the parent page with its global index.)

Mini-notes

Command line

Quickly jump to a directory based on frequency/clever substring matching:

  • z (zsh, bash) – “z is the new j, yo” – also j2 and the fish clone z-fish
  • DirB, Directory Bookmarks for Bash (home) – moving efficiently among favourite directories (s <name> to create a bookmark for pwd, g <bookmark | relative/abs dir path> to enter a dir (=> works both for bookmarks and as a replacement for cd); also support for relative path bookmarks & more; sl lists bookmakrs in the last used order)
  • Autojump, described in Dec 11

Bash

Loop with 0-padded numbers for a number of repetitions (using for and seq, from 1 to 50, outputting 01, 02, .., 50):

for i in $(seq -f '%02g' 1 50); do echo $i; done

Basic math in Bash (addition, ..; using let for a numerical var and $((<expression>)) for math):

let num=0; echo $num; INC="1"; num=$((num+$INC)); echo $num

Git

  • Undo merge: git reset –hard ORIG_HEAD (the pointer ORIG_HEAD is set automatically by Git)
  • Unfo file changes: git co — path/to/file/to/reset [other/files/..]
  • git whatchanged master..

Vim – useful advanced commands

  • Change/delete a text region
    • (d|c)i<delim> – Delete|change text up to the given delimiting character; requires that you are inside pair delimiters such as “…” or (…); use ‘a‘ to include the delimiters
  • Operations on selections (=> y to copy (yank), dto delete)
    • Select lines (e.g. for deletion via ‘d‘): S-V
    • Select rectangle (e.g. to delete whitespace): C-V
  • Search and replace with confirmation: :%s/foo/bar/gc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: