How to be a lazier developer





By Rajat Goyal

@rajat404

 

Terminal Emulators

Terminator/iTerm2

  • Split pane view
  • Configurable keybindings
  • Customisable UI
  • Content re-flow on resize
 

Shells

 

Bash

  • Default shell in most *NIX distributions
  • Plain & Simple
 

Files in Bash

  • .bash_profile -- The personal initialization file, executed at login
  • .bashrc -- The individual per-interactive-shell startup file
  • .bash_history -- File storing history of commands entered
 

Zsh

  • Incorporates features of bash & ksh
  • Fast autocompletion
  • Versatile prompts
  • Autocorrect/Autosuggest
 

Files in Zsh

  • .zprofile -- Executes commands at login pre-zshrc
  • .zshrc -- The individual per-interactive-shell startup file
  • .zshenv -- Defines environment variables
  • .zhistory -- File storing history of commands entered
 

Zsh Configuration Framework

 
 

Aliases

replacement text for a command

 
# Git Aliases

alias gs="git status"
alias ga='git add . --all'
alias gb='git branch '
alias gc='git commit -am'
alias gk='git checkout'
alias gpo='git push origin "$(git-branch-current 2> /dev/null)"'
alias gpu='git pull origin "$(git-branch-current 2> /dev/null)"'
 

Some more examples

 

alias fsize="du -hs * | sort -h"
alias lookup='ps aux | grep'
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to clipboard.'"
alias pwc="pwd | pbcopy | pwd && echo '=> Current Directory copied to clipboard.'"
alias las="ls -SFhsrl"

alias env="python3 -m venv venv"
alias sv="source venv/bin/activate"

alias mp3="youtube-dl --extract-audio --audio-format mp3 --no-playlist"
alias youtube-720="youtube-dl -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' --no-playlist"
 

Functions

Group or modify commands for easy execution

 
# http://hamberg.no/erlend/posts/2013-01-18-mkcd.html
mkcd(){
    mkdir -p "${1}"
    cd "${1}"
}

# Automatically do `ls` after `cd`
cd(){
    builtin cd "$@" && ls -F
}
 

Some more expamples

 

req(){
    pip freeze | grep "$1"
    pip freeze | grep "$1" | pbcopy
    echo "=> Output copied to clipboard"
}

# Create Archives
mktar() { tar cvf  "${1%%/}.tar"     "${1%%/}/"; }
mktgz() { tar cvzf "${1%%/}.tar.gz"  "${1%%/}/"; }
mktbz() { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }
 

Envirnonment Variables

Made with Slides.com