305 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			305 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
# Handle the fact that this file will be used with multiple OSs
 | 
						|
platform=`uname`
 | 
						|
if [[ $platform == 'Linux' ]]; then
 | 
						|
  alias l='ls -lhg --color'
 | 
						|
  alias ll='ls -lahg --color'
 | 
						|
 | 
						|
  # Arch
 | 
						|
  alias flux='redshift'
 | 
						|
  alias ipconfig='ip addr'
 | 
						|
  alias ifconfig='ip addr'
 | 
						|
  alias pi='yaourt -S' # wrapper around Arch Pacman
 | 
						|
  alias po='pacman -Qdt' # see orphaned packages
 | 
						|
  alias pr='yaourt -R' # giving me trouble now
 | 
						|
  alias prr='pacman -Rdd'
 | 
						|
  alias pss='sudo pacman -Syu'
 | 
						|
  alias pu='yaourt -U'
 | 
						|
  # TODO add a trash alias for trash-cli?
 | 
						|
 | 
						|
elif [[ $platform == 'Darwin' ]]; then
 | 
						|
  alias l='ls -laG'
 | 
						|
  alias ls='ls -laG'
 | 
						|
  alias ll='ls -lG'
 | 
						|
  # TODO add a trash alias for trash-cli? or brew install rmtrash
 | 
						|
 | 
						|
elif [[ "${platform,,}" == *'ming'* ]]; then # convert to lowercase then compare with wildcard
 | 
						|
  alias python='winpty python.exe'
 | 
						|
  alias python3='winpty python.exe'
 | 
						|
 | 
						|
  alias l='ls -ahg --color'
 | 
						|
  alias ls='ls -ahg --color'
 | 
						|
  alias rm='echo "use trash command instead!"'
 | 
						|
  alias rmr='echo "use trash command instead!"'
 | 
						|
  alias trash='recycle-bin.exe '
 | 
						|
  alias tt='trash '
 | 
						|
fi
 | 
						|
 | 
						|
alias c='cd'
 | 
						|
alias c-='cd -'
 | 
						|
alias cd-='echo "Use c- instead"'
 | 
						|
alias ..='cd ../'
 | 
						|
alias ...='cd ../..'
 | 
						|
alias cd..='cd ..'
 | 
						|
alias cd...='cd ../..'
 | 
						|
alias cd....='cd ../../..'
 | 
						|
alias cd.....='cd ../../../..'
 | 
						|
 | 
						|
alias aliases='vim ~/.dotfiles/aliases'
 | 
						|
alias al='aliases'
 | 
						|
 | 
						|
 | 
						|
r() {
 | 
						|
  if [ -f run ]; then ./run $@ ; else test -f run.sh && ./run.sh $@ ; fi
 | 
						|
}
 | 
						|
 | 
						|
b() {
 | 
						|
  if [ -f build ]; then ./build $@ ; else test -f build.sh && ./build.sh $@ ; fi
 | 
						|
}
 | 
						|
 | 
						|
bb() {
 | 
						|
  if [ -f build ]; then ./build -o 1 $@ ; else test -f build.sh && ./build.sh -o 1 $@ ; fi
 | 
						|
}
 | 
						|
 | 
						|
br() {
 | 
						|
  b $@ ; r
 | 
						|
}
 | 
						|
 | 
						|
alias bd='if [ -f build ]; then ./build -data 1 ; else test -f build.sh && ./build.sh -data 1 ; fi'
 | 
						|
alias bbd='if [ -f build ]; then ./build -o 1 -data 1 ; else test -f build.sh && ./build.sh -o 1 -data 1 ; fi'
 | 
						|
alias bl='brew link --overwrite'
 | 
						|
alias bld='brew link --overwrite --dry-run'
 | 
						|
alias bower='noglob bower'
 | 
						|
alias cr='RUSTFLAGS="$RUSTFLAGS -A unused_variables -A dead_code -A unused_parens" cargo run'
 | 
						|
alias crr='cargo run --release'
 | 
						|
alias cb='RUSTFLAGS="$RUSTFLAGS -A unused_variables -A dead_code -A unused_parens" cargo build'
 | 
						|
alias cbr='cargo build --release'
 | 
						|
alias clrtmp='trash ~/tmp/*.bak && trash ~/tmp/*.swp'
 | 
						|
alias clrtemp='clrtmp'
 | 
						|
alias clipboard='xclip -selection c'
 | 
						|
alias cloc='cloc --no3 --by-file-by-lang --skip-win-hidden'
 | 
						|
alias cls=clear
 | 
						|
alias code='cd ~/code'
 | 
						|
alias cpr='cp -r'
 | 
						|
alias dc='gdc'
 | 
						|
alias dot='cd ~/.dotfiles'
 | 
						|
alias pdot='cd ~/.private-dotfiles'
 | 
						|
alias duh='du -csh'
 | 
						|
alias f='fg'
 | 
						|
alias functions='vim ~/.dotfiles/functions'
 | 
						|
alias history='fc -l 1'
 | 
						|
alias histroy='history'
 | 
						|
# alias h='heroku'
 | 
						|
# alias ho='heroku open'
 | 
						|
# alias hc='heroku config'
 | 
						|
# alias hca='heroku config:add'
 | 
						|
# alias hcu='heroku config:unset'
 | 
						|
# alias hcr='heroku config:unset'
 | 
						|
# alias hl='heroku logs -t -n 5000'
 | 
						|
# alias hmo='heroku maintenance:on'
 | 
						|
# alias hmoo='heroku maintenance:off'
 | 
						|
# alias hr='heroku releases'
 | 
						|
# alias hrs='heroku restart'
 | 
						|
# alias hscale='heroku ps:scale '
 | 
						|
alias irb='irb --readline -r irb/completion'
 | 
						|
alias lcc='lein clean'
 | 
						|
alias lca='lein cljsbuild auto dev'
 | 
						|
alias ldi='lein deps install'
 | 
						|
alias lsd='lein start-dev'
 | 
						|
alias moon='curl wttr.in/moon'
 | 
						|
alias patch='git format-patch HEAD^ --stdout > patch.diff'
 | 
						|
alias reguard='killall -9 ruby ; guard'
 | 
						|
alias rb='rbenv'
 | 
						|
alias rbg='rbenv gemset active'
 | 
						|
alias rbp='cd $RBENV_PATH/versions/$(rbenv version | sed -e "s/ (set.*$//")'
 | 
						|
alias rbl='cd $RBENV_PATH/versions/$(rbenv version | sed -e "s/ (set.*$//")/lib/ruby'
 | 
						|
alias rc='rclone'
 | 
						|
alias rcc='rclone copy'
 | 
						|
 | 
						|
function reload {
 | 
						|
  if [[ $platform == 'Linux' || $platform == 'Darwin' ]]; then
 | 
						|
    source ~/.zshrc
 | 
						|
  else
 | 
						|
    test -f ~/.aliases && . ~/.aliases
 | 
						|
  fi
 | 
						|
}
 | 
						|
 | 
						|
alias rl='reload'
 | 
						|
alias restart='sudo shutdown now -r'
 | 
						|
alias s='cd ~/.ssh'
 | 
						|
alias sc='vim ~/.ssh/config'
 | 
						|
alias stream='streamlink --player mpv'
 | 
						|
alias shutdown='sudo shutdown now'
 | 
						|
alias stk='rlwrap stk-simply'
 | 
						|
alias t='tree'
 | 
						|
alias tag='ctags -R .'
 | 
						|
alias tmp='cd ~/tmp'
 | 
						|
alias u='cd ..'
 | 
						|
alias v='vim'
 | 
						|
alias vi='vim'
 | 
						|
alias vh='vagrant halt'
 | 
						|
alias vs='vagrant ssh'
 | 
						|
alias vu='vagrant up'
 | 
						|
alias vimrc='vim ~/.vimrc'
 | 
						|
alias weather='curl wttr.in/toronto'
 | 
						|
alias yt-download='youtube-dl.exe -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s"'
 | 
						|
alias yt8='youtube-dl.exe -f "137+140" -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" '
 | 
						|
alias yt-download-1080='youtube-dl.exe -f "137+140" -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" '
 | 
						|
alias yt-download-720='youtube-dl.exe -f "136+140" -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" '
 | 
						|
alias tw-download-60='youtube-dl.exe -f "1080p60" -o "%(upload_date)s-%(title)s-twitch-%(id)s.%(ext)s" '
 | 
						|
alias tw-download-720='youtube-dl.exe -f "720p-1" -o "%(upload_date)s-%(title)s-twitch-%(id)s.%(ext)s" '
 | 
						|
alias tw-download-4k='youtube-dl.exe -f "2160p" -o "%(upload_date)s-%(title)s-twitch-%(id)s.%(ext)s" '
 | 
						|
alias tw-download='youtube-dl.exe -f "1080p" -o "%(upload_date)s-%(title)s-twitch-%(id)s.%(ext)s" '
 | 
						|
 | 
						|
# Git
 | 
						|
 | 
						|
function gitCmdWrapper {
 | 
						|
  # If no args are provided then run `git status`
 | 
						|
  if [[ $# > 0 ]]; then
 | 
						|
    git $@
 | 
						|
  else
 | 
						|
    git status
 | 
						|
  fi
 | 
						|
}
 | 
						|
 | 
						|
if [[ $platform != 'Darwin' && $platform != 'Linux' ]]; then
 | 
						|
  # Fix a weird mingw 'not a valid identifierline' error.
 | 
						|
  # Got the fix from https://github.com/Alexpux/MSYS2-packages/issues/735#issuecomment-328938800
 | 
						|
  alias git="PATH=/usr/bin git"
 | 
						|
fi
 | 
						|
 | 
						|
alias am='git commit --amend'
 | 
						|
alias ama='git commit --amend -C head --author'
 | 
						|
alias ams='git commit -S --amend' # signed
 | 
						|
alias ammend='echo "use am instead"'
 | 
						|
alias amend='echo "use am instead"'
 | 
						|
alias g='gitCmdWrapper'
 | 
						|
alias ga='git add -A :/'
 | 
						|
alias gaa='git add -A'
 | 
						|
alias gaap='git add -Ap'
 | 
						|
alias gau='git add --update'
 | 
						|
alias gb='git branch -v'
 | 
						|
alias gbd='git branch -D'
 | 
						|
alias gbl='git branch --all'
 | 
						|
alias gblm='git blame -wMC'
 | 
						|
alias gbm='git branch -m'
 | 
						|
alias gbr='git branch -rv'
 | 
						|
alias gc='git commit'
 | 
						|
alias gcs='git commit -S'
 | 
						|
alias gcl='git clone'
 | 
						|
alias gcm="git commit -m"
 | 
						|
alias gcms="git commit -S -m"
 | 
						|
alias gco='git checkout'
 | 
						|
alias gco-='git checkout -'
 | 
						|
git_checkout_build() {
 | 
						|
  git checkout "$1" ; b
 | 
						|
}
 | 
						|
alias gcoo=git_checkout_build
 | 
						|
alias gcob='git checkout -b'
 | 
						|
alias gcon='vi .git/config'
 | 
						|
alias gcp='git cherry-pick'
 | 
						|
alias gcpa='git cherry-pick --abort'
 | 
						|
alias gcpc='git cherry-pick --continue'
 | 
						|
alias gcps='git cherry-pick -n'
 | 
						|
alias gd='git diff'
 | 
						|
alias gdc='git diff --cached'
 | 
						|
alias gdcc='git diff --cached -w'
 | 
						|
alias gdm='git diff master'
 | 
						|
alias gds='git diff --stat=160,120'
 | 
						|
alias gdw='git diff --color-words'
 | 
						|
alias gf='git fetch'
 | 
						|
alias gfa='git fetch --all'
 | 
						|
alias gfix="git commit --amend -C HEAD"
 | 
						|
alias gfixx="git commit --amend -C HEAD ; gp -f"
 | 
						|
alias gfixs="git commit -S -a --amend -C HEAD" # signed
 | 
						|
alias gfo='git fetch origin'
 | 
						|
alias gfm='git fetch origin master'
 | 
						|
alias gfup='git fetch upstream'
 | 
						|
alias ggrep='git log --all --oneline | grep '
 | 
						|
alias gh="source ~/.githelpers && show_git_head"
 | 
						|
alias gla='git lg --all'
 | 
						|
alias gl='git lg -30'
 | 
						|
alias gll='git lg'
 | 
						|
alias gli='git show --pretty="format:" --name-only'
 | 
						|
alias glog='git log'
 | 
						|
alias gm='git merge'
 | 
						|
alias gmnff='git merge --no-ff'
 | 
						|
alias gmff='git merge --ff-only'
 | 
						|
alias gmffm='git merge --ff-only master'
 | 
						|
alias gmffs='git merge --ff-only --squash'
 | 
						|
alias gmtheirs='git merge -Xtheirs'
 | 
						|
alias gp='git push'
 | 
						|
alias gpa='git push && echo "pushing tags..." && git push --tags'
 | 
						|
alias gpd='git push && git push heroku master'
 | 
						|
alias gpdf='gpf && gphf'
 | 
						|
alias gpp='echo "Pushing Upstream master to production" && git push production master'
 | 
						|
alias gppp='echo "Pushing to remotes first..." && git push origin master:master && git push upstream master:master && echo "Pushing upstream master to Production..." && git push production upstream/master:master'
 | 
						|
alias gps='git push staging'
 | 
						|
alias gpps='echo "Pushing Upstream master to staging" && git push staging upstream/master:master -f'
 | 
						|
alias gppf='gpf && git push production HEAD:production -f'
 | 
						|
alias gph='echo "pushing $(git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3) to Heroku master" && git push heroku HEAD:master'
 | 
						|
alias gphf='git push heroku master --force'
 | 
						|
alias gpu='git push --set-upstream origin HEAD'
 | 
						|
alias gpff='git pull --ff-only'
 | 
						|
alias gplup='git pull upstream master'
 | 
						|
alias gpo='git push origin'
 | 
						|
alias gpom='git push origin master'
 | 
						|
alias gpr='git pull --rebase'
 | 
						|
alias gpt='git push --tags'
 | 
						|
alias gr='git reset'
 | 
						|
alias gr1='git reset HEAD^1'
 | 
						|
alias grb='git rebase'
 | 
						|
alias grba='git rebase --abort'
 | 
						|
alias grbc='git rebase --continue'
 | 
						|
alias grbs='git rebase --skip'
 | 
						|
alias grbi='git rebase -i --autostash'
 | 
						|
alias grbm='git rebase master --autostash'
 | 
						|
alias grbmi='git rebase master -i --autostash'
 | 
						|
alias grbo='git fetch origin master && git rebase origin/master'
 | 
						|
alias grboi='git fetch origin master && git rebase origin/master -i'
 | 
						|
alias grbum='git fetch upstream master && git rebase upstream/master'
 | 
						|
alias gre='git remote'
 | 
						|
alias grea='git remote add'
 | 
						|
alias gremo='git remote remove origin; git remote add origin'
 | 
						|
alias greao='git remote add origin'
 | 
						|
alias gref='git reflog --format="%C(auto)%h %<|(17)%gd %C(cyan)%ci%C(reset) [%gs] %C(yellow)(%s)%C(reset)"'
 | 
						|
alias grev='git remote -v'
 | 
						|
alias grm='git rm'
 | 
						|
alias grmr='git rm -r'
 | 
						|
alias grp='git reset -p'
 | 
						|
alias gsnapshot='git stash save "snapshot: $(date)" && git stash apply "stash@{0}"'
 | 
						|
alias gsh='git show'
 | 
						|
alias gshh='git show -w'
 | 
						|
alias gs='git stash'
 | 
						|
alias gsk='git stash -k -u'
 | 
						|
alias gss='git stash save'
 | 
						|
alias gsd='git stash drop'
 | 
						|
alias gsdl='git stash drop stash@{0}'
 | 
						|
alias gsl='git stash list'
 | 
						|
alias gsi='git stash -p'
 | 
						|
alias gsp='git stash pop'
 | 
						|
alias gsp0='git stash pop stash@{0}'
 | 
						|
alias gsp1='git stash pop stash@{1}'
 | 
						|
alias gsp2='git stash pop stash@{2}'
 | 
						|
alias gsp3='git stash pop stash@{3}'
 | 
						|
alias gsp4='git stash pop stash@{4}'
 | 
						|
alias gsp5='git stash pop stash@{6}'
 | 
						|
alias gsp6='git stash pop stash@{7}'
 | 
						|
alias gt='git tag'
 | 
						|
alias gta='git tag -a'
 | 
						|
alias gtd='git tag -d'
 | 
						|
alias gtl='git tag -l'
 | 
						|
alias gx='git reset --hard'
 | 
						|
alias gxx='git reset --hard HEAD~1'
 | 
						|
alias gstats='echo "Total commits: $(git rev-list HEAD --count)"; echo "\nAuthor breakdown:"; git shortlog | grep -E "^[^ ]"'
 | 
						|
alias gwip="git add . && git commit -m \"WIP\""
 | 
						|
 | 
						|
# Haxe
 | 
						|
alias flow='haxelib run flow'
 | 
						|
alias snowfall='haxelib run snowfall'
 | 
						|
 | 
						|
# Other aliases
 | 
						|
alias pal='vim ~/.private-dotfiles/aliases'
 | 
						|
test -f ~/.private-dotfiles/aliases && . ~/.private-dotfiles/aliases
 | 
						|
 | 
						|
alias cmake-gen='cmake -D CMAKE_CXX_COMPILER="/Library/Developer/CommandLineTools/usr/bin/c++" CMAKE_C_COMPILER="/Library/Developer/CommandLineTools/usr/bin/cc" ..'
 |