-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbw_bash_personal
283 lines (232 loc) · 7.26 KB
/
bw_bash_personal
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# Shared history between terms
# http://unix.stackexchange.com/questions/18212/bash-history-ignoredups-and-erasedups-setting-conflict-with-common-history
#HISTCONTROL=ignoredups:erasedups
#shopt -s histappend
#PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
# For Beeswax ./setup.sh
export BIO_ROOT=~/src/beeswaxio
export BUZZ_ROOT="${BIO_ROOT}"/beeswax/buzz_api
export BUZZ_UI_ROOT=~/src/buzz-ui
# For Beeswax Hive deployment tool, add to path
export PATH=$PATH:$BIO_ROOT/bazel-bin/beeswax/prod/hive:$BIO_ROOT/bazel-bin/beeswax/buzz
# for GO
export PATH="$PATH":/usr/local/go/bin
export GOPATH=~/go/
# adding `go` packages to PATH
export PATH="${PATH}:${GOPATH}bin"
# For Hive autocomplete
eval "$(register-python-argcomplete hive)"
# For Bazel autocomplete
source /usr/local/lib/bazel/bin/bazel-complete.bash
# For Honeypot release to work correctly, depends on PYTHONPATH
export PYTHONPATH="$PYTHONPATH:$BIO_ROOT/google/protobuf/python:$BIO_ROOT/bazel-genfiles:$BIO_ROOT"
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
# managing this file
alias bp="vim ~/.bash_personal"
alias cp_bp="cp ~/.bash_personal ~/src/beeswaxio/beeswax/people/sean/bash_personal" # copy this file to beeswax for safe keeping
alias v="vim"
alias sss="source ~/.bashrc"
# moving around directories and simple stuff
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias c="clear"
alias l="ls -F"
alias ll="ls -l -a -F"
alias ks="ls"
alias synctime="sudo ntpdate -s time.nist.gov"
# git stuff
alias dif="git diff HEAD"
alias master="git checkout master; git pull"
alias gg="git grep"
alias rmg="rm /home/sean/src/beeswaxio/.git/index.lock"
function naw {
git reset HEAD $1
git checkout -- $1
}
# git stash stuff
function push {
git add .
git stash save $1
}
function list {
git stash list
}
function show {
git stash show -p stash@{$1}
}
function pop {
git stash apply stash@{$1}
}
alias jj="push 'temp'"
alias kk="pop 0"
# mark directorys and sym-link for quick jumping
export MARKPATH=$HOME/.marks
function j {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
}
function unmark {
rm -i "$MARKPATH/$1"
}
function marks {
ls -l "$MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\-/g' && echo
}
# beeswax specific helpers
function slacknotif {
bazel run //beeswax/base:slack_cli -- --channel @sean --message $1
}
function finish {
slacknotif ":heavy_check_mark:"
}
function markbot {
bazel run //beeswax/base:slack_cli -- --channel random --author MARKBOT --message "$1"
}
function monobuzz {
bazel run //beeswax/base:slack_cli -- --channel buzz-development --author MONOBUZZ --message "SOON"
}
function travisbot {
bazel run //beeswax/base:slack_cli -- --channel random --author TRAVISBOT --message "$1"
}
function ronbot {
bazel run //beeswax/base:slack_cli -- --channel random --author RONBOT --message "$1"
}
function seanbot {
bazel run //beeswax/base:slack_cli -- --channel random --author SEANBOT --message "$1"
}
function gateway {
# jump to the gateway
ssh-add ~/.aws/bee-prod-ssh-key-pair.pem
}
function copy {
# Send a given file to gateway under the "sean" user in directory "~/sean"
./beeswax/people/sean/scp_to_gateway.sh "$1"
}
function find_upload {
# for finding segment uploads
python ~/src/beeswaxio/beeswax/people/sean/find_segment_upload.py "$1" "$2"
}
function deploy_ticks {
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_ticks.sh "${1}"
}
function deploy_pollinator {
# $1 is a message for hive deploy
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_pollinator.sh "$1"
}
function deploy_pollen_count {
# $1 is a message for hive deploy
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_pollen_count.sh "$1"
}
function deploy_migrate_canary {
# $1 is the message
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_migrate_canary.sh "$1"
}
function deploy_migrate_devsean {
# $1 is the message
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_migrate_devsean.sh "$1"
}
function deploy_buzz_qa {
# $1 is the branch to deploy
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_buzz_qa.sh
}
function deploy_buzz_devsean {
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_buzz_devsean.sh
}
function deploy_buzz_canary {
# $1 is the tag to deploy
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_buzz_canary.sh
}
function deploy_buzz_fes_qa {
# $1 is the branch to deploy
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_buzz_fes_qa.sh
}
function deploy_buzz_fes {
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_buzz_fes.sh "$1"
}
function deploy_buzz {
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_buzz.sh "$1"
}
function deploy_buzz_ui {
cd ~/src/beeswaxio
git status
./beeswax/people/sean/deploy_buzz_ui.sh "$1"
}
function delete_branches {
git checkout master
git fetch -p
git branch -r | awk '{print $1}' | cut -c 8- | egrep -v -f /dev/fd/0 <(git branch | awk '{print $1}' | grep -v '\*') | xargs git branch -D
}
function copy_tools_locally {
cd ~/src/beeswaxio
bazel build //beeswax/tools/...
# segment counts tool
sudo cp bazel-bin/beeswax/tools/segment_counts /usr/local/bin/
sudo cp -r bazel-bin/beeswax/tools/segment_counts.runfiles /usr/local/bin/
sudo cp bazel-bin/beeswax/tools/budget_tool /usr/local/bin/
sudo cp -r bazel-bin/beeswax/tools/budget_tool.runfiles /usr/local/bin/
}
function ts {
./beeswax/people/sean/unix_time_converter.py "$1"
}
function tm {
tmux attach -t 0
}
function upgrade_pkgs {
sudo pip install -U -r $BIO_ROOT/beeswax/setup/python/requirements-prod.txt
sudo pip install -U -r $BIO_ROOT/beeswax/setup/python/requirements-dev.txt
}
function ticks {
bazel run //beeswax/monitoring/kapacitor/alerts/tick_builder:tick_builder
}
function cbf {
$BUZZ_ROOT/buzz/vendor/bin/phpcbf --standard=$BIO_ROOT/phpcs.xml $1
}
function use_app {
bazel run //beeswax/buzz_api/dev:use_app -- $1
}
function run_tests {
bazel run //beeswax/buzz_api/test:run_tests -- $1
}
function dump_schema {
bazel run //beeswax/buzz_api/migrate:dev_migrate -- --app buzz --database buzz_schema_db --drop-database --use-default-datetime
bazel run //beeswax/buzz_api/migrate:mysqldump -- --database buzz_schema_db --app buzz
}
function dump_schema_fes {
bazel run //beeswax/buzz_api/migrate:dev_migrate -- --app fes --database fes_schema_db --drop-database --use-default-datetime
bazel run //beeswax/buzz_api/migrate:mysqldump -- --database fes_schema_db --app fes
}
function docker-clean {
sudo docker rm -vf $(docker ps -aq)
sudo docker rmi -f $(docker images -aq)
sudo docker volume prune -f
}
alias bee-ssh-add='eval `ssh-agent -s` && ssh-add ~/.aws/bee-prod-ssh-key-pair.pem'
# use keychain to manage ssh-agent and ssh-add, to avoid typing passwords
# http://unix.stackexchange.com/questions/90853/how-can-i-run-ssh-add-automatically-without-password-prompt
eval `keychain --eval id_rsa`
bee-ssh-add