Skip to content

Instantly share code, notes, and snippets.

@ughitsaaron
Last active December 9, 2015 21:57
Show Gist options
  • Select an option

  • Save ughitsaaron/063098462a085d49930b to your computer and use it in GitHub Desktop.

Select an option

Save ughitsaaron/063098462a085d49930b to your computer and use it in GitHub Desktop.
#!/bin/bash
# Aliases & functions
alias cp='cp -iv'
alias mv='mv -iv'
alias mkdir='mkdir -pv'
alias ls='ls -GAp'
cd() { builtin cd "$@"; ls; }
alias ~='cd ~/'
mcd() { mkdir -pv "$1" && cd "$1"; }
calc() { echo "$@" | bc -l; }
ql() { qlmanage -p "$*" >& /dev/null; } # opens any file in quicklook
alias tree='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'' | less' # full recursive directory tree
alias flush='dscacheutil -flushcache'
..() {
if [ $1 ] ; then for i in $(seq $1); do cd ..; done;
else cd ..;
fi;
}
alias finder="open -a \"Finder\" ./"
alias gd="grep -lr --exclude-dir=\".git/;node_modules/\""
alias http="python -c 'import BaseHTTPServer as bhs, SimpleHTTPServer as shs; print(\"Server Running on localhost port 8888\"); bhs.HTTPServer((\"127.0.0.1\", 8888), shs.SimpleHTTPRequestHandler).serve_forever()'"
alias fp="ps -ax | grep $@" # find process
#personal aliases
alias sites='cd ~/Sites/'
alias 😷="killall node"
#kaomojis
alias shrug="printf \"¯\_(ツ)_/¯\" | pbcopy && echo \"¯\_(ツ)_/¯ copied to clipboard\""
alias tableflip="printf \"(╯°□°)╯︵ ┻━┻\" | pbcopy && echo \"(╯°□°)╯︵ ┻━┻ copied to clipboard\""
alias returntable="printf \"┬─┬ノ(ಠ_ಠノ)\" | pbcopy && echo \"┬─┬ノ(ಠ_ಠノ) copied to clipboard\""
alias sad="printf \"(っ˘̩╭╮˘̩)っ\" | pbcopy && echo \"(っ˘̩╭╮˘̩)っ copied to clipboard\""
#git aliases
# alias gg="git log --pretty=oneline --graph --abbrev-commit" # git graph
# alias co="git checkout"
# alias com="git checkout master"
# search using spotlight metadata
spotlight () { mdfind "kMDItemDisplayName == '$@'wc"; }
# extract: Extract most know archives with one command
# ---------------------------------------------------------
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment