@sebastienrousseau/dotfiles 0.2.440 → 0.2.452
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYRIGHT +5 -0
- package/LICENSE +1260 -2
- package/Makefile +79 -0
- package/README.md +328 -71
- package/bin/dotfiles.sh +150 -0
- package/index.js +24 -0
- package/package.json +99 -25
- package/pnpm-lock.yaml +178 -0
- package/pnpm-workspace.yaml +2 -0
- package/shell/README.md +3 -0
- package/shell/aliases/README.md +327 -0
- package/{Icon/r → shell/aliases/default/README.md} +0 -0
- package/shell/aliases/default/default.aliases.sh +199 -0
- package/shell/aliases/gcloud/README.md +117 -0
- package/shell/aliases/gcloud/gcloud.aliases.sh +121 -0
- package/shell/aliases/git/README.md +279 -0
- package/shell/aliases/git/git.aliases.wip +586 -0
- package/shell/aliases/heroku/README.md +457 -0
- package/shell/aliases/heroku/heroku.aliases.sh +1031 -0
- package/shell/aliases/jekyll/README.md +32 -0
- package/shell/aliases/jekyll/jekyll.aliases.sh +50 -0
- package/shell/aliases/pnpm/README.md +3 -0
- package/shell/aliases/pnpm/pnpm.aliases.sh +42 -0
- package/shell/aliases/subversion/README.md +54 -0
- package/shell/aliases/subversion/subversion.aliases.sh +123 -0
- package/shell/aliases/tmux/README.md +0 -0
- package/shell/aliases/tmux/tmux.aliases.sh +14 -0
- package/shell/aliases.sh +12 -0
- package/shell/configurations/README.md +3 -0
- package/shell/configurations/bash/bashrc +36 -0
- package/shell/configurations/curl/cacert.pem +3460 -0
- package/shell/configurations/curl/curlrc +55 -0
- package/shell/configurations/default/color.sh +17 -0
- package/shell/configurations/default/editor.sh +16 -0
- package/shell/configurations/default/prompt.sh +37 -0
- package/shell/configurations/inputrc/inputrc +22 -0
- package/shell/configurations/jshint/jshintrc +37 -0
- package/shell/configurations/profile/profile +36 -0
- package/shell/configurations/tmux/tmux +95 -0
- package/shell/configurations/vim/vimrc +73 -0
- package/{.wgetrc → shell/configurations/wget/wgetrc} +4 -0
- package/shell/configurations/zsh/zshrc +40 -0
- package/shell/configurations.sh +10 -0
- package/shell/exit.sh +9 -0
- package/shell/functions/README.md +3 -0
- package/shell/functions/cdls.sh +19 -0
- package/shell/functions/changediskpwd.sh +19 -0
- package/shell/functions/code.sh +18 -0
- package/shell/functions/countdown.sh +33 -0
- package/shell/functions/curlheader.sh +20 -0
- package/shell/functions/curltime.sh +31 -0
- package/shell/functions/encode64.sh +25 -0
- package/shell/functions/environment.sh +37 -0
- package/shell/functions/extract.sh +32 -0
- package/shell/functions/filehead.sh +4 -0
- package/{zsh/zsh/functions/genpwd.zsh → shell/functions/genpwd.sh} +8 -3
- package/shell/functions/goto.sh +14 -0
- package/shell/functions/headers.sh +4 -0
- package/{zsh/zsh/functions/hidehiddenfiles.zsh → shell/functions/hidehiddenfiles.sh} +7 -2
- package/shell/functions/history-all.sh +7 -0
- package/shell/functions/hostinfo.sh +25 -0
- package/{zsh/zsh/functions/hstats.zsh → shell/functions/hstats.sh} +6 -1
- package/shell/functions/httpdebug.sh +7 -0
- package/shell/functions/keygen.sh +23 -0
- package/shell/functions/last.sh +9 -0
- package/shell/functions/logout.sh +10 -0
- package/shell/functions/lowercase.sh +28 -0
- package/shell/functions/macos.sh +47 -0
- package/shell/functions/matrix.sh +9 -0
- package/shell/functions/mcd.sh +18 -0
- package/shell/functions/mount_read_only.sh +9 -0
- package/shell/functions/myproc.sh +7 -0
- package/shell/functions/prependpath.sh +19 -0
- package/shell/functions/print.sh +13 -0
- package/shell/functions/ql.sh +7 -0
- package/shell/functions/rd.sh +15 -0
- package/shell/functions/remove_disk.sh +9 -0
- package/shell/functions/ren.sh +11 -0
- package/shell/functions/rm.sh +13 -0
- package/shell/functions/rps.sh +103 -0
- package/{zsh/zsh/functions/showhiddenfiles.zsh → shell/functions/showhiddenfiles.sh} +7 -2
- package/{zsh/zsh/functions/size.zsh → shell/functions/size.sh} +6 -1
- package/shell/functions/stopwatch.sh +13 -0
- package/shell/functions/trash.sh +13 -0
- package/shell/functions/tree.sh +13 -0
- package/shell/functions/uppercase.sh +28 -0
- package/shell/functions/uuidgen.sh +27 -0
- package/shell/functions/view-source.sh +8 -0
- package/shell/functions/vscode.sh +31 -0
- package/shell/functions/whoisport.sh +12 -0
- package/shell/functions/zipf.sh +14 -0
- package/shell/functions.sh +10 -0
- package/shell/history.sh +110 -0
- package/shell/paths/ant/ant.paths.sh +15 -0
- package/shell/paths/default/default.paths.sh +17 -0
- package/shell/paths/homebrew/homebrew.paths.sh +22 -0
- package/shell/paths/java/java.paths.sh +16 -0
- package/shell/paths/maven/maven.paths.sh +16 -0
- package/shell/paths/node/node.paths.sh +13 -0
- package/shell/paths/nvm/nvm.paths.sh +21 -0
- package/shell/paths/pnpm/pnpm.paths.sh +13 -0
- package/shell/paths/ruby/ruby.paths.sh +23 -0
- package/shell/paths/tmux/tmux.paths.sh +15 -0
- package/shell/paths.sh +12 -0
- package/.curlrc +0 -17
- package/.eslintrc +0 -44
- package/.jshintrc +0 -22
- package/.travis.yml +0 -21
- package/CODE_OF_CONDUCT.md +0 -46
- package/CONTRIBUTING.md +0 -60
- package/Dotfiles.png +0 -0
- package/ISSUE_TEMPLATE.md +0 -43
- package/bash/.bash_aliases +0 -409
- package/bash/.bash_exit +0 -25
- package/bash/.bash_functions +0 -312
- package/bash/.bash_load_completion +0 -62
- package/bash/.bash_profile +0 -295
- package/bash/.bashrc +0 -47
- package/homebrew/brew-cask.sh +0 -165
- package/homebrew/brew-package.sh +0 -256
- package/homebrew/brew-tap.sh +0 -35
- package/homebrew/install.sh +0 -29
- package/zsh/.zshrc +0 -64
- package/zsh/aliases.zsh +0 -427
- package/zsh/configurations.zsh +0 -19
- package/zsh/exit.zsh +0 -21
- package/zsh/functions.zsh +0 -42
- package/zsh/history.zsh +0 -53
- package/zsh/profile.zsh +0 -17
- package/zsh/zsh/configurations/color.zsh +0 -21
- package/zsh/zsh/configurations/editor.zsh +0 -21
- package/zsh/zsh/configurations/history.zsh +0 -53
- package/zsh/zsh/configurations/path.zsh +0 -123
- package/zsh/zsh/configurations/prompt.zsh +0 -24
- package/zsh/zsh/functions/cd.zsh +0 -51
- package/zsh/zsh/functions/cdls.zsh +0 -11
- package/zsh/zsh/functions/changediskpwd.zsh +0 -4
- package/zsh/zsh/functions/code.zsh +0 -2
- package/zsh/zsh/functions/countdown.zsh +0 -33
- package/zsh/zsh/functions/curlheader.zsh +0 -12
- package/zsh/zsh/functions/curltime.zsh +0 -12
- package/zsh/zsh/functions/extract.zsh +0 -27
- package/zsh/zsh/functions/goto.zsh +0 -8
- package/zsh/zsh/functions/history-all.zsh +0 -2
- package/zsh/zsh/functions/hostinfo.zsh +0 -19
- package/zsh/zsh/functions/httpdebug.zsh +0 -2
- package/zsh/zsh/functions/keygen.zsh +0 -18
- package/zsh/zsh/functions/logout.zsh +0 -5
- package/zsh/zsh/functions/lowercase.zsh +0 -23
- package/zsh/zsh/functions/matrix.zsh +0 -4
- package/zsh/zsh/functions/mcd.zsh +0 -11
- package/zsh/zsh/functions/mount_read_only.zsh +0 -4
- package/zsh/zsh/functions/myproc.zsh +0 -2
- package/zsh/zsh/functions/print.zsh +0 -8
- package/zsh/zsh/functions/ql.zsh +0 -2
- package/zsh/zsh/functions/rd.zsh +0 -8
- package/zsh/zsh/functions/remove_disk.zsh +0 -4
- package/zsh/zsh/functions/rm.zsh +0 -10
- package/zsh/zsh/functions/stopwatch.zsh +0 -8
- package/zsh/zsh/functions/trash.zsh +0 -8
- package/zsh/zsh/functions/tree.zsh +0 -8
- package/zsh/zsh/functions/uppercase.zsh +0 -23
- package/zsh/zsh/functions/zipf.zsh +0 -9
package/bash/.bash_functions
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
#!/bin/bash -l
|
|
2
|
-
|
|
3
|
-
# ---------------------------------------------------------------------------
|
|
4
|
-
#
|
|
5
|
-
# ______ _ ______ _ _
|
|
6
|
-
# | _ \ | | | ___(_) |
|
|
7
|
-
# | | | |___ | |_| |_ _| | ___ ___
|
|
8
|
-
# | | | / _ \| __| _| | | |/ _ \/ __|
|
|
9
|
-
# | |/ / (_) | |_| | | | | __/\__ \
|
|
10
|
-
# |___/ \___/ \__\_| |_|_|\___||___/
|
|
11
|
-
#
|
|
12
|
-
# Description: Mac OS X Dotfiles - Simply designed to fit your shell life.
|
|
13
|
-
#
|
|
14
|
-
# Sections:
|
|
15
|
-
#
|
|
16
|
-
# 1. Addding and Removing Files and Folders
|
|
17
|
-
# 2. Compression, Decompress and Archive Functions
|
|
18
|
-
# 3. General Function (could be better sorted)
|
|
19
|
-
# 4. Network and Debugging Function
|
|
20
|
-
# 5. Fun Functions
|
|
21
|
-
#
|
|
22
|
-
# ---------------------------------------------------------------------------
|
|
23
|
-
|
|
24
|
-
# ---------------------------------------------------------------------------
|
|
25
|
-
# 1. Addding and Removing Files and Folders
|
|
26
|
-
# ---------------------------------------------------------------------------
|
|
27
|
-
|
|
28
|
-
# rm: Function to make 'rm' move files to the trash
|
|
29
|
-
rm() {
|
|
30
|
-
local path
|
|
31
|
-
for path in "$@"; do
|
|
32
|
-
# ignore any arguments
|
|
33
|
-
if [[ "$path" == -* ]]; then :
|
|
34
|
-
else
|
|
35
|
-
local dst=${path##*/}
|
|
36
|
-
# append the time if necessary
|
|
37
|
-
while [ -e ~/.Trash/"$dst" ]; do
|
|
38
|
-
dst="$dst "$(date +%H-%M-%S)
|
|
39
|
-
done
|
|
40
|
-
mv "$path" ~/.Trash/"$dst"
|
|
41
|
-
fi
|
|
42
|
-
done
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
# cd: Function to Enable 'cd' into directory aliases
|
|
46
|
-
cd() {
|
|
47
|
-
if [ ${#1} == 0 ]; then
|
|
48
|
-
builtin cd
|
|
49
|
-
elif [ -d "${1}" ]; then
|
|
50
|
-
builtin cd "${1}"
|
|
51
|
-
elif [[ -f "${1}" || -L "${1}" ]]; then
|
|
52
|
-
path=$(getTrueName "$1")
|
|
53
|
-
builtin cd "$path"
|
|
54
|
-
else
|
|
55
|
-
builtin cd "${1}"
|
|
56
|
-
fi
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
# mkcd: Function to combine mkdir and cd
|
|
60
|
-
mkcd() {
|
|
61
|
-
mkdir "$1"
|
|
62
|
-
cd "$1" || exit
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
# md: Function to create a new directory and enter it
|
|
66
|
-
md() {
|
|
67
|
-
mkdir -p "$@" && cd "$@" || exit
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
# mcd: Function to makes new Dir and jumps inside
|
|
71
|
-
mcd() {
|
|
72
|
-
mkdir -p "$1" && cd "$1" || exit;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
# rd: Function to remove a direcory and its files
|
|
76
|
-
rd() {
|
|
77
|
-
rm -rf "$@"
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
# trash: Function to moves a file to the MacOS trash
|
|
81
|
-
trash() {
|
|
82
|
-
command mv "$@" ~/.Trash;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
# ---------------------------------------------------------------------------
|
|
86
|
-
# 2. Compression, Decompress and Archive Functions
|
|
87
|
-
# ---------------------------------------------------------------------------
|
|
88
|
-
|
|
89
|
-
# zipf: Function to create a ZIP archive of a folder
|
|
90
|
-
zipf() { zip -r "$1".zip "$1"; }
|
|
91
|
-
|
|
92
|
-
# extract: Function to extract most know archives with one command
|
|
93
|
-
extract() {
|
|
94
|
-
if [ -f $1 ]; then
|
|
95
|
-
case $1 in
|
|
96
|
-
*.tar.bz2) tar xjf $1 ;;
|
|
97
|
-
*.tar.gz) tar xzf $1 ;;
|
|
98
|
-
*.bz2) bunzip2 $1 ;;
|
|
99
|
-
*.rar) unrar e $1 ;;
|
|
100
|
-
*.gz) gunzip $1 ;;
|
|
101
|
-
*.tar) tar xf $1 ;;
|
|
102
|
-
*.tbz2) tar xjf $1 ;;
|
|
103
|
-
*.tgz) tar xzf $1 ;;
|
|
104
|
-
*.zip) unzip $1 ;;
|
|
105
|
-
*.Z) uncompress $1 ;;
|
|
106
|
-
*.7z) 7z x $1 ;;
|
|
107
|
-
*) echo "'$1' cannot be extracted via extract()" ;;
|
|
108
|
-
esac
|
|
109
|
-
else
|
|
110
|
-
echo "'$1' is not a valid file"
|
|
111
|
-
fi
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
# ---------------------------------------------------------------------------
|
|
115
|
-
# 3. General Function (could be better sorted)
|
|
116
|
-
# ---------------------------------------------------------------------------
|
|
117
|
-
|
|
118
|
-
# numFiles: Function to count of non-hidden files in current dir
|
|
119
|
-
alias numFiles='echo $(ls -1 | wc -l)'
|
|
120
|
-
|
|
121
|
-
# tree: Function to generates a tree view from the current directory
|
|
122
|
-
if [ ! -e /usr/local/bin/tree ]; then
|
|
123
|
-
tree(){
|
|
124
|
-
pwd
|
|
125
|
-
ls -R | grep ":$" | \
|
|
126
|
-
sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
|
|
127
|
-
}
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
# sshKeyGen: Function to generates SSH key
|
|
131
|
-
sshKeyGen() {
|
|
132
|
-
|
|
133
|
-
echo "What's the name of the Key (no spaced please) ? ";
|
|
134
|
-
read -r name;
|
|
135
|
-
|
|
136
|
-
echo "What's the email associated with it? ";
|
|
137
|
-
read -r email;
|
|
138
|
-
|
|
139
|
-
$(ssh-keygen -t rsa -f ~/.ssh/id_rsa_$name -C "$email");
|
|
140
|
-
|
|
141
|
-
ssh-add ~/.ssh/id_rsa_$name;
|
|
142
|
-
|
|
143
|
-
pbcopy < ~/.ssh/id_rsa_$name.pub;
|
|
144
|
-
|
|
145
|
-
echo "SSH Key copied in your clipboard";
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
# filestolower: Function to rename all the files which contain uppercase letters to lowercase in the current folder
|
|
150
|
-
filestolower(){
|
|
151
|
-
read -r -p "This will rename all the files and directories to lowercase in the current folder, continue? [y/n]: " letsdothis
|
|
152
|
-
if [ "$letsdothis" = "y" ] || [ "$letsdothis" = "Y" ]; then
|
|
153
|
-
for x in `ls`
|
|
154
|
-
do
|
|
155
|
-
skip=false
|
|
156
|
-
if [ -d "$x" ]; then
|
|
157
|
-
read -rp "'$x' is a folder, rename it? [y/n]: " renamedir
|
|
158
|
-
if [ "$renamedir" = "n" ] || [ "$renamedir" = "N" ]; then
|
|
159
|
-
skip=true
|
|
160
|
-
fi
|
|
161
|
-
fi
|
|
162
|
-
if [ "$skip" == "false" ]; then
|
|
163
|
-
lc=$(echo "$x" | tr ':A-Z:' ':a-z:')
|
|
164
|
-
if [ "$lc" != "$x" ]; then
|
|
165
|
-
echo "renaming $x -> $lc"
|
|
166
|
-
mv "$x" "$lc"
|
|
167
|
-
fi
|
|
168
|
-
fi
|
|
169
|
-
done
|
|
170
|
-
fi
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
# aliasc: Function alias
|
|
174
|
-
aliasc() {
|
|
175
|
-
alias | grep "^${1}=" | awk -F= '{ print $2 }' | sed "s/^'//" | sed "s/'$//"
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
# tosu: Function to combine touch and osu
|
|
179
|
-
tosu() {
|
|
180
|
-
touch "$1"
|
|
181
|
-
osu "$1"
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
# size: Function to check a file size
|
|
185
|
-
size() {
|
|
186
|
-
stat -f '%z' "$1"
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
# logout: Function to logout from OS X via the Terminal
|
|
190
|
-
logout() {
|
|
191
|
-
osascript -e 'tell application "System Events" to log out'
|
|
192
|
-
builtin logout
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
# countdown: Function for countdown
|
|
196
|
-
countdown(){
|
|
197
|
-
date1=$((`date +%s` + $1));
|
|
198
|
-
while [ "$date1" -ne `date +%s` ]; do
|
|
199
|
-
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r";
|
|
200
|
-
done
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
# logout: Function for a stopwatch
|
|
204
|
-
stopwatch(){
|
|
205
|
-
date1=`date +%s`;
|
|
206
|
-
while true; do
|
|
207
|
-
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r";
|
|
208
|
-
done
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
# randompwd: Function to generates a strong random password of 20 characters
|
|
212
|
-
# https://www.gnu.org/software/sed/manual/html_node/Character-Classes-and-Bracket-Expressions.html
|
|
213
|
-
randompwd() {
|
|
214
|
-
cat /dev/urandom | LC_CTYPE=C tr -dc [:alnum:],[:alpha:],[:punct:] | fold -w 256 | head -c 20 | sed -e 's/^0*//'
|
|
215
|
-
echo
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
# ql: Function to open any file in MacOS Quicklook Preview
|
|
219
|
-
ql() { qlmanage -p "$*" >&/dev/null; }
|
|
220
|
-
|
|
221
|
-
# my_ps: Function to list processes owned by an user
|
|
222
|
-
my_ps() { ps "$@" -u "$USER" -o pid,%cpu,%mem,start,time,bsdtime,command; }
|
|
223
|
-
|
|
224
|
-
# ii: Function to display useful host related informaton
|
|
225
|
-
ii() {
|
|
226
|
-
echo -e "\\nYou are logged on ${RED}$HOST"
|
|
227
|
-
echo -e "\\nAdditionnal information:$NC "
|
|
228
|
-
uname -a
|
|
229
|
-
echo -e "\\n${RED}Users logged on:$NC "
|
|
230
|
-
w -h
|
|
231
|
-
echo -e "\\n${RED}Current date :$NC "
|
|
232
|
-
date
|
|
233
|
-
echo -e "\\n${RED}Machine stats :$NC "
|
|
234
|
-
uptime
|
|
235
|
-
echo -e "\\n${RED}Current network location :$NC "
|
|
236
|
-
scselect
|
|
237
|
-
echo -e "\\n${RED}Public facing IP Address :$NC "
|
|
238
|
-
myip
|
|
239
|
-
echo -e "\\n${RED}DNS Configuration:$NC "
|
|
240
|
-
scutil --dns
|
|
241
|
-
echo
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
# Show hidden system and dotfile files
|
|
245
|
-
showhiddenfiles() {
|
|
246
|
-
defaults write com.apple.Finder AppleShowAllFiles YES
|
|
247
|
-
osascript -e 'tell application "Finder" to quit'
|
|
248
|
-
sleep 0.25
|
|
249
|
-
osascript -e 'tell application "Finder" to activate'
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
# Hide hidden system and dotfile files
|
|
253
|
-
hidehiddenfiles() {
|
|
254
|
-
defaults write com.apple.Finder AppleShowAllFiles NO
|
|
255
|
-
osascript -e 'tell application "Finder" to quit'
|
|
256
|
-
sleep 0.25
|
|
257
|
-
osascript -e 'tell application "Finder" to activate'
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
# ---------------------------------------------------------------------------
|
|
261
|
-
# 4. Network and Debugging Functions
|
|
262
|
-
# ---------------------------------------------------------------------------
|
|
263
|
-
|
|
264
|
-
## hammer a service with curl for a given number of times
|
|
265
|
-
## usage: curlhammer $url
|
|
266
|
-
curlhammer () {
|
|
267
|
-
bot "about to hammer $1 with $2 curls ⇒";
|
|
268
|
-
echo "curl -k -s -D - $1 -o /dev/null | grep 'HTTP/1.1' | sed 's/HTTP\/1.1 //'"
|
|
269
|
-
for i in {1..$2}
|
|
270
|
-
do
|
|
271
|
-
curl -k -s -D - $1 -o /dev/null | grep 'HTTP/1.1' | sed 's/HTTP\/1.1 //'
|
|
272
|
-
done
|
|
273
|
-
bot "done"
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
## curlheader will return only a specific response header or all response headers for a given URL
|
|
277
|
-
## usage: curlheader $header $url
|
|
278
|
-
## usage: curlheader $url
|
|
279
|
-
curlheader() {
|
|
280
|
-
if [[ -z "$2" ]]; then
|
|
281
|
-
echo "curl -k -s -D - $1 -o /dev/null"
|
|
282
|
-
curl -k -s -D - $1 -o /dev/null:
|
|
283
|
-
else
|
|
284
|
-
echo "curl -k -s -D - $2 -o /dev/null | grep $1:"
|
|
285
|
-
curl -k -s -D - $2 -o /dev/null | grep $1:
|
|
286
|
-
fi
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
## get the timings for a curl to a URL
|
|
290
|
-
## usage: curltime $url
|
|
291
|
-
curltime(){
|
|
292
|
-
curl -w " time_namelookup: %{time_namelookup}\n\
|
|
293
|
-
time_connect: %{time_connect}\n\
|
|
294
|
-
time_appconnect: %{time_appconnect}\n\
|
|
295
|
-
time_pretransfer: %{time_pretransfer}\n\
|
|
296
|
-
time_redirect: %{time_redirect}\n\
|
|
297
|
-
time_starttransfer: %{time_starttransfer}\n\
|
|
298
|
-
--------------------------\n\
|
|
299
|
-
time_total: %{time_total}\n" -o /dev/null -s "$1"
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
# httpDebug: Function to download a web page and show info on what took time
|
|
303
|
-
httpDebug() { /usr/bin/curl "$@" -o /dev/null -w "dns: %{time_namelookup} connect: %{time_connect} pretransfer: %{time_pretransfer} starttransfer: %{time_starttransfer} total: %{time_total}\\n"; }
|
|
304
|
-
|
|
305
|
-
# ---------------------------------------------------------------------------
|
|
306
|
-
# 5. Fun Functions
|
|
307
|
-
# ---------------------------------------------------------------------------
|
|
308
|
-
|
|
309
|
-
# matrix: Function to Enable Matrix Effect in the terminal
|
|
310
|
-
matrix() {
|
|
311
|
-
echo -e "\\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
|
|
312
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#!/bin/bash -l
|
|
2
|
-
|
|
3
|
-
# ---------------------------------------------------------------------------
|
|
4
|
-
#
|
|
5
|
-
# ______ _ ______ _ _
|
|
6
|
-
# | _ \ | | | ___(_) |
|
|
7
|
-
# | | | |___ | |_| |_ _| | ___ ___
|
|
8
|
-
# | | | / _ \| __| _| | | |/ _ \/ __|
|
|
9
|
-
# | |/ / (_) | |_| | | | | __/\__ \
|
|
10
|
-
# |___/ \___/ \__\_| |_|_|\___||___/
|
|
11
|
-
#
|
|
12
|
-
# Description: Mac OS X Dotfiles - Simply designed to fit your shell life.
|
|
13
|
-
#
|
|
14
|
-
# Sections:
|
|
15
|
-
#
|
|
16
|
-
# 1. Bash Completion
|
|
17
|
-
# 2. Bash Completion@2
|
|
18
|
-
#
|
|
19
|
-
# ---------------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# ---------------------------------------------------------------------------
|
|
23
|
-
# 1. Bash Completion
|
|
24
|
-
# ---------------------------------------------------------------------------
|
|
25
|
-
|
|
26
|
-
# Set bash completion for support of macOS and brew bash versions (V 3+)
|
|
27
|
-
# this requires the 'bash-completion' brew install
|
|
28
|
-
|
|
29
|
-
if [ -f /usr/local/etc/bash_completion ]; then
|
|
30
|
-
. /usr/local/etc/bash_completion
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
# ---------------------------------------------------------------------------
|
|
35
|
-
# 2. Bash Completion@2
|
|
36
|
-
# ---------------------------------------------------------------------------
|
|
37
|
-
|
|
38
|
-
# NB. If using completion@2 you need to be aware of a few things:
|
|
39
|
-
# 1. its not compatible with the previous version so you will need to run the folling if its installed
|
|
40
|
-
# brew remove bash-completion
|
|
41
|
-
# 2. Brew bash installed v4.1+ is required, run the following if its not already installed.
|
|
42
|
-
# brew install bash
|
|
43
|
-
# 3. Install bash-completion@2
|
|
44
|
-
# brew install bash-completion@2
|
|
45
|
-
# 4. Default bash needs to be changed to brew bash version
|
|
46
|
-
# # Add the new shell to the list of allowed shells do not un-comment thiese lines in this file
|
|
47
|
-
# sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
|
|
48
|
-
# # Change to the new shell
|
|
49
|
-
# chsh -s /usr/local/bin/bash
|
|
50
|
-
# 5. Comment out the Section '1. Bash Completion' and uncomment the following 3 lines
|
|
51
|
-
|
|
52
|
-
# if [ -f /usr/local/share/bash-completion/bash_completion ]; then
|
|
53
|
-
# . /usr/local/share/bash-completion/bash_completion
|
|
54
|
-
# fi
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
package/bash/.bash_profile
DELETED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
#!/bin/bash -l
|
|
2
|
-
|
|
3
|
-
# ---------------------------------------------------------------------------
|
|
4
|
-
#
|
|
5
|
-
# ______ _ ______ _ _
|
|
6
|
-
# | _ \ | | | ___(_) |
|
|
7
|
-
# | | | |___ | |_| |_ _| | ___ ___
|
|
8
|
-
# | | | / _ \| __| _| | | |/ _ \/ __|
|
|
9
|
-
# | |/ / (_) | |_| | | | | __/\__ \
|
|
10
|
-
# |___/ \___/ \__\_| |_|_|\___||___/
|
|
11
|
-
#
|
|
12
|
-
# Description: Mac OS X Dotfiles - Simply designed to fit your shell life.
|
|
13
|
-
#
|
|
14
|
-
# Sections:
|
|
15
|
-
#
|
|
16
|
-
# 1. Configurations
|
|
17
|
-
# 2. Change prompt
|
|
18
|
-
# 3. Bash shell shopt options
|
|
19
|
-
# 4. Exports
|
|
20
|
-
# 5. History Options
|
|
21
|
-
# 6. GOLANG configurations
|
|
22
|
-
# 7. System Operations & Information
|
|
23
|
-
# 8. Paths Management
|
|
24
|
-
# 9. Reminders & Notes
|
|
25
|
-
#
|
|
26
|
-
# ---------------------------------------------------------------------------
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
# ---------------------------------------------------------------------------
|
|
30
|
-
# 1. Configurations
|
|
31
|
-
# ---------------------------------------------------------------------------
|
|
32
|
-
|
|
33
|
-
# set INPUTRC (so that .inputrc is respected)
|
|
34
|
-
INPUTRC=~/.inputrc
|
|
35
|
-
export INPUTRC
|
|
36
|
-
|
|
37
|
-
# set HOSTNAME
|
|
38
|
-
export HOSTNAME=$(hostname -f)
|
|
39
|
-
|
|
40
|
-
# Set language flags
|
|
41
|
-
LANG=en_GB.UTF-8
|
|
42
|
-
export LANG
|
|
43
|
-
|
|
44
|
-
# Set architecture flags
|
|
45
|
-
ARCHFLAGS="-arch x86_64"
|
|
46
|
-
export ARCHFLAGS
|
|
47
|
-
|
|
48
|
-
# Ensure user-installed binaries take precedence
|
|
49
|
-
LIBCURL_CFLAGS=-L$(brew --prefix)/opt/curl/lib
|
|
50
|
-
export LIBCURL_CFLAGS
|
|
51
|
-
|
|
52
|
-
LIBCURL_LIBS=-I$(brew --prefix)/opt/curl/include
|
|
53
|
-
export LIBCURL_LIBS
|
|
54
|
-
|
|
55
|
-
HOMEBREW_CASK_OPTS="--appdir=/Applications"
|
|
56
|
-
export HOMEBREW_CASK_OPTS
|
|
57
|
-
|
|
58
|
-
MAVEN_OPTS="-Xms512m -Xmx512m"
|
|
59
|
-
export MAVEN_OPTS
|
|
60
|
-
|
|
61
|
-
# GH_TOKEN="YOUR GH_TOKEN"
|
|
62
|
-
# export GH_TOKEN
|
|
63
|
-
|
|
64
|
-
SSL_CERT_FILE=~/cacert.pem
|
|
65
|
-
export SSL_CERT_FILE
|
|
66
|
-
|
|
67
|
-
# AWS_ACCESS_KEY_ID=<Your requested AWS access ID>
|
|
68
|
-
# export AWS_ACCESS_KEY_ID
|
|
69
|
-
|
|
70
|
-
# AWS_SECRET_ACCESS_KEY=<Your requested secret access key>
|
|
71
|
-
# export AWS_SECRET_ACCESS_KEY
|
|
72
|
-
|
|
73
|
-
# Load .bashrc if it exists
|
|
74
|
-
# shellcheck disable=SC1090
|
|
75
|
-
test -f "$HOME/.bashrc" && source "$HOME/.bashrc"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# ---------------------------------------------------------------------------
|
|
79
|
-
# 2. Change prompt
|
|
80
|
-
# ---------------------------------------------------------------------------
|
|
81
|
-
|
|
82
|
-
# Root prompt (😈)
|
|
83
|
-
SUDO_PS1="\[root@$(hostname -s) 😈: $ "
|
|
84
|
-
export SUDO_PS1
|
|
85
|
-
|
|
86
|
-
# Normal prompt (👽)
|
|
87
|
-
PS1="$(hostname -s) 👽: $ "
|
|
88
|
-
export PS1
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# ---------------------------------------------------------------------------
|
|
92
|
-
# 3. Bash shell shopt options
|
|
93
|
-
# ---------------------------------------------------------------------------
|
|
94
|
-
|
|
95
|
-
# Auto-correct directory spelling errors
|
|
96
|
-
shopt -s cdspell
|
|
97
|
-
|
|
98
|
-
# Extended pattern matching features enabled
|
|
99
|
-
shopt -s extglob
|
|
100
|
-
|
|
101
|
-
# Make bash append rather than overwrite the history on disk
|
|
102
|
-
shopt -s histappend
|
|
103
|
-
|
|
104
|
-
# Multilines together
|
|
105
|
-
shopt -s cmdhist
|
|
106
|
-
|
|
107
|
-
# perform hostname completion when a word containing a @ is being completed
|
|
108
|
-
shopt -s hostcomplete
|
|
109
|
-
|
|
110
|
-
# allow a word beginning with # to cause that word and all remaining characters on that line to be ignored
|
|
111
|
-
shopt -s interactive_comments
|
|
112
|
-
|
|
113
|
-
# bash will not attempt to search the PATH for possible completions when completion is attempted on an empty line
|
|
114
|
-
shopt -s no_empty_cmd_completion
|
|
115
|
-
|
|
116
|
-
# case insensitive matching when performing pathname expansion
|
|
117
|
-
shopt -s nocaseglob
|
|
118
|
-
|
|
119
|
-
# check the window size after each command and, if necessary,
|
|
120
|
-
# update the values of LINES and COLUMNS.
|
|
121
|
-
shopt -s checkwinsize
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
# ---------------------------------------------------------------------------
|
|
125
|
-
# 4. Exports
|
|
126
|
-
# ---------------------------------------------------------------------------
|
|
127
|
-
|
|
128
|
-
# Add Visual Studio Code (code)
|
|
129
|
-
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $"*" ;}
|
|
130
|
-
|
|
131
|
-
# Set Default Editor
|
|
132
|
-
EDITOR=code
|
|
133
|
-
export EDITOR
|
|
134
|
-
|
|
135
|
-
# Default block size for ls, df, du
|
|
136
|
-
export BLOCKSIZE=10k
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
# ---------------------------------------------------------------------------
|
|
140
|
-
# 5. History Options
|
|
141
|
-
# ---------------------------------------------------------------------------
|
|
142
|
-
|
|
143
|
-
# Sets the size to "unlimited"
|
|
144
|
-
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups:ignorespace
|
|
145
|
-
|
|
146
|
-
# Ignore whitespace and duplicates. Erase duplicates.
|
|
147
|
-
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}erasedups
|
|
148
|
-
export HISTFILESIZE=1000000000
|
|
149
|
-
export HISTSIZE=1000000
|
|
150
|
-
export HISTTIMEFORMAT="[%F %T] "
|
|
151
|
-
|
|
152
|
-
## Make some commands not show up in history
|
|
153
|
-
export HISTIGNORE="ls:cd:cd -:pwd:exit:ls:history:date:* --help:jrnl *"
|
|
154
|
-
|
|
155
|
-
# Set the location of your HISTFILE
|
|
156
|
-
export HISTFILE=$HOME/.bash_history
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
# ---------------------------------------------------------------------------
|
|
160
|
-
# 6. GOLANG configurations
|
|
161
|
-
# ---------------------------------------------------------------------------
|
|
162
|
-
|
|
163
|
-
# go
|
|
164
|
-
GOROOT=$(brew --prefix)/opt/go/libexec
|
|
165
|
-
export GOROOT
|
|
166
|
-
|
|
167
|
-
export GOPATH=$HOME/.go
|
|
168
|
-
export PATH=$PATH:$GOPATH/bin
|
|
169
|
-
export PATH=$PATH:$GOROOT/bin
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
# Force prompt to write history after every command.
|
|
173
|
-
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
|
|
174
|
-
|
|
175
|
-
set meta-flag on
|
|
176
|
-
set input-meta on
|
|
177
|
-
set output-meta on
|
|
178
|
-
set convert-meta off
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
# ---------------------------------------------------------------------------
|
|
184
|
-
# 8. Paths Management
|
|
185
|
-
# ---------------------------------------------------------------------------
|
|
186
|
-
|
|
187
|
-
# The next line updates PATH for the Google Cloud SDK.
|
|
188
|
-
# source $HOME/google-cloud-sdk/path.bash.inc
|
|
189
|
-
# shellcheck disable=SC1090
|
|
190
|
-
if [ -f "$(brew --prefix)"/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc ]; then
|
|
191
|
-
source "$(brew --prefix)"/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc
|
|
192
|
-
fi
|
|
193
|
-
|
|
194
|
-
# The next line enables bash completion for gcloud.
|
|
195
|
-
# source $HOME/google-cloud-sdk/completion.bash.inc
|
|
196
|
-
# shellcheck disable=SC1090
|
|
197
|
-
if [ -f "$(brew --prefix)"/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc ]; then
|
|
198
|
-
source "$(brew --prefix)"/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc
|
|
199
|
-
fi
|
|
200
|
-
|
|
201
|
-
# Setting JAVA environments
|
|
202
|
-
JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home'
|
|
203
|
-
export JAVA_HOME
|
|
204
|
-
|
|
205
|
-
ANT_HOME="$(brew --prefix)/Cellar/ant/1.10.1/libexec/"
|
|
206
|
-
export ANT_HOME
|
|
207
|
-
|
|
208
|
-
MAVEN_HOME="$(brew --prefix)/Cellar/maven/3.5.2/libexec"
|
|
209
|
-
export MAVEN_HOME
|
|
210
|
-
|
|
211
|
-
M2=$MAVEN_HOME/bin
|
|
212
|
-
export M2
|
|
213
|
-
|
|
214
|
-
GIT_EDITOR="atom"
|
|
215
|
-
export GIT_EDITOR
|
|
216
|
-
|
|
217
|
-
ANDROID_HOME="$HOME/Library/Android/sdk/"
|
|
218
|
-
export ANDROID_HOME
|
|
219
|
-
|
|
220
|
-
PATH=$ANDROID_HOME/tools:$PATH
|
|
221
|
-
export PATH
|
|
222
|
-
|
|
223
|
-
PATH=$ANDROID_HOME/platform-tools:$PATH
|
|
224
|
-
export PATH
|
|
225
|
-
|
|
226
|
-
PATH="$(brew --prefix)/opt/python/libexec/bin:$PATH"
|
|
227
|
-
export PATH
|
|
228
|
-
|
|
229
|
-
PATH="$(brew --prefix)/sbin:$PATH"
|
|
230
|
-
export PATH
|
|
231
|
-
|
|
232
|
-
PATH="/usr/local/opt/imagemagick@6/bin:$PATH"
|
|
233
|
-
export PATH
|
|
234
|
-
|
|
235
|
-
# ---------------------------------------------------------------------------
|
|
236
|
-
# 9. Reminders & Notes
|
|
237
|
-
# ---------------------------------------------------------------------------
|
|
238
|
-
|
|
239
|
-
# remove_disk: spin down unneeded disk
|
|
240
|
-
# ---------------------------------------
|
|
241
|
-
# diskutil eject /dev/disk1s3
|
|
242
|
-
|
|
243
|
-
# to change the password on an encrypted disk image:
|
|
244
|
-
# ---------------------------------------
|
|
245
|
-
# hdiutil chpass /path/to/the/diskimage
|
|
246
|
-
|
|
247
|
-
# to mount a read-only disk image as read-write:
|
|
248
|
-
# ---------------------------------------
|
|
249
|
-
# hdiutil attach example.dmg -shadow /tmp/example.shadow -noverify
|
|
250
|
-
|
|
251
|
-
# mounting a removable drive (of type msdos or hfs)
|
|
252
|
-
# ---------------------------------------
|
|
253
|
-
# mkdir /Volumes/Foo
|
|
254
|
-
# ls /dev/disk* to find out the device to use in the mount command)
|
|
255
|
-
# mount -t msdos /dev/disk1s1 /Volumes/Foo
|
|
256
|
-
# mount -t hfs /dev/disk1s1 /Volumes/Foo
|
|
257
|
-
|
|
258
|
-
# to create a file of a given size: /usr/sbin/mkfile or /usr/bin/hdiutil
|
|
259
|
-
# ---------------------------------------
|
|
260
|
-
# e.g.: mkfile 10m 10MB.dat
|
|
261
|
-
# e.g.: hdiutil create -size 10m 10MB.dmg
|
|
262
|
-
# the above create files that are almost all zeros - if random bytes are desired
|
|
263
|
-
# then use: ~/Dev/Perl/randBytes 1048576 > 10MB.dat
|
|
264
|
-
|
|
265
|
-
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
|
|
266
|
-
# shellcheck disable=SC1090
|
|
267
|
-
[[ -s "$HOME/.dnx/dnvm/dnvm.sh" ]] && . "$HOME/.dnx/dnvm/dnvm.sh" # Load dnvm
|
|
268
|
-
# shellcheck disable=SC1090
|
|
269
|
-
source "$HOME/.bashrc"
|
|
270
|
-
|
|
271
|
-
# The next line updates PATH for the Google Cloud SDK.
|
|
272
|
-
# shellcheck disable=SC1090
|
|
273
|
-
if [ -f "$HOME/exec -l /bin/bash/google-cloud-sdk/path.bash.inc" ]; then source "$HOME/exec -l /bin/bash/google-cloud-sdk/path.bash.inc"; fi
|
|
274
|
-
|
|
275
|
-
# The next line enables shell command completion for gcloud.
|
|
276
|
-
# shellcheck disable=SC1090
|
|
277
|
-
if [ -f "$HOME/exec -l /bin/bash/google-cloud-sdk/completion.bash.inc" ]; then source "$HOME/exec -l /bin/bash/google-cloud-sdk/completion.bash.inc"; fi
|
|
278
|
-
|
|
279
|
-
# Setting PATH for Python 2.7
|
|
280
|
-
# The original version is saved in .bash_profile.pysave
|
|
281
|
-
#PATH="/opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python2.7/bin:${PATH}"
|
|
282
|
-
#export PATH
|
|
283
|
-
#export PATH="$(brew --prefix)/opt/curl/bin:$PATH"
|
|
284
|
-
# shellcheck disable=SC1090
|
|
285
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
|
286
|
-
|
|
287
|
-
# Perl notes
|
|
288
|
-
# By default non-brewed cpan modules are installed to the Cellar. If you wish
|
|
289
|
-
# for your modules to persist across updates we recommend using `local::lib`.
|
|
290
|
-
# You can set that up like this:
|
|
291
|
-
# PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
|
|
292
|
-
# echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.bash_profile
|
|
293
|
-
|
|
294
|
-
# Init jenv
|
|
295
|
-
if which jenv > /dev/null; then eval "$(jenv init -)"; fi
|