-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.jayrc
273 lines (225 loc) · 9.74 KB
/
.jayrc
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
#---------------------------------------------------------------
# >>> .jayrc <<<
#---------------------------------------------------------------
# shell config
#===============================================================
### >>> GLOBALS <<<
#===============================================================
export JAY_SPACE=${HOME}/jaycody # my github root
export JAY_USER=${USER} # me
export JAY_HOME=${HOME} # ~
export JAMYRIS=${HOME}/repo # my amyris proj
#===============================================================
### >>> SET PATH <<<
#===============================================================
# Coming from BASH but using oh-my-zsh
PATH="$HOME/bin:/usr/local/bin:$PATH"
# Set PYTHON path
PATH="/Users/jstephens/Library/Python/3.9/bin:$PATH"
export PATH
#===============================================================
### >>> TOOLS <<<
#===============================================================
# network tools
alias mtr=/usr/local/sbin/mtr
alias starwars="nc towel.blinkenlights.nl 23"
alias niko="echo 'nom nom nom'"
alias niki="for n in {1..5000}; do niko ${n}; done"
#---------------------------------------------------------------
# >>> Refresh me RESH <<<
#---------------------------------------------------------------
# Set resh for either .bashrc or .zshrc
if [ -f $HOME/.bashrc ]; then
alias resh='source ~/.bashrc'
else
alias resh='source ~/.zshrc'
fi
#---------------------------------------------------------------
# >>> Take me to.... <<<
#---------------------------------------------------------------
# My repos
alias org='cd ${JAY_HOME}/Dropbox/_APPS/orgmode; lr'
alias jaycody='cd ${JAY_SPACE}; tree --dirsfirst -a -L 2 -I .get; l'
alias jayci='cd ${JAY_SPACE}/jayci; l; tree --dirsfirst -a -I .git'
alias snapcap='cd ${JAY_SPACE}/snapcap; l; tree --dirsfirst -a -I .git; . ./snapcap.cfg'
alias jayutil='cd ${JAY_SPACE}/jayutil; lsd'
alias pshape='cd ${JAY_SPACE}/pshape-studio; l; tree --dirsfirst -a -L 2 -I .git;'
alias ..='cd ..'
# Take me to Amyris Repo
alias repo='cd ${JAMYRIS}; l; tree --dirsfirst -a -L 2'
alias repocm='cd ${JAMYRIS}/configuration-management; l; tree --dirsfirst -a -I .git -L 2'
alias handbook='cd ${JAMYRIS}/devops-handbook; l; tree --dirsfirst -a -I .git'
alias datadog='cd ${JAMYRIS}/datadog; l; tree --dirsfirst -a -L 2'
#---------------------------------------------------------------
# >>> Edit configs <<<
#---------------------------------------------------------------
alias vimjrc='vim ${JAY_SPACE}/jayci/.jayrc'
alias vimconfig='vim ${JAY_SPACE}/jayci/jayci.cfg'
alias vimutil='vim ${JAY_SPACE}/jayci/scripts/jayci_utilities.sh'
alias vimvimrc='vim ${JAY_SPACE}/jayci/.vimrc'
alias vimzrc='vim ${HOME}/.zshrc'
alias vimorg='vim ${HOME}/.emacs.d/init.el'
#---------------------------------------------------------------
# >>> depracated configs #nostaliga
#---------------------------------------------------------------
# alias vimsh='vim ${HOME}/.bash_profile' # from Owen's bbsh 20130403
# alias vimarc='vim ${HOME}/.amyrisrc' # from Rob MacGowan
### turn this off to experiment with whether ANSIBLE can access hosts
## alias ssh="ssh -A" # Forward the authentication agent (from Brian at Pado)
#---------------------------------------------------------------
# >>> Safety and Convenience <<<
#---------------------------------------------------------------
# Confirm first
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Show usage as human-readable, include total
alias du='du -ch' # disk used plus total
alias df='df -h' # disk free
alias dirsize="pwd; du -ch | grep total"
# Make directories along path when none exist
alias mkdir='mkdir -p'
# List directories in the stack, but always use their index numbers
alias dirs="dirs -v"
# Show me, paint the fence
alias h='history' # shell history
alias path='echo -e ${PATH//:/\\n}' # path as single col
alias gitlog='git log --oneline --graph' # gits by single line
# Please....
alias restart='sudo shutdown -r now'
alias sleep='sudo shutdown -s now'
# Update packages
alias update="brew update; brew upgrade; brew cleanup;
pip install --upgrade `pip list --outdated | awk 'NR>2 {print $1}'`"
### fetch newest brew; upgrade outdated packages; upgrade all casks; clean up outdated dowloads of previous package versions;
### output installed pip packages currently outdated and upgrade them
# Path to pip, pip2, and pip2.7
alias pip="pip3"
#---------------------------------------------------------------
# >>> the 'ls' family <<<
#---------------------------------------------------------------
# List sizes as human-readable
alias ls='ls -hF'
# Sort lists by...(show hidden, long format, exclude groups)
alias lk='ls -AlSro' # Size, biggest last.
alias lt='ls -Altro' # Date, most recent last.
alias lc='ls -Altcro' # Change, most recent last.
# Show more, sort alphanumerically
alias l='ls -A1' # Single col, show .dot files, show '/', '*'
alias la='ls -A' # Show .dot files, '/' dirs
alias ll='ls -Alo' # Show hidden, long format, '/' dirs, no group,
alias lal='ls -al' # Show hidden and long
alias lsd='\ls -A1 -d */' # Directories only
# List recursively
alias lr='ls -R' # Recursively
alias tree='tree -Csh' # Recursively as tree
alias treela='tree -Csha' # As tree, include hidden
#---------------------------------------------------------------
# >>> Show Aliases and Common Usage <<<
#---------------------------------------------------------------
# List all aliases
alias lalias='grep alias ${JAY_HOME}/.jayrc'
# List the 'ls' family
alias lsls="grep 'alias l' ${JAY_HOME}/.jayrc"
# 'jay' to list common usage
alias jay='echo ;
echo ;
echo lalias: \\t list aliases;
echo lsls: \\t\\t list the 'ls' family;
echo ;
echo -----------TAKE ME TO....-------------;
echo jaycody jayci repo repocm;
echo code foo: open foo in VSCode;
echo ;
echo -----------VIM-------------;
echo vimjrc, vimjconfig, vimjutil, vimvimrc, vimzrc;
echo :StripWhitespace in vim;
echo ;
echo -----------INFO-------------;
echo h=history, path, gitlog;
echo du, df, dirsize -- disk used, disk free, dirsize;
echo env -- show environment variables
echo ;
echo -----------LIST-------------;
echo lk, lt, lc: size, date, change date, big and new last;
echo l, la, ll, lal;
echo lsd: dir only;
echo lr: recursively;
echo ;
echo -----------FREQUENT COMMANDS-------------;
echo grep: \\t search inside a file;
echo find: \\t search FOR a file;
echo whereis: ex. whereis python = ;
echo rm -rf: remove directory and all files therein, without asking permission;
echo cp -r: \\t copy directory and all files therein;
echo mkdir -p: make mutliptle directories along the path as needed;
echo ">" : \\t takes output of command at left and WRITES it to file on right;
echo \\t -----ex cat my.txt ">" your.txt;
echo \\t ----- OR write directly to a file: cat ">" foo.txt;
echo ;
echo ----------------NETWORK----------------------;
echo ping, ifconfig, ip addr, ip rout, dig;
echo nmap, nikto, dnsmap;
echo ;
echo ----------------FILESYSTEM----------------------;
echo cat: /etc/lsb-release -- distribution;
echo cat: /proc/cpuinfo -- how many cpus;
echo free: -- tell me about your RAM;
echo pushd: \\t W/o argument will switch the top two dirs in the stack;
echo pushd: dir \\t Like 'cd' but also adds to directory stack;
echo pushd: -N \\t where 'N' is the index provided by dirs;
echo popd: \\t removes dirs from the directory stack;
echo dirs: -v \\t view pushd dir stack AND list their index. Index 0 = current location;
echo src: \\t Takes me directly to JAY_SPACE (source code);
echo unsrc: \\t Takes me right back to where I was when I sourced;
echo ;'
#---------------------------------------------------------------
#---------------------------------------------------------------
# >>> FUNCTIONS <<<
#---------------------------------------------------------------
#------------Jump to workspace, then jump back------------------
# Remember where you came from, then jump to workspace
function src () {
pushd . $@ > /dev/null
cd ${JAY_SPACE}
}
# Come right back
function unsrc () {
cd ~1
}
#---------------------------------------------------------------
echo ""
echo ""
echo "================================================================="
echo "SHELL CONFIG STEPS"
echo "================================================================="
if [ -f $HOME/.bashrc ]; then
echo '\t IN ~/.bashrc --> $ source ~/.jayrc'
else
echo "[1] .zshrc ---> do:"
echo '\t $ source ~/.oh-my-zsh'
echo '\t $ source ~/.jayrc@ -> JAY_SPACE/jayci/.jayrc'
fi
echo ""
echo '[2] .jayrc ---> do:'
echo '\tPATH & GLOBALS\n\taliases'
echo '\tsource proj .cfg'
echo '-----------------------------------------------------------------'
#---------------------------------------------------------------
# >>> SOURCE all <project>.cfg <<<
#---------------------------------------------------------------
if [ -d ${JAY_SPACE:?} ] && [ "$(ls -A ${JAY_SPACE})" ] ; then
for i in $( ls -1 ${JAY_SPACE}/*/*.cfg|egrep -v "nose|setup" ); do # printf "===> %-30s .jayrc ---sources---> $i \n";#
# Walk jaycody/ ; source each <project>/*.cfg ; let each .cfg list files they source.
echo ""
echo ""
#echo "-----------------------------------------------------------------"
echo "================================================================="
echo ".jayrc --> $ source $i"
echo "================================================================="
source $i;
done
else
echo "There are no .cfg files in your JAY_SPACE repos."
fi
#===============================================================