-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
executable file
Β·188 lines (153 loc) Β· 5.64 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# ------------------------------------------------------------------------------
# ----------------------------------DOCKER--------------------------------------
# ------------------------------------------------------------------------------
# ------------------------------- Important ------------------------------------
#
# Set the path to your docker-compose.yml file here:
DOCKER_COMPOSE_PATH='workspace'
# Runs a docker-compose command of your choice from anywhere.
# Usage: dc <service>
dc() {
docker-compose --project-directory ~/$DOCKER_COMPOSE_PATH -f ~/$DOCKER_COMPOSE_PATH/docker-compose.yml $@
}
# Docker-compose restart
# Usage: dcr <service>
dcr() {
dc kill "$1"
dc up -d "$1"
}
## Docker logs - for services ran with just Docker run
dl() {
d logs --tail "100" -f "$1"
}
# Docker Compose Logs.
#
# Inspect the logs in real-time of a container by name.
# Defaults to all containers if no name is specified.
#
# Usage: dcl
# Usage: dcl <name>
dcl() {
dc logs --tail "100" -f "$1"
}
# Docker-compose restart logs - will restart container and bring up its logs
dcrl() {
dc kill "$1"
dc up -d "$1"
dcl "$1"
}
# Docker stop all running containers
alias dsa='docker stop $(docker ps -a -q)'
alias d='docker'
alias dcu='dc up -d'
alias de='dc exec'
alias dr='d run -it --rm -v $(pwd):$(pwd) -w $(pwd)'
alias dd='d kill $(d ps -a -q); d rm $(d ps -a -q)'
alias dp='d ps -a'
alias purgeDocker='d kill $(d ps -a -q); d rm $(d ps -a -q); d volume rm $(d volume ls -q); d network rm $(d network ls -q)'
alias purgeDockerImages='d rmi -f $(d images -f dangling=true -q)'
# Docker Cleanup.
# Deletes all containers and images.
#
# Usage: dcleanup
dcleanup() {
docker rm $(docker ps -q -f 'status=exited')
docker rmi $(docker images -q -f "dangling=true")
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /etc:/etc spotify/docker-gc
}
# ------------------------------------------------------------------------------
# ---------------------------------- GIT----------------------------------------
# ------------------------------------------------------------------------------
# Git Pull
#
# Will pull all branches in children directories:
# to do all individually
# ls | xargs -I{} git -C {} pull
# to do all in parallel
alias pullall='ls | xargs -P10 -I{} git -C {} pull'
# Undo commit but keep all changes staged
alias reset='git reset --soft HEAD~;'
# Git Rebase.
#
# Rebases the specified branch onto the current branch,
# squashing the commits into a single one,
# using the first message as the final commit message.
#
# If no branches are specified, the master branch is used.
#
# Usage: gr
# Usage: gr <trunk>
# gr(){
# TRUNK=${1:-master}
# MSG=$(git log --oneline --abbrev-commit $TRUNK..HEAD --pretty=format:"%s" --reverse | head -1)
# git fetch origin "$TRUNK"
# git reset $(git merge-base origin/$TRUNK $(git rev-parse --abbrev-ref HEAD))
# git add -A
# git commit -m "${MSG}"
# }
# ------------------------------------------------------------------------------
# -----------------------------CUSTOM CONFIG:-----------------------------------
# ------------------------------------------------------------------------------
# Remove "last login" message from terminal
if [ ! -e ~/.hushlogin ]
then
touch .hushlogin
fi
# reload this config file on changes
alias r='source ~/.zshrc'
# NVM path
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
# OTHER PATHS
export PATH="$PATH:$HOME/.rvm/bin"
# React Native
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
alias uiweb='cd $DOCKER_COMPOSE_PATH/services/ui-website'
alias workspace='cd $DOCKER_COMPOSE_PATH'
alias services='cd $DOCKER_COMPOSE_PATH/services'
alias morning='update && workspace && make login-sso'
alias update='brew update && brew upgrade'
alias pgstart='pg_ctl -D /usr/local/var/postgres start'
alias pgstop='pg_ctl -D /usr/local/var/postgres stop'
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
alias python="python3"
alias pip="pip3"
alias ngrok="ngrok http https://localhost:5000 --host-header="localhost:5000""
alias awssso="aws sso login --profile "$1""
alias localip="ipconfig getifaddr en0"
alias kube="kubectl"
alias refresh-alias='curl -sS https://raw.githubusercontent.com/jamesslomka/DotFiles/master/.zshrc >> ~/.zshrc'
alias tunnel="cloudflared tunnel --url localhost:8080 --http-host-header="localhost""
alias flushdns="dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
# ------------------------------------------------------------------------------
# -------------------------------ZSH CONFIG:------------------------------------
# ------------------------------------------------------------------------------
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
plugins=(
git
zsh-autosuggestions
node
npm
cp
zsh-syntax-highlighting # needs to always be the last plugin
)
# autoload -U compinit; compinit -y
# Pure Theme
autoload -U promptinit; promptinit
# change the color for both `prompt:success` and `prompt:error`
zstyle ':prompt:pure:git:branch' color white
# turn on git stash status
zstyle :prompt:pure:git:stash show yes
PURE_GIT_DOWN_ARROW=β
# Git *when branch has changes from remote
# zstyle :prompt:pure:git:dirty color '#808080'
zstyle :prompt:pure:git:dirty color '#7a7a7a'
prompt pure
# tabtab source for packages
# uninstall by removing these lines
[[ -f ~/.config/tabtab/__tabtab.zsh ]] && . ~/.config/tabtab/__tabtab.zsh || true
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh