-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases
138 lines (111 loc) · 4.05 KB
/
aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# kubernetes
alias k="kubectl"
alias kshell="~/code/dotfiles/bin/kshell"
alias kexec="kubectl exec --stdin --tty $1 -- /bin/bash"
alias kconf="vim ~/.kube/config"
alias kcheat="open https://kubernetes.io/docs/reference/kubectl/cheatsheet/"
alias kn="kubens"
alias kc="kubectx"
alias debug="kubectl run -i --tty --rm debug --image=ubuntu:latest --restart=Never -- /bin/bash"
alias debugalpine="kubectl run -i --tty --rm debug --image=alpine:3.7 --restart=Never -- /bin/sh"
# localenv
function localenv='f() { @export $(cat .env | xargs) };f'
# ffmpeg
alias codec="ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 $1"
# aws
alias awsprofiles='export AWS_PROFILE=$(sed -n "s/\[profile \(.*\)\]/\1/gp" ~/.aws/config | fzf)'
alias awslogin='awsprofiles && aws sso login'
# postgres
function pgtest='f() { docker exec -it "$1" /usr/bin/perl /usr/bin/psql -U postgres };f'
# aws
alias awssso="aws configure sso"
# terraform/terragrunt
alias tf="terraform"
alias tg="terragrunt"
alias tgraph="terraform graph | dot -Tsvg > graph.svg"
# tmux
alias tn="tmux -S /tmp/pair"
alias to="tmux -S /tmp/pair a"
alias mux="tmuxinator"
# clean
alias killdsstore="find . -name '.DS_Store' -type f -delete"
# blog
alias blog="cd ~/code/jmeridth.github.io"
# docker
function px(){
docker exec -it "$1" /bin/bash
}
alias dockerdebugalpine="docker run -it --rm --name debug alpine:3.7 /bin/sh"
alias dockerdebugubuntu="docker run -it --rm --name debug ubuntu:latest /bin/sh"
alias ddebug="docker run -d --name debug -ti $1 /bin/bash"
alias did="docker images --quiet --filter 'dangling=true' | xargs docker rmi"
alias dsp="docker system prune -af"
alias dkc="docker ps -aq | xargs docker rm -f"
alias dkui="docker rmi $(docker images | grep '^<none>' | awk '{print $3}')"
alias dki="docker images -aq | xargs docker rmi -f"
alias dkv="docker volume ls -qf dangling=true | xargs docker volume rm"
alias dka="dkc;dki;dkv;dsp"
alias osxdocker="docker run -it --rm --privileged --pid=host justincormack/nsenter1"
# fix external display detection
alias getautorandr="sudo wget https://raw.githubusercontent.com/wertarbyte/autorandr/master/autorandr -O /usr/bin/autorandr && sudo chmod +x /usr/bin/autorandr"
alias fixdisplays="getautorandr && autorandr --change"
# mysql
alias mysqlstop="sudo systemctl stop mysql"
alias mysqlstart="sudo systemctl start mysql"
# APT-GET
alias update="sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y && sudo apt autoclean -y && sudo apt autoremove -y"
# config files
alias vimrc="vim ~/.vimrc"
alias zshrc="vim ~/.zshrc"
alias aliases="vim ~/.aliases"
# cli usage
alias ..="cd .."
alias senv="source ~/.zshrc && cd ."
# cd helpers
alias dotfiles="cd ~/code/dotfiles"
# ag
function agsearch(){
ag --$1 -i $2 .
}
alias agp='agsearch "py" $1'
alias agr='agsearch "rb" $1'
# gpg
alias gpgreset='gpgconf --kill gpg-agent && gpg --card-status'
alias jmencrypt='(){gpg --output "$1".gpg --encrypt --recipient [email protected] "$1"}'
alias jmdecrypt='(){gpg --output "$1" --decrypt "$1".gpg}'
alias jmtest='(){echo "$1".gpg}'
# json
alias json="python -m json.tool"
# python
alias pyclean="find . -name '*.pyc' -delete"
alias pyinit="touch __init__.py"
alias py="ptpython"
alias cvenv="python3 -m venv venv"
alias avenv="source venv/bin/activate"
# git (that aren't provided with ohmyzsh git plugin)
alias gl='git pull -r --prune'
alias gs='git status -sb'
alias gcas!='gca! -s'
# tar
alias tardir='tar -czvf "$1"'
alias untarzippeddir='tar -xzvf "$1" "$2"'
alias untardir='tar -xvf "$1"'
# ls
alias l='ls -lah --color'
# intellij (on osx)
alias intellij='open -a IntelliJ\ IDEA ./'
# grc overides for ls
# Made possible through contributions from generous benefactors like
# `brew install coreutils`
if $(gls &>/dev/null)
then
alias l="gls -lAh --color"
alias ll="gls -l --color"
alias la='gls -A --color'
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ -a $HOME/.aliases.osx ]] ; then source $HOME/.aliases.osx ; fi
fi
if [[ "$OSTYPE" == "linux"* ]]; then
if [[ -a $HOME/.aliases.linux ]] ; then source $HOME/.aliases.linux ; fi
fi