-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_profile
186 lines (158 loc) · 4.43 KB
/
.bash_profile
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
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
stty -ixon
vault2 () {
VAULT_ADDR=http://127.0.0.1:8202 vault $@
}
vault3 () {
VAULT_ADDR=http://127.0.0.1:8204 vault $@
}
checkout-pr () {
git fetch origin pull/$1/head:pr-$1 && git checkout pr-$1;
}
cl () {
git add CHANGELOG.md;
git commit -m "changelog++";
}
giv () {
pushd -n $(pwd);
gov;
time make dev;
popd;
}
gev () {
pushd -n $(pwd);
gov;
time make entdev;
popd;
}
qq() {
clear
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ ! -f "$logpath" ]]; then
echo 'Q LOG' > "$logpath"
fi
tail -100f -- "$logpath"
}
rmqq() {
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ -f "$logpath" ]]; then
rm "$logpath"
fi
qq
}
bdauth() {
COMMAND="boundary authenticate password -login-name admin -auth-method-id ampw_1234567890 -password password"
echo -n $COMMAND
read -n 1
eval "${COMMAND}"
}
bd_create_hc() {
COMMAND="boundary host-catalogs create plugin -scope-id p_1234567890 -plugin-name azure -attr disable_credential_rotation=true -attr tenant_id=env://ARM_TENANT_ID -attr subscription_id=env://ARM_SUBSCRIPTION_ID -attr client_id=env://ARM_CLIENT_ID -secret secret_value=env://ARM_CLIENT_SECRET"
echo -n $COMMAND
read -n 1
eval "${COMMAND}" | tee /tmp/hc
}
bd_create_hs_all() {
HOST_CATALOG_ID=$(cat /tmp/hc | grep hc_ | awk '{print $2}')
COMMAND="boundary host-sets create plugin -host-catalog-id ${HOST_CATALOG_ID} -attr filter=\"tagName eq 'service-type' and tagValue eq 'database'\""
echo -n $COMMAND
read -n 1
eval "${COMMAND}" | tee /tmp/hs
}
bd_create_hs_nw() {
HOST_CATALOG_ID=$(cat /tmp/hc | grep hc_ | awk '{print $2}')
COMMAND="boundary host-sets create plugin -host-catalog-id ${HOST_CATALOG_ID} -attr filter=\"tagName eq 'application' and tagValue eq 'north-wind'\""
echo -n $COMMAND
read -n 1
eval "${COMMAND}" | tee /tmp/nw
}
bd_create_hs_ss() {
HOST_CATALOG_ID=$(cat /tmp/hc | grep hc_ | awk '{print $2}')
COMMAND="boundary host-sets create plugin -host-catalog-id ${HOST_CATALOG_ID} -attr filter=\"tagName eq 'application' and tagValue eq 'south-seas'\""
echo -n $COMMAND
read -n 1
eval "${COMMAND}" | tee /tmp/ss
}
bd_read_hs_all() {
HOST_SET_ALL_ID=$(cat /tmp/hs | grep hs_ | awk '{print $2}')
COMMAND="boundary host-sets read -id ${HOST_SET_ALL_ID}"
echo -n $COMMAND
read -n 1
eval "${COMMAND}"
}
bd_read_hs_nw() {
HOST_SET_NW_ID=$(cat /tmp/nw | grep hs_ | awk '{print $2}')
COMMAND="boundary host-sets read -id ${HOST_SET_NW_ID}"
echo -n $COMMAND
read -n 1
eval "${COMMAND}"
}
bd_read_hs_ss() {
HOST_SET_SS_ID=$(cat /tmp/ss | grep hs_ | awk '{print $2}')
COMMAND="boundary host-sets read -id ${HOST_SET_SS_ID}"
echo -n $COMMAND
read -n 1
eval "${COMMAND}"
}
run_bd_side_1() {
bdauth
read -n 1
echo "==========================="
bd_create_hc
read -n 1
echo "==========================="
bd_create_hs_all
read -n 1
echo "==========================="
bd_read_hs_all
read -n 1
echo "==========================="
bd_read_hs_all
read -n 1
echo "==========================="
bd_read_hs_all
}
run_bd_side_2() {
bd_create_hs_nw
read -n 1
echo "==========================="
bd_create_hs_ss
read -n 1
echo "==========================="
bd_read_hs_nw
read -n 1
echo "==========================="
bd_read_hs_ss
read -n 1
echo "==========================="
bd_read_hs_ss
read -n 1
echo "==========================="
bd_read_hs_ss
}
install_dotfiles () {
cd ~
# Install some common stuff
sudo apt-get install vim jq bash-completion tmux zip unzip
# Install bash-git-prompt
git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt --depth=1
# Install vim-plug and plugins
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vi -c ':PlugUpdate'
# Install tmux plugin manager
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Map neovim config
ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim
}
#test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
source <(kubectl completion bash)
complete -C /home/jeff/go/bin/vault vault
complete -C aws_completer aws
if [ -e /home/jeff/.nix-profile/etc/profile.d/nix.sh ]; then . /home/jeff/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer