Skip to content

Instantly share code, notes, and snippets.

@limitedeternity
Last active August 7, 2022 11:29
Show Gist options
  • Save limitedeternity/b3655c47fe48f1667c5ced84a70dea77 to your computer and use it in GitHub Desktop.
Save limitedeternity/b3655c47fe48f1667c5ced84a70dea77 to your computer and use it in GitHub Desktop.
My bash aliases
set -o vi
shopt -s autocd
alias ghc='ghc -no-keep-hi-files -no-keep-o-files -fforce-recomp -Wall'
alias g++='g++ -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -fasynchronous-unwind-tables -fpie -fstack-protector-all -fpic -O2 -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration'
alias external_ip='curl ipinfo.io/ip; echo'
alias internal_ip='ipconfig getifaddr en1'
alias webserve='python3 -m http.server 8000'
alias pgstart='pg_ctl -D /usr/local/var/postgres start'
alias wget='aria2c --file-allocation=none -c -x 10 -s 10'
alias c='clear'
alias :q='exit'
alias l='ls -l'
alias ll='ls -l'
alias la='ls -al'
alias vi='nvim'
alias vim='nvim'
reverse_http () {
if [[ $# -lt 2 ]]; then
echo "usage: reverse_http \"remote_ip:remote_port\" local_port "
return 1
fi
node -e "require('$(echo `nvm which current` | xargs dirname | xargs dirname)/lib/node_modules/http-proxy').createProxyServer({target: 'http://$1'}).listen($2);console.log('Mapped localhost:$2 to http://$1!');"
}
cs () { cd "$@" && tree -L 1 -a; }
mkcd() { mkdir -p "$@" && cd "$@"; }
pss () {
folder=$(pwd)
filename="Screen Shot $(date +%Y-%m-%d\ at\ %H-%M-%S).png"
if [ $# -ne 0 ]; then
if [[ -d $1 ]]; then
if [ "$1" != "." ]; then folder=$1; fi
else
a=$(dirname "$1")
b=$(basename "$1" .png)
if [ "$b" != "" ]; then filename=$b.png; fi
if [ "$a" != "." ]; then folder=$a; fi
fi
fi
osascript -e "tell application \"System Events\" to ¬
write (the clipboard as «class PNGf») to ¬
(make new file at folder \"$folder\" ¬
with properties {name:\"$filename\"})" && echo "Saved as \"$filename\""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment