Skip to content

Instantly share code, notes, and snippets.

@rubenruizdegauna
rubenruizdegauna / git-aliases.md
Created November 27, 2017 08:06 — forked from mwhite/git-aliases.md
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@rubenruizdegauna
rubenruizdegauna / gist:1da4995bd72389de579c97038c11c781
Created April 1, 2016 07:40
Remove multiple files in linux without eating all I/O
find PATH_TO_DELETE_FROM -type f -exec rm -fv {} \; -exec sleep 0.01 \;
@rubenruizdegauna
rubenruizdegauna / .tmux.conf
Last active November 23, 2016 09:33
.tmux.conf
setw -g mode-mouse on
setw -g mouse-select-pane on
setw -g mouse-select-window on
setw -g mouse-utf8 on
setw -g monitor-activity on
# Maintain CTRL + ARROWS
set-window-option -g xterm-keys on
# Automatically set window title
@rubenruizdegauna
rubenruizdegauna / swapUsage.sh
Created October 31, 2014 10:14
Prints all the processes (swap amount, pid and name w/o params) that are using swap ordered by swap amount
#!/usr/bin/env bash
# Prints all the processes that are using swap ordered by swap amount (DESC)
for PID in $( ls /proc/|egrep "^[0-9]" );do
PROCNAME=$( ps -e -o pid,comm|grep ${PID}|awk '{print $2}' )
awk -v PID=${PID} -v PROCNAME=${PROCNAME} '/Swap/{sum+=$2}END{print (sum/1024)"\t"PID"\t"PROCNAME}' /proc/${PID}/smaps 2>/dev/null |egrep -v "^0"
done | sort -nr