Skip to content

Instantly share code, notes, and snippets.

@chrislee35
Created March 30, 2018 01:53
Show Gist options
  • Select an option

  • Save chrislee35/0042e3a4a2a3b068c5843d49fe78d9c1 to your computer and use it in GitHub Desktop.

Select an option

Save chrislee35/0042e3a4a2a3b068c5843d49fe78d9c1 to your computer and use it in GitHub Desktop.
mac bash aliases
alias shred="gshred -u -f"
alias ls='ls -F -G'
alias ipsort='sort -nt. -k 1,1 -k 2,2 -k 3,3 -k 4,4'
alias ipusort='sort -unt. -k 1,1 -k 2,2 -k 3,3 -k 4,4'
alias rot13='tr "[A-Za-z]" "[N-ZA-Mn-za-m]"'
alias downcase='tr "[A-Z]" "[a-z]"'
alias upcase='tr "[a-z]" "[A-Z]"'
alias base64e='openssl base64 -e'
alias base64d='openssl base64 -d'
alias delta="perl -e '\$t=0;while(<>){chomp;\$t2=\$_;printf \"%0.6f\\n\", \$t2-\$t if \$t;\$t=\$t2;}'"
alias scpresume="rsync --partial --progress --rsh=ssh"
alias unhex='perl -pe "s/(..)/chr(hex(\$1))/ge"'
alias enhex='perl -pe "s/(.)/sprintf(\"%02x\",ord(\$1))/ge"'
alias urlen='perl -MURI::Escape -pe "chomp;\$_=uri_escape(\$_).\"\n\";"'
alias urlde='perl -MURI::Escape -pe "chomp;\$_=uri_unescape(\$_).\"\n\";"'
alias psx='ps auxw|grep'
alias top='top -o cpu -s 5'
alias countrycodes=iso3166
#alias irb='irb --readline -r irb/completion'
alias grepip="grep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'"
alias grepipo="grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'"
alias mailfile='open -a Mail.app'
alias pbcp="tmux save-buffer - | pbcopy"
alias setsleep="sudo systemsetup -setcomputersleep"
alias chrome="open -a \"Google Chrome\""
# mute the system volume
alias mute="osascript -e 'set volume output muted true'"
alias unmute="osascript -e 'set volume output muted false'"
# trim newlines
alias tn='tr -d "\n"'
# find things
alias locate='mdfind'
alias spotlight='mdfind'
# ssh into something in another tab
if [ "$TERM_PROGRAM" = "iTerm.app" ]; then
alias l="osascript /Users/chris/Documents/applescript/iterm2_launch.scpt"
fi
function playmidi {
SOUNDFONT='/usr/local/share/fluidsynth/generaluser.v.1.44.sf2'
if [ -e "$SOUNDFONT" ]
then
for i in "$@"
do
if [ -e "$i" ]
then
(fluidsynth -i "$SOUNDFONT" "$i" 2>&1) >/dev/null
else
echo "[playmidi]: cannot find file at $i"
return 1
fi
done
else
echo "[playmidi]: SOUNDFONT file not found at $SOUNDFONT"
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment