Skip to content

Instantly share code, notes, and snippets.



Last active Jul 13, 2020
What would you like to do?
Knowledge I have gained throughout the years


  • <n>G to jump to nth row
  • ctrl+o to jump to last curor position
  • ctrl+n to highlight word, again to jump to next one, ctrl-x to skip one ctrl-p to go back-
    • with plugin: c to change the selection
  • q: to get a window of all last commands <CR> to execute them
  • J to move the following line to the end of this line
  • <leader>s to substitute word under cursor
  • "<char>dd deleted line into register
  • "<char>p pastes file from register
  • :s/\%V\(.*\)\%V/<a href="#\1">\1<\/a>/ to surround visual selection
  • :nohlsearch to no longer highlight search matches
  • :grep <word> to find. then :cw in search results to open in quickfix window
  • ctrl+a increments the next number by one, ctrl+x decrements it
  • :e <path e.g. "."> opens a file browser that can be searched and used to edit files


  • ctrl+r to serach history
  • ctrl+l to replace clear
  • ctrl+z to suspend process, bg to list them, fg to bring it back to the foreground, disown to separate process from terminal
  • $? holds the exit status of the last executed command
  • ^foo^bar takes the last command from the history and replaces foo with bar

unix command line tools

- echo {"some": "json"} | python -m json.tool pretty prints json on the cmd line

  • grep -A12 -B15 gives the matching lines and 12after, 15 before
  • man 2 open lets you inspect level 2 (system) calls like open
  • htop has a -d option which lets you set the refesh interval (in tenths of seconds). htop -d 5 sets it to two times a second
  • less -S turns off line wraping which is useful if you have long tabular text (like the output of csvlook)
  • renameutils allows you to easily change file names with the editor that you are used to
  • sort has the -h flag which sorts by human readble values (such as the one produced by du -h) which might include KB, MB etc


  • dir() shows all properties/methods of an object
  • ptpython is a nice command line replacement for ipython
  • import ipdb; ipdb.set_trace() gives you an interactive debugging session
  • ctrl + [ or ctrl + ] to indent/unindent in ipython
  • _ gives you the last evaluted result in (i)Python, __ the second last and so on
  • You can user python -c to execute python lineline in a shell. Example: echo 'hello cool arguments ' | python -c 'import sys; print'
  • IPython's input mode can be switched to vim or emacas mode. To switch it to vim mode create a config file (ipython profile create) and set c.TerminalInteractiveShell.editing_mode = 'vi' in the file that is created. Then you can hit escape and move around like you are used to from vim. (reference)1

Browser devtools

inspect($(".points")) in the console to select the element in the Elements panel debug(YourLibrary.someFunction) or monitor(YourLibrary.someFunction) to be notified when function is called


Change describe or it to fdescdribe or fit to only run those tests with jasmine


  • git reset --soft origin/master
    • This will rollback your branch to the same commit as origin/master but it keeps all the changes you have done
  • git stash --patch to let you choose what you want to stash and what not
  • git bisect and then git good or git bad to go on the hunt for a bug in the history
  • Add -S to git commit (as in git commit -S -m 'my signed commit') to use GPG to sign your commit. It will then show up with a checkmark on the page
  • diff so fancy for nicer highlighting and colors in diffs


  • \e to edit the last executed command in default text editor
  • run \watch after a query to run this query every two seconds (just like the default unix watch)


  • alex checks text for non inclusive language
  • httpie Replaces wget/curl
  • webcoach to measure performance of webpages and get advice
  • tldr as an example-driven alternative to man
  • thefuck corrects commands that you mistyped in the console


  • sudo ifconfig en0 ether aa:bb:cc:dd:ee:ff to change mac address of wifi card (useful if throttled by mac address) (maybe make sure to store your original one and reset back to it after you are done to avoid side effects)
  • ⌘-E finds currently selected text (in some tools)
  • Apple has a long support doucment on keyborad shortcuts


  • heroku pg:ps to see all running postgres processes
  • heroku pg:killall to kill all running postgres processes


  • alt-e to edit the current line in $EDITOR (see this commit)

JetBrains Editors

  • The Rainbow Brackets Plugin colorizes matching parantheses


  • if you install the iTerm2 shell integration you get convenient features such as being able to jump back to the previous command in the history with cmd-shift-up (reference)2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment