forked from atomantic/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.shellaliases
156 lines (127 loc) · 8.51 KB
/
.shellaliases
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
#!/bin/sh
#################################
# Simple Program Name Shortening
alias g=git
alias v=vagrant
alias vp='vagrant provision'
alias vd='vagrant destroy -f'
alias k=kitchen
alias kd='kitchen destroy'
alias kc='kitchen converge'
alias kl='kitchen login'
alias klist='chef exec kitchen list'
alias ball='berks install && berks upload'
alias cook='foodcritic -C `pwd` && cookstyle -E-S'
alias cook_fix='rubocop --auto-correct'
#####################################
# brew shortcut commands
#####################################
alias brew-cask-refresh='brew cask list | xargs brew cask install --force'
alias brew-refresh='brew update && brew upgrade'
#############################
# Utilities
# Lock the screen (when going AFK)
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
# buzzphrase commit
# used for my presentation decks when I have nothing to say about the commit
alias bpc='git add -A . && git cam "$(buzzphrase 2)" && git push'
# recursive dos2unix in current directory
alias dos2lf='dos2unix `find ./ -type f`'
# Flush the DNS on Mac
alias dnsflush='dscacheutil -flushcache'
# Empty the Trash on all mounted volumes and the main HDD.
# Also, clear Apple’s System Logs to improve shell startup speed.
# Finally, clear download history from quarantine. https://mths.be/bum
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'"
# Files being opened
alias files.open='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep|grep open'
# Files used, anywhere on the filesystem
alias files.usage='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep'
# Files in use in the Users directory
alias files.usage.user='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep|grep Users'
alias game.seek='txt="";for i in {1..20};do txt=$txt"$i. ";done;txt=$txt" Ready or not, here I come";say $txt'
# Git Tools
# assumes git-up is installed (gem install git-up)
# switches to 'develop' branch, updates all local branches (nicely using git-up), removes all local branches already merged into 'develop'
alias gitdev='git checkout develop; git-up; git branch --merged develop | grep -v "\* develop" | xargs -n 1 git branch -d; git branch;'
# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias iplocal="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# Show active network interfaces
alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"
# Show network connections
# Often useful to prefix with SUDO to see more system level network usage
alias network.connections='lsof -l -i +L -R -V'
alias network.established='lsof -l -i +L -R -V | grep ESTABLISHED'
alias network.externalip='curl -s http://checkip.dyndns.org/ | sed "s/[a-zA-Z<>/ :]//g"'
alias network.internalip="ifconfig en0 | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'"
# Directory listings
# LS_COLORS='no=01;37:fi=01;37:di=07;96:ln=01;36:pi=01;32:so=01;35:do=01;35:bd=01;33:cd=01;33:ex=01;31:mi=00;05;37:or=00;05;37:'
# -G Add colors to ls
# -l Long format
# -h Short size suffixes (B, K, M, G, P)
# -p Postpend slash to folders
alias ls='ls -G -h -p '
alias ll='ls -l -G -h -p '
# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'
# Copy and paste and prune the usless newline
alias pbcopynn='tr -d "\n" | pbcopy'
# firewall management
alias port-forward-enable="echo 'rdr pass inet proto tcp from any to any port 2376 -> 127.0.0.1 port 2376' | sudo pfctl -ef -"
alias port-forward-disable="sudo pfctl -F all -f /etc/pf.conf"
alias port-forward-list="sudo pfctl -s nat"
# push git repo, but first, use git-up to make sure you are in sync and rebased with the remote
alias pushup="git-up && git push"
# Set the extended MacOS attributes on a file such that Quicklook will open it as text
alias qltext='xattr -wx com.apple.FinderInfo "54 45 58 54 21 52 63 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" $1'
#alias qltext2='osascript -e tell application "Finder" to set file type of ((POSIX file "$1") as alias) to "TEXT"'
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec $SHELL -l"
# Disable Spotlight
alias spotoff="sudo mdutil -a -i off"
# Enable Spotlight
alias spoton="sudo mdutil -a -i on"
# Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; mas upgrade; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update; sudo gem cleanup'
alias vtop="vtop --theme wizard"
##########################################
# Proxy Fun
#########################################
# Define our default proxy
export proxy_url=http://3.166.220.15:3128
export proxy_url2=http://cinproxy.glb.comfin.ge.com:80
export proxy_url3=http://iss-americas-pitc-cincinnatiz.proxy.corporate.ge.com:80
export proxy_url4=http://http-proxy.us.money.ge.com
export proxy_url5=http://127.0.0.1:31114
export proxy_url6=http://pitc-cin.cloud.health.ge.com:80/
export proxy_url7=http://http-proxy.ha.health.ge.com:88/
export proxy_url8=http://cis-americas-pitc-cinciz.proxy.corporate.ge.com:80
export proxy_url9=http://proxy-src.research.ge.com:8080
export proxy_url10=http://PITC-Zscaler-Americas-Cincinnati3PR.proxy.corporate.ge.com:80
export proxy_url11=http://PITC-Zscaler-US-MilwaukeeZ.proxy.corporate.ge.com:9400
export proxy_url12=http://PITC-Zscaler-US-Alpharetta3PR.proxy.corporate.ge.com:9400
export proxy_url13=https://cloudproxy.setpac.ge.com/pac.pac
# These aliases are used to check the proxy and turn it on and off
# alias set_proxies="export VAGRANT_HTTP_PROXY=$proxy_url; export VAGRANT_HTTPS_PROXY=$proxy_url; export VAGRANT_NO_PROXY=$no_proxy"
alias proxy="env |grep -E '_proxy|_PROXY'"
alias proxyon_archops="export http_proxy=$proxy_url; export https_proxy=$proxy_url;export VAGRANT_HTTP_PROXY=$proxy_url; export VAGRANT_HTTPS_PROXY=$proxy_url;proxy"
alias proxyon_cin="export http_proxy=$proxy_url2; export https_proxy=$proxy_url2;export VAGRANT_HTTP_PROXY=$proxy_url2; export VAGRANT_HTTPS_PROXY=$proxy_url2;proxy"
alias proxyon_cin2="export http_proxy=$proxy_url3; export https_proxy=$proxy_url3;export VAGRANT_HTTP_PROXY=$proxy_url3; export VAGRANT_HTTPS_PROXY=$proxy_url3;proxy"
alias proxyon_money="export http_proxy=$proxy_url4; export https_proxy=$proxy_url4;export VAGRANT_HTTP_PROXY=$proxy_url4; export VAGRANT_HTTPS_PROXY=$proxy_url4;proxy"
alias proxyon_myapps="export http_proxy=$proxy_url5; export https_proxy=$proxy_url5;export VAGRANT_HTTP_PROXY=$proxy_url5; export VAGRANT_HTTPS_PROXY=$proxy_url5;proxy"
alias proxyon_pitc="export http_proxy=$proxy_url6; export https_proxy=$proxy_url6;export VAGRANT_HTTP_PROXY=$proxy_url6; export VAGRANT_HTTPS_PROXY=$proxy_url6;proxy"
alias proxyon_health="export http_proxy=$proxy_url7; export https_proxy=$proxy_url7;export VAGRANT_HTTP_PROXY=$proxy_url7; export VAGRANT_HTTPS_PROXY=$proxy_url7;proxy"
alias proxyon_cis="export http_proxy=$proxy_url8; export https_proxy=$proxy_url8;export VAGRANT_HTTP_PROXY=$proxy_url8; export VAGRANT_HTTPS_PROXY=$proxy_url8;proxy"
alias proxyon_research="export http_proxy=$proxy_url9; export https_proxy=$proxy_url9;export VAGRANT_HTTP_PROXY=$proxy_url9; export VAGRANT_HTTPS_PROXY=$proxy_url9;proxy"
alias proxyon_pac="export http_proxy=$proxy_url13; export https_proxy=$proxy_url13;export VAGRANT_HTTP_PROXY=$proxy_url13; export VAGRANT_HTTPS_PROXY=$proxy_url13;proxy"
#cloud proxies that work
alias proxyon_pitcCIS="export http_proxy=$proxy_url10; export https_proxy=$proxy_url10;export VAGRANT_HTTP_PROXY=$proxy_url10; export VAGRANT_HTTPS_PROXY=$proxy_url10;proxy"
alias proxyon_pitcMIL="export http_proxy=$proxy_url11; export https_proxy=$proxy_url11;export VAGRANT_HTTP_PROXY=$proxy_url11; export VAGRANT_HTTPS_PROXY=$proxy_url11;proxy"
alias proxyon_pitcALPHA="export http_proxy=$proxy_url12; export https_proxy=$proxy_url12;export VAGRANT_HTTP_PROXY=$proxy_url12; export VAGRANT_HTTPS_PROXY=$proxy_url12;proxy"
alias proxyoff="unset http_proxy; unset https_proxy; unset ftp_proxy; unset VAGRANT_HTTP_PROXY; unset VAGRANT_HTTPS_PROXY; unset VAGRANT_NO_PROXY"
export no_proxy="localhost,127.0.0.1,.ge.com,minimart.corporate.ge.com,github.build.ge.com"
export VAGRANT_NO_PROXY="$no_proxy"
# default one to start is health proxy
proxyon_health