-
Notifications
You must be signed in to change notification settings - Fork 1
/
.zshrc
106 lines (83 loc) · 3.97 KB
/
.zshrc
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
# for zsh
export HISTFILESIZE=10000
export HISTCONTROL=ignoredups
export LANG=en_US.UTF-8
# for oh-my-zsh
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="joni-two"
DISABLE_AUTO_TITLE=true
COMPLETION_WAITING_DOTS=true
DISABLE_UPDATE_PROMPT=true
plugins=(heroku zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# Mac
if [[ $(uname) == 'Darwin' ]]; then
# editor
export EDITOR=code
alias a=$EDITOR
# for homebrew
export HOMEBREW_ROOT=/opt/homebrew
export PATH=$HOMEBREW_ROOT/bin:$HOMEBREW_ROOT/sbin:$PATH
export HOMEBREW_INSTALL_CLEANUP=true
alias bu='brew update && brew upgrade && brew cleanup; brew doctor'
# for gpg
export GPG_TTY=$(tty)
# for node modules
export PATH=$PATH:./node_modules/.bin
# for nvm
export NVM_DIR="$HOME/.nvm"
. "/opt/homebrew/opt/nvm/nvm.sh"
alias n='npm run-script'
# for go
export GOROOT=/opt/homebrew/opt/go/libexec
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# for yarn
export PATH=$PATH:$(yarn global bin)
alias y='yarn'
alias yu='yarn global upgrade'
# for kubernetes
alias k='kubectl'
alias ks="echo '* deployments'; kubectl get deployment; echo '* pods'; kubectl get pods; echo '* services'; kubectl get service; echo '* ingresses'; kubectl get ing"
# for ruby
if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi
# for mysql/maria
alias mysql-start='mysql.server start'
alias mysql-stop='mysql.server stop'
# for postgres
alias pg-start='pg_ctl -D /opt/homebrew/var/postgres -l /opt/homebrew/var/postgres/server.log start'
alias pg-stop='pg_ctl -D /opt/homebrew/var/postgres stop -s -m fast'
# for dynamo
alias ddb="aws dynamodb --endpoint-url http://localhost:8000"
# for ftp
alias ftp-start='sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist'
alias ftp-stop='sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist'
# for docker
alias docker-remove-all='docker stop $(docker ps -q); docker rm $(docker ps -a -q); docker rmi -f $(docker images -q)'
# for misc
alias s='cd ~/Sites'
alias dropbox_conflicts='find ~/Dropbox -name \*conflicted\ copy\*'
alias netlisteners='lsof -i -P | grep LISTEN'
alias static-serve='python -m SimpleHTTPServer 8000'
alias t='trans -show-languages n -show-translation n -show-original n fi:en'
alias te='trans -show-languages n -show-translation n -show-original n en:fi'
alias update='echo "==> Updating Homebrew packages" && brew update && brew upgrade && brew cleanup; brew doctor && echo "\n==> Updating Yarn packages" && yarn global upgrade -s --no-progress && echo "\n==> Updating Apple software" && softwareupdate --install --all && echo'
alias startup-items='echo "\n/Library/LaunchDaemons (root)\n======================"; find /Library/LaunchDaemons/*; echo "\n/Library/LaunchAgents (all users)\n====================="; find /Library/LaunchAgents/*; echo "\n~/Library/LaunchAgents ($(whoami))\n======================"; find ~/Library/LaunchAgents/*; echo'
sleep-log() {
DAYS=${1:-"0"}
pmset -g log | egrep 'UserIsActive|FullWake|Display is turned on|powerd process|\(coreaudiod\) Released PreventUserIdleSystemSleep' | egrep -B 1 'UserIsActive|FullWake|Display is turned on|powerd process' | grep $(date -v -${DAYS}d +"%Y-%m-%d"); date +%Y-%m-%d\ %H:%M.%S\ nyt;
}
function iterm2_print_user_vars() {
iterm2_set_user_var kubecontext $(kubectl config current-context)
}
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
fi
# generate password
alias gp='openssl rand -base64 21'
# misc
alias pgrep='pgrep -lf'
# git
alias g='git'
alias git-clean-repo='du -sh $(pwd) && git fetch && git remote prune origin && git branch | grep -v main | grep -v "$(git symbolic-ref --short -q HEAD)" | xargs git branch -D && git gc && if [ -f Gemfile ]; then bundle clean; fi && du -sh $(pwd)'
# heroku autocomplete setup
HEROKU_AC_ZSH_SETUP_PATH=~/Library/Caches/heroku/autocomplete/zsh_setup && test -f $HEROKU_AC_ZSH_SETUP_PATH && source $HEROKU_AC_ZSH_SETUP_PATH;