dotfiles/aliases

671 lines
20 KiB
Plaintext
Raw Normal View History

2020-03-15 18:44:36 +00:00
#
# Note: this may contain Windows line endings. If you're going to use it in Linux then you'll need
# to remove those with: `sed -i 's/\r//' <file>` or with `dos2unix`.
2020-03-15 18:44:36 +00:00
#
2013-07-07 21:25:47 +00:00
platform=`uname`
2020-07-21 15:29:52 +00:00
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
BOLD=""
NORMAL=""
fi
####################################################################################################
# Helper Functions
####################################################################################################
2020-07-21 15:29:52 +00:00
error() {
printf "${BOLD}${RED}$1${NORMAL}\n"
}
abort() {
error "\nAborting..."
exit 1
}
reload() {
if [[ $platform == 'Linux' || $platform == 'Darwin' ]]; then
test -f ~/.aliases && . ~/.aliases
else
test -f ~/.aliases && . ~/.aliases
fi
}
# See top 10 bash commands
2020-07-21 15:29:52 +00:00
hist() {
if [[ "${platform,,}" == *'ming'* ]]; then
hist_file=~/.bash_history
else
hist_file=~/.history
fi
cat $hist_file|cut -d ';' -f 2- 2>/dev/null| awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
}
2020-07-21 15:29:52 +00:00
remove_windows_file() {
if [ -f "$1" ]; then
recycle-bin.exe "$1"
elif [ -d "$1" ]; then
recycle-bin.exe "$1"
else
echo "'$1' does not exist!"
fi
}
2020-07-21 15:29:52 +00:00
make_vid_dir_and_cd_into() {
local url="$1"
local dir_name="$2"
if [[ $dir_name == "" ]]; then
# @note If the filename contains symbols that are incompatible with
# Windows' directory names then add --restrict-filenames to the command.
dir_name=$(youtube-dl.exe --get-filename -o "%(upload_date)s - %(title)s" $url)
if [[ $dir_name == "" ]]; then
return 1
fi
dir_name="${dir_name:0:4}-${dir_name:4:2}-${dir_name:6}"
fi
2020-07-21 15:29:52 +00:00
printf "${BOLD}Creating directory ${YELLOW}'$dir_name'${NORMAL}\n"
mkdir "$dir_name"
cd "$dir_name"
error=$?
if [[ ! $error -eq 0 ]]; then
2020-07-21 15:29:52 +00:00
error "Error: failed to create directory. Aborting.\n"
return 1
fi
return 0
}
# Download YouTube videos
2020-07-21 15:29:52 +00:00
dl_youtube_vid() {
local format="$1"
local url="$2"
shift 2
local opts="$@"
opts+=" --all-subs --embed-subs"
make_vid_dir_and_cd_into $url
if [[ $? -ne 0 ]]; then
return
fi
local filename=$(youtube-dl.exe --get-filename -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" $url)
filename="${filename:0:4}-${filename:4:2}-${filename:6}"
if [[ $format == "" ]]; then
2020-07-21 15:29:52 +00:00
printf "${BOLD}Getting best non-webm format${NORMAL}\n"
youtube-dl.exe -f "bestvideo[ext!=webm]" -o "$filename" $opts $url
else
youtube-dl.exe -f $format -o "$filename" $opts $url
fi
cd ..
}
# Download YouTube video and flip horizontally.
2020-07-21 15:29:52 +00:00
dl_youtube_vid_and_hflip() {
local format="$1"
local url="$2"
shift 2
local opts="$@"
opts+=" --all-subs --embed-subs"
make_vid_dir_and_cd_into $url
if [[ $? -ne 0 ]]; then
return
fi
local filename=$(youtube-dl.exe --get-filename -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" $url)
filename="${filename:0:4}-${filename:4:2}-${filename:6}"
if [[ $format == "" ]]; then
2020-07-21 15:29:52 +00:00
printf "${BOLD}Getting best non-webm format${NORMAL}\n"
youtube-dl.exe -f "bestvideo[ext!=webm]" -o "$filename" $opts $url
else
youtube-dl.exe -f $format -o "$filename" $opts $url
fi
# Flip
ffmpeg -i "$filename" -vf hflip -c:a copy "copy_${filename}"
mv "copy_${filename}" "$filename"
cd ..
}
2020-07-21 15:29:52 +00:00
dl_youtube_playlist() {
local format="$1"
local url="$2"
local dir_name="$3"
2020-07-21 15:29:52 +00:00
if [[ $url == "" || $dir_name == "" ]]; then
error "Format: cmd <url> <directory name>\n"
return
fi
shift 3
local opts="$@"
opts+=" --all-subs --embed-subs"
make_vid_dir_and_cd_into $url "$dir_name"
if [[ $? -ne 0 ]]; then
return
fi
2020-07-21 15:29:52 +00:00
printf "${BOLD}Downloading playlist${NORMAL}\n"
local name_format="v%(playlist_index)s--%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s"
if [[ $format == "" ]]; then
2020-07-21 15:29:52 +00:00
printf "${BOLD}Getting best non-webm format${NORMAL}\n"
youtube-dl.exe -f "bestvideo[ext!=webm]" -o "$name_format" $opts $url
else
youtube-dl.exe -f $format -o "$name_format" $opts $url
fi
cd ..
}
# Download Twitch videos
2020-07-21 15:29:52 +00:00
dl_twitch_vid() {
local format="$1"
2020-07-21 15:29:52 +00:00
local shortname="$2"
local compression_level="$3"
local url="$4"
shift 4
local opts="$@"
2020-07-21 15:29:52 +00:00
if [[ $compression_level -eq 0 ]]; then
printf "${BOLD}Downloading Twitch vid with no compression.${NORMAL}\n"
else
2020-07-21 15:29:52 +00:00
printf "${BOLD}Downloading Twitch vid with compression level ${YELLOW}$compression_level${NORMAL}.\n"
fi
make_vid_dir_and_cd_into $url
if [[ $? -ne 0 ]]; then
return
fi
2020-06-25 17:30:08 +00:00
if [[ $shortname -eq 0 ]]; then
local name_format="%(upload_date)s-%(title)s-twitch-%(id)s"
else
local name_format="%(upload_date)s-shortname-twitch-%(id)s"
fi
local filename=$(youtube-dl.exe --get-filename -o "$name_format.%(ext)s" $url)
filename="${filename:0:4}-${filename:4:2}-${filename:6}"
youtube-dl.exe -f "$format" -o "$filename" $opts $url
error=$?
if [[ $error -eq 0 ]]; then
# Download Twitch chat transcript
local chat_file=$(youtube-dl.exe --get-filename -o "$name_format" $url)
rechat.exe -d $url "$chat_file.json"
rechat.exe -p "$chat_file.json" "$chat_file.txt" -b -o
mv "$chat_file.txt" "${chat_file:0:4}-${chat_file:4:2}-${chat_file:6}.txt"
rm "$chat_file.json"
2020-07-21 15:29:52 +00:00
if [[ $compression_level -ne 0 ]]; then
compress-video "$filename" $compression_level "temp"
extension="${filename##*.}"
mv "$filename" uncompressed_original.$extension
mv temp.$extension "$filename"
printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
fi
else
2020-07-21 15:29:52 +00:00
error "Error: Failed to download '$url'\n"
fi
cd ..
}
2020-07-21 15:29:52 +00:00
dl_twitch_chat() {
local url="$1"
make_vid_dir_and_cd_into $url
if [[ $? -ne 0 ]]; then
return
fi
# Download Twitch chat transcript
local name_format="%(upload_date)s-%(title)s-twitch-%(id)s"
local chat_file=$(youtube-dl.exe --get-filename -o "$name_format" $url)
rechat.exe -d $url "$chat_file.json"
rechat.exe -p "$chat_file.json" "$chat_file.txt" -b -o
mv "$chat_file.txt" "${chat_file:0:4}-${chat_file:4:2}-${chat_file:6}.txt"
rm "$chat_file.json"
cd ..
}
# Download video.
2020-07-21 15:29:52 +00:00
dl_mp4() {
local url="$1"
local filename="$2"
temp_name="temp_${RANDOM}.mp4"
2020-07-21 15:29:52 +00:00
printf "${BOLD}Downloading: ${YELLOW}$filename${NORMAL}\n"
curl "$url" -o $temp_name
if [[ $? -ne 0 ]]; then
2020-07-21 15:29:52 +00:00
error "Error: failed to download.\n"
return
fi
mv $temp_name "$filename.mp4"
}
# Download Instagram video and flip horizontally.
2020-07-21 15:29:52 +00:00
dl_instagram_vid_and_hflip() {
local url="$1"
local filename="$2"
temp_name="temp_${RANDOM}.mp4"
2020-07-21 15:29:52 +00:00
printf "${BOLD}Downloading: ${YELLOW}$filename${NORMAL}\n"
curl "$url" -o $temp_name
if [[ $? -ne 0 ]]; then
2020-07-21 15:29:52 +00:00
error "Error: failed to download.\n"
return
fi
# Flip
ffmpeg -i $temp_name -vf hflip -c:a copy "copy_$temp_name"
mv copy_${temp_name} "$filename.mp4"
rm $temp_name
}
2020-07-21 15:29:52 +00:00
activate_virtualenv() {
if [ -f venv/bin/activate ]; then . venv/bin/activate;
elif [ -f ../venv/bin/activate ]; then . ../venv/bin/activate;
elif [ -f ../../venv/bin/activate ]; then . ../../venv/bin/activate;
elif [ -f ../../../venv/bin/activate ]; then . ../../../venv/bin/activate;
fi
}
###################################
# Git Functions
###################################
2020-07-21 15:29:52 +00:00
git_cmd_wrapper() {
# If no args are provided then run `git status -s`
if [[ $# > 0 ]]; then
git $@
else
2020-07-21 15:29:52 +00:00
git status -s
fi
}
2020-07-21 15:29:52 +00:00
git_commit() {
cmd="git commit -m \"$*\""
eval "$cmd"
}
git_commit_signed() {
cmd="git commit -S -m \"$*\""
eval "$cmd"
}
git_branch_name() {
val=`git branch 2>/dev/null | grep '^*' | colrm 1 2`
echo "$val"
}
2020-07-21 15:29:52 +00:00
git_nuke() {
git checkout master && git branch -D $1 && git push origin :$1
}
####################################################################################################
# Handle the fact that this file will be used with multiple OSs
2013-07-07 21:25:47 +00:00
if [[ $platform == 'Linux' ]]; then
2015-12-06 05:15:13 +00:00
alias l='ls -lhg --color'
alias ll='ls -lahg --color'
# Arch
2016-10-23 16:45:42 +00:00
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'
2017-08-21 19:04:19 +00:00
# TODO add a trash alias for trash-cli?
2013-07-07 21:25:47 +00:00
elif [[ $platform == 'Darwin' ]]; then
2013-07-07 21:30:11 +00:00
alias l='ls -laG'
2015-02-24 04:34:00 +00:00
alias ls='ls -laG'
2013-07-07 21:30:11 +00:00
alias ll='ls -lG'
2017-08-21 19:04:19 +00:00
# TODO add a trash alias for trash-cli? or brew install rmtrash
2017-03-27 18:22:43 +00:00
elif [[ "${platform,,}" == *'ming'* ]]; then # convert to lowercase then compare with wildcard
2017-02-16 20:54:10 +00:00
alias python='winpty python.exe'
2017-02-18 15:49:56 +00:00
alias python3='winpty python.exe'
2017-03-27 18:22:43 +00:00
alias l='ls -ahg --color'
alias ls='ls -ahg --color'
2019-10-12 16:29:11 +00:00
#alias rm='echo "use trash command instead!"'
#alias rmr='echo "use trash command instead!"'
2019-12-31 05:38:46 +00:00
alias trash='remove_windows_file'
alias tt='remove_windows_file'
alias cgrep='cgrep.exe'
2013-07-07 21:25:47 +00:00
fi
2013-07-07 21:30:11 +00:00
alias c='cd'
2015-10-16 05:11:24 +00:00
alias c-='cd -'
alias cd-='echo "Use c- instead"'
2013-07-07 21:30:11 +00:00
alias ..='cd ../'
alias ...='cd ../..'
alias cd..='cd ..'
alias cd...='cd ../..'
alias cd....='cd ../../..'
alias cd.....='cd ../../../..'
alias aliases='vim ~/.dotfiles/aliases'
2014-06-25 16:41:29 +00:00
alias al='aliases'
2017-11-15 16:30:00 +00:00
2020-04-20 16:41:07 +00:00
# Dev build
2019-03-28 00:13:27 +00:00
b() {
if [ -f build ]; then ./build $@ ; else test -f build.sh && ./build.sh $@ ; fi
}
2020-04-20 16:41:07 +00:00
# fast dev build
bl() {
if [ -f build ]; then ./build $@ -fast ; else test -f build.sh && ./build.sh $@ -fast ; fi
}
# Optimized dev build
2019-03-28 00:13:27 +00:00
bb() {
if [ -f build ]; then ./build -o 1 $@ ; else test -f build.sh && ./build.sh -o 1 $@ ; fi
}
2020-04-20 16:41:07 +00:00
# Production build
2019-05-15 18:00:25 +00:00
bp() {
if [ -f build ]; then ./build -p p $@ ; else test -f build.sh && ./build.sh -p p $@ ; fi
}
2020-04-20 16:41:07 +00:00
# Profiling build
bf() {
if [ -f build ]; then ./build -p pf $@ ; else test -f build.sh && ./build.sh -p pf $@ ; fi
}
# GPU profiling build
bg() {
if [ -f build ]; then ./build -p gpu $@ ; else test -f build.sh && ./build.sh -p gpu $@ ; fi
}
# Run build
r() {
if [ -f run ]; then ./run $@ ; else test -f run.sh && ./run.sh $@ ; fi
}
# Build then run
2019-03-28 00:13:27 +00:00
br() {
b $@ ; r
}
2017-11-15 16:30:00 +00:00
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'
2020-04-20 16:41:07 +00:00
#alias bl='brew link --overwrite'
#lias bld='brew link --overwrite --dry-run'
2013-09-16 20:55:52 +00:00
alias bower='noglob bower'
alias cr='RUSTFLAGS="$RUSTFLAGS -A unused_variables -A dead_code -A unused_parens" cargo run'
2017-03-06 17:46:03 +00:00
alias crr='cargo run --release'
alias cb='RUSTFLAGS="$RUSTFLAGS -A unused_variables -A dead_code -A unused_parens" cargo build'
2017-03-06 17:46:03 +00:00
alias cbr='cargo build --release'
2017-08-24 03:35:32 +00:00
alias clrtmp='trash ~/tmp/*.bak && trash ~/tmp/*.swp'
2017-07-24 21:41:30 +00:00
alias clrtemp='clrtmp'
2016-12-12 04:53:07 +00:00
alias clipboard='xclip -selection c'
2020-01-24 19:28:12 +00:00
# Cloc alias may be overridden by a private alias
2018-11-28 17:22:28 +00:00
alias cloc='cloc --no3 --by-file-by-lang --skip-win-hidden'
2013-07-07 21:30:11 +00:00
alias cls=clear
2013-07-07 21:25:47 +00:00
alias code='cd ~/code'
alias cpr='cp -r'
2016-04-14 13:34:42 +00:00
alias dc='gdc'
alias dot='cd ~/.dotfiles'
2017-02-21 19:46:46 +00:00
alias pdot='cd ~/.private-dotfiles'
2013-07-07 21:30:11 +00:00
alias duh='du -csh'
2020-06-25 17:30:08 +00:00
alias exp='explorer .'
2013-07-10 16:13:13 +00:00
alias f='fg'
2020-07-25 23:39:09 +00:00
alias grep='grep -n --color '
2013-07-10 16:13:13 +00:00
alias history='fc -l 1'
2014-03-07 20:00:19 +00:00
alias histroy='history'
2013-07-10 16:13:13 +00:00
alias irb='irb --readline -r irb/completion'
2015-02-24 04:34:00 +00:00
alias lcc='lein clean'
alias lca='lein cljsbuild auto dev'
alias ldi='lein deps install'
alias lsd='lein start-dev'
2017-08-10 15:46:10 +00:00
alias moon='curl wttr.in/moon'
2013-07-10 16:13:13 +00:00
alias patch='git format-patch HEAD^ --stdout > patch.diff'
alias reguard='killall -9 ruby ; guard'
alias rb='rbenv'
2014-03-07 20:00:19 +00:00
alias rbg='rbenv gemset active'
2014-02-17 07:00:21 +00:00
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'
2017-08-21 18:26:38 +00:00
alias rc='rclone'
alias rcc='rclone copy'
2016-10-23 16:45:42 +00:00
alias restart='sudo shutdown now -r'
2020-04-20 16:41:07 +00:00
alias rl='reload'
alias rmr='rm -r'
2014-02-17 07:00:21 +00:00
alias s='cd ~/.ssh'
alias sc='vim ~/.ssh/config'
2016-10-23 16:45:42 +00:00
alias shutdown='sudo shutdown now'
2017-03-21 13:42:13 +00:00
alias stk='rlwrap stk-simply'
2014-09-30 00:51:23 +00:00
alias t='tree'
2017-07-24 21:41:30 +00:00
alias tag='ctags -R .'
alias tmp='cd ~/tmp'
2013-07-10 16:13:13 +00:00
alias u='cd ..'
alias v='vim'
alias vi='vim'
2014-09-30 00:51:23 +00:00
alias vh='vagrant halt'
alias vs='vagrant ssh'
alias vu='vagrant up'
alias vimrc='vim ~/.vimrc'
2016-12-12 04:53:07 +00:00
alias weather='curl wttr.in/toronto'
2019-12-31 05:38:46 +00:00
alias yt-download='dl_youtube_vid ""'
alias yt-download-1080='dl_youtube_vid "137+140"'
alias yt-download-720='dl_youtube_vid "136+140"'
2019-10-12 16:29:11 +00:00
alias yt-download-playlist='dl_youtube_playlist ""'
alias yt-download-playlist-1080='dl_youtube_playlist "137+140"'
alias yt-download-playlist-720='dl_youtube_playlist "136+140"'
2020-05-08 00:35:56 +00:00
alias yt-download-playlist-tiny='dl_youtube_playlist "160+140"'
2019-10-12 16:29:11 +00:00
alias yt-download-audio='youtube-dl.exe -f "140"'
2019-12-31 05:38:46 +00:00
alias yt-download-and-hflip='dl_youtube_vid_and_hflip "137+140"' # 1080p
alias ig-download-and-hflip='dl_instagram_vid_and_hflip '
alias download-mp4='dl_mp4'
2019-12-02 14:16:38 +00:00
alias tw-download-chat='dl_twitch_chat'
2019-10-12 16:29:11 +00:00
alias tw-dl='youtube-dl.exe -f "1080" -o "%(upload_date)s-%(title)s-twitch-%(id)s.%(ext)s"'
alias tw-dl2='youtube-dl.exe -o "%(upload_date)s-%(title)s-twitch-%(id)s.%(ext)s"'
2020-04-20 16:41:07 +00:00
alias tw-download-custom='dl_twitch_vid '
2020-07-21 15:29:52 +00:00
alias tw-download='dl_twitch_vid "1080p" 0 0'
alias tw-download-compressed='dl_twitch_vid "1080p" 0 25'
alias tw-download-shortname='dl_twitch_vid "1080p" 1 0'
alias tw-download-shortname-compressed='dl_twitch_vid "1080p" 1 25'
alias tw-download-1080='dl_twitch_vid "1080" 0 0'
alias tw-download-1080-compressed='dl_twitch_vid "1080" 0 25'
alias tw-download-1080-shortname='dl_twitch_vid "1080" 1 0'
alias tw-download-1080-shortname-compressed='dl_twitch_vid "1080" 1 25'
alias tw-download-60='dl_twitch_vid "1080p60" 0 0'
alias tw-download-60-compressed='dl_twitch_vid "1080p60" 0 25'
alias tw-download-60-shortname='dl_twitch_vid "1080p60" 1 0'
alias tw-download-60-shortname-compressed='dl_twitch_vid "1080p60" 1 25'
alias tw-download-720='dl_twitch_vid "720p-1" 0 0'
alias tw-download-720-shortname='dl_twitch_vid "720p-1" 1 0'
alias tw-download-720-60='dl_twitch_vid "720p60" 0 0'
alias tw-download-720-60-shortname='dl_twitch_vid "720p60" 1 0'
alias tw-download-4k='dl_twitch_vid "2160p" 0 0'
alias tw-download-4k-compressed='dl_twitch_vid "2160p" 0 25'
alias tw-download-4k-shortname='dl_twitch_vid "2160p" 1 0'
alias tw-download-4k-shortname-compressed='dl_twitch_vid "2160p" 1 25'
2013-07-07 21:30:11 +00:00
####################################################################################################
2013-07-07 21:30:11 +00:00
# Git
####################################################################################################
2017-11-21 04:08:51 +00:00
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
2017-10-10 23:49:48 +00:00
2015-11-04 19:25:27 +00:00
alias am='git commit --amend'
2015-11-18 02:50:00 +00:00
alias ama='git commit --amend -C head --author'
2015-11-04 19:25:27 +00:00
alias ams='git commit -S --amend' # signed
alias ammend='echo "use am instead"'
alias amend='echo "use am instead"'
2020-07-21 15:29:52 +00:00
alias g='git_cmd_wrapper'
2019-10-12 16:29:11 +00:00
alias ga='git add -A'
2020-05-14 05:45:07 +00:00
alias gaa='git add -A; gdcc'
2019-10-12 16:29:11 +00:00
alias gap='git add -Ap'
2013-07-07 21:30:11 +00:00
alias gau='git add --update'
alias gaup='git add --update -p'
2017-07-13 20:02:25 +00:00
alias gb='git branch -v'
2013-07-16 23:36:06 +00:00
alias gbd='git branch -D'
2020-05-14 05:45:07 +00:00
alias gbdr='git branch -Dr'
2014-05-17 19:31:36 +00:00
alias gbl='git branch --all'
2018-03-15 18:39:50 +00:00
alias gblm='git blame -wMC'
2014-09-30 00:51:23 +00:00
alias gbm='git branch -m'
2015-11-04 19:25:27 +00:00
alias gbr='git branch -rv'
2013-07-07 21:30:11 +00:00
alias gc='git commit'
2020-05-08 00:35:56 +00:00
alias gcs='git commit -S' # signed
2013-07-07 21:25:47 +00:00
alias gcl='git clone'
alias gcm='git_commit'
alias gcms='git_commit_signed' # signed
2013-07-07 21:25:47 +00:00
alias gco='git checkout'
2017-08-21 18:26:38 +00:00
alias gco-='git checkout -'
2018-10-05 17:38:00 +00:00
git_checkout_build() {
git checkout "$1" ; b
}
alias gcoo=git_checkout_build
2013-07-16 23:36:06 +00:00
alias gcob='git checkout -b'
2014-06-25 16:41:29 +00:00
alias gcon='vi .git/config'
2013-07-07 21:30:11 +00:00
alias gcp='git cherry-pick'
2014-12-01 00:18:25 +00:00
alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue'
2014-05-17 19:31:36 +00:00
alias gcps='git cherry-pick -n'
2013-07-07 21:25:47 +00:00
alias gd='git diff'
2020-05-14 05:45:07 +00:00
alias gdc='git diff --cached'
alias gdcc='git diff --cached --color-words'
2013-07-07 21:25:47 +00:00
alias gdm='git diff master'
2013-07-07 21:30:11 +00:00
alias gds='git diff --stat=160,120'
alias gf='git fetch'
2015-02-24 04:34:00 +00:00
alias gfa='git fetch --all'
2020-05-14 05:45:07 +00:00
alias gfd='git fetch --prune' # Removes remote branches that don't have a counterpart branch on the remote.
2014-12-01 00:18:25 +00:00
alias gfix="git commit --amend -C HEAD"
2017-08-21 18:26:38 +00:00
alias gfixx="git commit --amend -C HEAD ; gp -f"
2014-12-01 00:18:25 +00:00
alias gfixs="git commit -S -a --amend -C HEAD" # signed
2014-02-17 07:00:21 +00:00
alias gfo='git fetch origin'
2020-03-15 18:44:36 +00:00
alias gfu='git fetch up'
2014-02-17 07:00:21 +00:00
alias gfm='git fetch origin master'
2015-02-24 04:34:00 +00:00
alias gfup='git fetch upstream'
2015-11-04 19:25:27 +00:00
alias ggrep='git log --all --oneline | grep '
2015-10-16 05:11:24 +00:00
alias gla='git lg --all'
alias gl='git lg -30'
alias gll='git lg'
2014-01-25 04:04:23 +00:00
alias gli='git show --pretty="format:" --name-only'
alias glog='git log'
2019-10-12 16:29:11 +00:00
alias glom='gl origin/master'
2013-07-25 16:54:40 +00:00
alias gm='git merge'
2015-11-04 19:25:27 +00:00
alias gmnff='git merge --no-ff'
2013-07-10 16:13:13 +00:00
alias gmff='git merge --ff-only'
2015-10-16 05:11:24 +00:00
alias gmffm='git merge --ff-only master'
2014-02-17 07:00:21 +00:00
alias gmffs='git merge --ff-only --squash'
2013-07-07 21:30:11 +00:00
alias gmtheirs='git merge -Xtheirs'
2013-07-07 21:25:47 +00:00
alias gp='git push'
alias gpa='git push --all && echo "pushing tags..." && git push --tags'
2014-03-07 20:00:19 +00:00
alias gpdf='gpf && gphf'
2015-03-21 19:13:00 +00:00
alias gps='git push staging'
2014-03-07 20:00:19 +00:00
alias gppf='gpf && git push production HEAD:production -f'
2015-10-16 05:11:24 +00:00
alias gpu='git push --set-upstream origin HEAD'
2013-07-07 21:30:11 +00:00
alias gpff='git pull --ff-only'
2015-02-24 04:34:00 +00:00
alias gplup='git pull upstream master'
2016-10-23 16:45:42 +00:00
alias gpo='git push origin'
2013-07-07 21:30:11 +00:00
alias gpom='git push origin master'
2013-07-07 21:25:47 +00:00
alias gpr='git pull --rebase'
2014-05-17 19:31:36 +00:00
alias gpt='git push --tags'
2013-07-07 21:30:11 +00:00
alias gr='git reset'
2016-04-14 13:34:42 +00:00
alias gr1='git reset HEAD^1'
2014-01-25 04:04:23 +00:00
alias grb='git rebase'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
2015-11-29 19:04:40 +00:00
alias grbs='git rebase --skip'
2019-03-28 00:13:27 +00:00
alias grbi='git rebase -i --autostash'
alias grbm='git rebase master --autostash'
alias grbmi='git rebase master -i --autostash'
2014-02-17 07:00:21 +00:00
alias grbo='git fetch origin master && git rebase origin/master'
2015-10-16 05:11:24 +00:00
alias grboi='git fetch origin master && git rebase origin/master -i'
alias grbum='git fetch upstream master && git rebase upstream/master'
2013-07-07 21:30:11 +00:00
alias gre='git remote'
2014-09-30 00:51:23 +00:00
alias grea='git remote add'
2016-04-14 13:34:42 +00:00
alias gremo='git remote remove origin; git remote add origin'
2014-09-30 00:51:23 +00:00
alias greao='git remote add origin'
alias gred='git remote remove'
2018-11-28 17:22:28 +00:00
alias gref='git reflog --format="%C(auto)%h %<|(17)%gd %C(cyan)%ci%C(reset) [%gs] %C(yellow)(%s)%C(reset)"'
2013-08-13 15:17:54 +00:00
alias grev='git remote -v'
2013-07-16 15:24:18 +00:00
alias grm='git rm'
2015-02-24 04:34:00 +00:00
alias grmr='git rm -r'
2016-04-14 13:34:42 +00:00
alias grp='git reset -p'
2013-07-07 21:30:11 +00:00
alias gsnapshot='git stash save "snapshot: $(date)" && git stash apply "stash@{0}"'
2014-03-07 20:00:19 +00:00
alias gsh='git show'
2018-03-15 18:39:50 +00:00
alias gshh='git show -w'
2013-07-07 21:30:11 +00:00
alias gs='git stash'
2016-04-14 13:34:42 +00:00
alias gsk='git stash -k -u'
2019-10-12 16:29:11 +00:00
alias gssk='git stash save -k -u'
alias gss='git stash save'
2013-07-07 21:30:11 +00:00
alias gsd='git stash drop'
2014-09-30 00:51:23 +00:00
alias gsdl='git stash drop stash@{0}'
2013-07-07 21:30:11 +00:00
alias gsl='git stash list'
2016-04-14 13:34:42 +00:00
alias gsi='git stash -p'
2013-07-07 21:30:11 +00:00
alias gsp='git stash pop'
2017-08-21 18:26:38 +00:00
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}'
2020-05-08 00:35:56 +00:00
alias gt='git tag -s' # Signed
2014-05-17 19:31:36 +00:00
alias gta='git tag -a'
alias gtd='git tag -d'
alias gtl='git tag -l'
2013-07-07 21:30:11 +00:00
alias gx='git reset --hard'
2015-11-04 19:25:27 +00:00
alias gxx='git reset --hard HEAD~1'
2019-10-12 16:29:11 +00:00
alias gxom='git reset --hard origin/master'
alias gstats='echo "Total commits: $(git rev-list HEAD --count)"; echo "\nAuthor breakdown:"; git shortlog | grep -E "^[^ ]"'
2015-10-16 05:11:24 +00:00
alias gwip="git add . && git commit -m \"WIP\""
2013-07-07 21:30:11 +00:00
2017-08-10 15:46:10 +00:00
# Haxe
alias flow='haxelib run flow'
alias snowfall='haxelib run snowfall'
# Other aliases
2017-04-25 16:01:18 +00:00
alias pal='vim ~/.private-dotfiles/aliases'
test -f ~/.private-dotfiles/aliases && . ~/.private-dotfiles/aliases
2017-06-12 11:23:58 +00:00
alias cmake-gen='cmake -D CMAKE_CXX_COMPILER="/Library/Developer/CommandLineTools/usr/bin/c++" CMAKE_C_COMPILER="/Library/Developer/CommandLineTools/usr/bin/cc" ..'