-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshenv
207 lines (169 loc) · 8.25 KB
/
.zshenv
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#
# Defines environment variables.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
# Ensure that a non-login, non-interactive shell has a defined environment.
if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
source "${ZDOTDIR:-$HOME}/.zprofile"
fi
# make aliases work with sudo
alias sudo='sudo '
# Aliases
alias g='git'
alias gs='git status -s'
alias ui-start='API_PROXY=ui-proxy SIMPLE_FORMATTER=true NO_TS_CHECK=true yarn run client:start'
alias codereview='/Users/itai/dev/codereview/codereview.sh'
alias gco='git co'
alias gadd='git add'
alias gitp='git push --dry-run --no-verify && git push'
alias gre='git reset'
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
alias aws_auth_dev='~/aws_auth.sh -u noami -a "https://civ1.dv.adskengineer.net:8200" -v "account/487986017923/sts/Owner"'
alias sub="cd ~/dev/acs-submittals"
alias bim="cd ~/dev/meetings-ui-web"
alias platform="cd ~/dev/acs-sc-web-platform"
alias edu="cd ~/edu"
#
# alias cj="jira view $(git branch | sed -n '/\* /s///p' | grep -oiE 'ui-[0-9]{4}')"
alias laptop-mount="sudo sshfs -o allow_other,defer_permissions,IdentityFile=/Users/itai/.ssh/id_rsa [email protected]:/home/itai/dev /Users/itai/laptop"
alias laptop-ssh="ssh [email protected]"
alias sharbot='slack-cli -d sharbot "allocate" && sleep 5 && slack-cli -d sharbot "super extend" && slack-cli -l 3 -s sharbot | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | cut -f 1 | xargs sudo python /Users/itai/dev/mui/tools/ui-proxy'
alias mui-sync="while sleep 2; do ls ~/dev/mui/js/client/dist | entr -d npm run deploy ui-proxy; done"
alias magit="emacs --no-window-system --eval '(progn (magit-status) (delete-other-windows))'"
alias ag='ag --path-to-ignore ~/.agignore'
# nvim - because I have 2 version installed - take homebrew
alias nvim="/opt/homebrew/bin/nvim"
alias nvim-lazy="NVIM_APPNAME=lazy-nvim nvim"
alias nvim-ks="NVIM_APPNAME=kickstart-nvim nvim"
# python config
alias python3='/usr/local/bin/python3.7'
alias pip3='/usr/local/bin/pip3.7'
export WORKON_HOME=~/Envs
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.7
source /usr/local/bin/virtualenvwrapper.sh
# workflows_service specific
export PYCURL_SSL_LIBRARY=openssl
export CPPFLAGS=-I/usr/local/opt/openssl/include
export LDFLAGS=-L/usr/local/opt/openssl/lib
## Helper functions
sharbot1() {
slack-cli -d sharbot "allocate";
sleep 5 && slack-cli -d sharbot "super extend";
slack-cli -l 3 -s sharbot | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | cut -f 1 | xargs sudo python /Users/itai/dev/mui/tools/ui-proxy
}
fzf-down() {
fzf --height 60% "$@" --border
}
codi() {
local syntax="${1:-javascript}"
shift
vim -c \
"let g:startify_disable_at_vimenter = 1 |\
let g:codi#interpreters = { 'javascript': {'width': 70, 'rightalign':0},} |\
set bt=nofile ls=0 noru nonu nornu |\
hi ColorColumn ctermbg=NONE |\
hi VertSplit ctermbg=NONE |\
hi NonText ctermfg=0 |\
Codi $syntax" "$@"
}
branches() {
git branch --sort=-committerdate | cut -c2- | fzf --height 40% --reverse --preview="echo {} | xargs -I % sh -c 'git log origin/develop..%'"
}
commits() {
HASH=`git --no-pager log --pretty=format:'%h %<(20)%an %<(15)%cr %s' |\
fzf-down --tiebreak=index --reverse |\
awk 'END { if (NR==0) exit 1; else print $1;}'` && echo $HASH
}
unstaged() {
git ls-files --modified --others --exclude-standard | fzf --height 50% --reverse -m --preview-window down:35 --bind "ctrl-n:preview-page-down,ctrl-p:preview-page-up,q:abort"\
--preview="echo {}| cut -d ' ' -f3 | xargs -I % sh -c 'git diff --color % | diff-so-fancy'"
}
staged() {
git diff --name-only --cached | fzf --height 50% --reverse --preview-window down:35 --bind "ctrl-n:preview-page-down,ctrl-p:preview-page-up,q:abort"\
--preview="echo {}| cut -d ' ' -f3 | xargs -I % sh -c 'git diff --staged --color % | diff-so-fancy'"
}
changed() {
git status -s | fzf --height 50% --preview-window down:35 --ansi -m | cut -c 4-
}
stashes() {
git stash list | fzf --height 50% --reverse -m --preview-window down:35 --preview="echo {} | cut -d ':' -f1 | xargs -I % sh -c 'git stash show -p %' | diff-so-fancy" | cut -d ":" -f1
}
printing_test () {
# shows how printing to prompt can be done. can be used improve jiras by pasting branch name into terminal.
JIRA=$(git branch | sed -n '/\* /s///p' | grep -oiE 'ui-[0-9]{4}'); print -z $JIRA;
print -z asdf $JIRA;
}
jiras() {
BRANCH=$(jira list --query "resolution = unresolved and status = open and assignee=currentuser() ORDER BY cf[10007] ASC, created" |\
fzf --height 90% --reverse \
--header 'Press CTRL-X to copy, ENTER to browse' \
--preview-window down:15 --preview="echo {}| cut -d : -f 1 |xargs -I % sh -c 'jira view %'" |\
awk -F : '{print $1 "%" $2 }' | tr -d ,.\' | tr -s " " | awk '{gsub(" ","-");print}' | awk '{gsub("%"," ");print}');
echo ${BRANCH:0:8}${BRANCH:9} | awk '{print tolower($0)}'
}
# not working yet as multi (-m) because git reset only accepts one file.
g-unstage() {
git reset HEAD $(git diff --name-only --cached | fzf --height 50% --reverse --preview-window down:60 --bind "ctrl-n:preview-page-down,ctrl-p:preview-page-up,q:abort"\
--preview="echo {}| cut -d ' ' -f3 | xargs -I % sh -c 'git diff --staged --color % | diff-so-fancy'")
}
prs() {
hub pr list -f "%sC%>(8)%I%Creset %t% l%n" | fzf --height 40% --reverse | awk '{print $1}'
}
g-fixup() {
oldcommit=$(git --no-pager log --pretty=format:'%h %<(20)%an %<(15)%cr %s' |\
fzf --height 90% --reverse\
--bind "ctrl-n:preview-page-down,ctrl-p:preview-page-up,q:abort"\
--header 'Select which commit to add changes to. ctrl-n, ctrl-p to scroll diff. ' \
--expect=enter \
--preview-window down:25 --preview="git diff --color --staged | diff-so-fancy" |\
awk '{print $1}') && [ ! -z "$oldcommit" ] && git commit --fixup=$oldcommit && git rebase --interactive --autosquash $oldcommit~
}
#add ** autocomplete to g-start
_fzf_complete_g-start() {
ARGS="$@"
local branches
jiras=$(jiras)
if [[ $ARGS == 'g-start'* ]]; then
_fzf_complete "--reverse --multi" "$@" < <(
echo $jiras
)
else
eval "zle ${fzf_default_completion:-expand-or-complete}"
fi
}
g-start() {
# git fetch && git checkout master && git rebase --autostash && git checkout -b "itai/$1:u/$2" master && git branch --set-upstream-to "origin/master";
SOURCE_BRANCH="develop"
# workaround because main branch in meetings is develop
REMOTE_URL=$(git config --get remote.origin.url)
if [ "$REMOTE_URL" = "https://git.autodesk.com/BIM360/meetings-ui-web.git" ]; then
SOURCE_BRANCH="develop"
fi
git fetch && git checkout $SOURCE_BRANCH && git rebase --autostash && git checkout -b "itai/SCPJM-$1" $SOURCE_BRANCH && git branch --set-upstream-to origin/$SOURCE_BRANCH && git push;
}
g-finish() {
BRANCH=$(git branch | sed -n '/\* /s///p' )
JIRA=$(echo $BRANCH | grep -oiE 'SCPJM-[0-9]{5}');
PR_MSG=$(echo ${JIRA} ${BRANCH:16} | tr "-" " " | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}' ) # removes dash and then capitlize first letter
REMOTE_URL=$(git config --get remote.origin.url)
# workaround because main branch in meetings is develop
# # update 2021 - no longer needed
# if [ "$REMOTE_URL" = "https://git.autodesk.com/BIM360/meetings-ui-web.git" ]; then
# UPSTREAM_BRANCH="origin/develop" # sometime previous pr msg is left, no need to use them..
# rm -f ~/dev/meetings-ui-web/.git/PULLREQ_EDITMSG
# else
# UPSTREAM_BRANCH="origin/master"
# rm -f ~/dev/acs-meetings/.git/PULLREQ_EDITMSG
# fi
# jira transition --noedit 'Start Progress' $JIRA || true;
# jira transition --noedit 'Ready for review' $JIRA || true;
UPSTREAM_BRANCH="origin/develop"
DIFF_LOG=$(git log --pretty=format:%s%n%n%b ${UPSTREAM_BRANCH}..);
echo "${PR_MSG}\n\nresolves: ${JIRA}" |cat - ~/pr-template.md > /tmp/out && mv /tmp/out ~/pr-template-with-changes.md;
git push && hub pull-request --push --browse -F - --edit < ~/pr-template-with-changes.md && git branch --set-upstream-to ${UPSTREAM_BRANCH}
}
. "$HOME/.cargo/env"
# to resolve error "Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory"
export NODE_OPTIONS="--max-old-space-size=4096"