-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_zsh_aliases
133 lines (113 loc) · 4.73 KB
/
dot_zsh_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
# Binds (https://stackoverflow.com/questions/6205157/iterm-2-how-to-set-keyboard-shortcuts-to-jump-to-beginning-end-of-line#10485061)
#-------------------
bindkey -e
bindkey '^[[1;9C' forward-word
bindkey '^[[1;9D' backward-word
# Aliases
#-------------------
# Builtins
alias c="clear"
alias l="ls -la"
alias lsd="ls -d */"
alias motd="sudo run-parts /etc/update-motd.d"
# Colorls
#if command -v colorls > /dev/null 2>&1; then
# alias ls="colorls --dark -1 --sd --gs"
#fi
# EZA
if command -v eza > /dev/null 2>&1; then
alias ls="eza --icons -1 --group-directories-first -g --git --git-repos -o"
fi
# Remap dirs (used to override prezto module)
alias d='dirs -v'
for index ({1..11}) alias "$index"="cd -${index}"; unset index
## ASDF TOOLS
alias cm="$(asdf which chezmoi)"
alias vim="$(asdf which nvim)"
## TOOLS ALIASES
alias kc="kubectl"
alias cf="cloudflared"
alias tf="terraform"
alias lg="lazygit"
# alias tg="terragrunt"
# alias ts="terraspace"
# alias bs="brew services"
# alias open="xdg-open" # TODO: Just for Linux
# alias oc="overcommit" # https://github.com/sds/overcommit#installation
# alias ocr="overcommit --run"
# Source dotfiles
alias zshsource="source $HOME/.zshrc && source $HOME/.zpreztorc"
# Edit Regular Config files
alias zshaliases="cm edit $HOME/.zsh_aliases;cm apply"
alias zshenv="cm edit $HOME/.zsh_env;cm apply"
alias zshopts="cm edit $HOME/.zsh_opts;cm apply"
alias zshconfig="cm edit $HOME/.zshrc;cm apply"
alias zshfunctions="cm edit $HOME/.zsh_functions;cm apply"
alias prezconfig="cm edit $HOME/.zpreztorc;cm apply"
alias preztheme="cm edit $HOME/.zprezto/contrib/rojo-prompt/prompt_rojo_setup;cm apply"
alias gitconfig="cm edit $HOME/.gitconfig;cm apply"
alias nvimconfig="nvim ~/.config/nvim"
# alias yabaiconfig="cm edit $HOME/.config/yabai/executable_yabairc"
# alias skhdconfig="cm edit $HOME/.config/skhd/executable_skhdrc"
# alias spacebarconfig="cm edit $HOME/.config/spacebar/spacebarrc"
# Edit Encrypted Config Files
alias zsecrets="cm edit $HOME/.zsh_secrets"
alias sshconfig="cm edit $HOME/.ssh/"
alias hostconf="sudo $EDITOR /etc/hosts"
# Ruby/Rails
# alias rs="rails server"
# alias rc="rails console"
# alias bc="bin/console"
# alias be="bundle exec"
# alias gemconfig="$EDITOR $HOME/.rvm/gemsets/global.gems"
# alias rspuma="RAILS_ENV=development bundle exec rails s Puma -p 8080"
# alias dbreset="rake db:migrate:reset && rake db:reset"
# alias mtest="ruby -r minitest/pride *_test.rb"
# Docker
alias dimg="docker images" # Show docker images.
alias drmi='docker rmi $(docker images -q)' # Remove all images.
alias dpsa='docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Networks}}\t{{.Image}}"' # Show running docker containers.
alias dpsap='docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Networks}}\t{{.Ports}}"' # Show containers with ports
alias dpsaq="docker ps -aq" # Show running docker containers without Header (used for other aliases).
alias dstop='docker stop $(dpsaq)' # Stop all running containers.
alias drma='docker rm $(dpsaq)' # Remove all running containers.
alias dclean="docker images -qf dangling=true | xargs docker rmi" # Remove all dangling images.
alias dprune="docker system prune -a" # Delete unused or dangling images, containers, volumes and networks
alias dfind='docker images -a | grep $1' # List images that match pattern.
alias dfindrm='docker images -a | grep $1 | awk "{print $3}" | xargs docker rmi' # Remove images that match pattern.
alias dex="docker ps -a -f status=exited" # List exited containers.
alias dexrm='docker rm $(docker ps -a -f status=exited -q)' # Stop exited containers.
alias drmf='docker stop $(dpsaq) && docker rm $(dpsaq)' # Stop and Remove all containers
alias dc="docker compose"
# Skaffold
#alias ska='skaffold'
# GCP
# alias gc='gcloud'
# alias gcl='gcloud config configurations list'
# alias gca='gcloud config configurations activate'
# alias gcpl='gcloud projects list'
# Makefile
# alias mkt="make test"
# alias mktb="make test-build"
# alias mktd="make test-down"
# alias mktp="make test-prompt"
# alias mkd="make dev"
# alias mkdd="make dev-down"
# alias mks="make status"
# Rancher ctl
# #alias rkctl="rancher kubectl"
# # i.e: `rkxc <some_namespace> <some_pod_id> -- ash`
# alias rkxc="rkctl exec -i -t -n"
# # i.e: `rkgp <some_namespace>`
# alias rkgp="rkctl get pods -n"
# # i.e: `pfwd gateway kong-postgres-0 5433:5432`
# alias pfwd="rkctl port-forward -n $1 $2 $3"
# AWS
# alias ausers="aws iam list-users | jq '.Users[].UserName'"
#
# ## Github Actions
# alias ghdr='gh api repos/$1/actions/runs | jq -r ".workflow_runs[] | select(.head_branch != \"docker\") | \"(.id)\"" | xargs -n1 -J % gh api repos/$1/actions/runs/% -X DELETE'
#
# ## Kubernetes
# alias krtp="kc run test-pod --image ubuntu:latest sleep infinity"
# alias ketp="kc exec -it test-pod -- bash"