forked from michaeljsmalley/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
aliases
104 lines (93 loc) · 3.76 KB
/
aliases
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
alias s="git status --short"
alias m='echo -ne "\033[0;36mSwitching to MAIN?\033[0;0m\n" && git co main'
alias v="vim -c 'normal ,d' ."
alias jack='ack --js'
alias pack='ack --php'
alias hack='ack --html'
alias l='ls -lrth'
if [[ $OSTYPE == 'darwin'* ]]
then
basedir='~/Expensidev'
else
basedir='/vagrant'
fi
alias web="cd ${basedir}/Web-Expensify/"
alias auth="cd ${basedir}/Auth/"
alias bp="cd ${basedir}/Bedrock-PHP/"
alias bql="cd ${basedir}/Web-Expensify && ../script/bedrocksql.sh"
alias br="cd ${basedir}/Bedrock/"
alias dev="cd ${basedir}/"
alias is="cd ${basedir}/Integration-Server"
alias libs="cd ${basedir}/PHP-Libs/"
alias mobile="cd ${basedir}/Mobile-Expensify/"
alias pdf="cd ${basedir}/Web-PDFs/var/pdfs.expensify.com"
alias salt="cd ${basedir}/Salt"
alias secure="cd ${basedir}/Web-Secure/"
alias sql="${basedir}/script/sql.sh"
alias ss="cd ${basedir}/Ops-Configs/saltfab; source venv/bin/activate"
alias static="cd ${basedir}/Web-Static"
alias tf="${basedir}/script/tail.sh"
alias cash="cd ${basedir}/App"
alias uid='uuidgen | tr '\''[:upper:]'\'' '\''[:lower:]'\'' | pbcopy && echo '\''UUID copied to clipboard'\'''
alias logs="ssh log1.uw1 -tt /expensify/bin/logwatcher | grep --line-buffered --color=always -v productiv.com | grep --line-buffered --color=always -v 'Database closed' | grep --line-buffered --color=always -v 'Slow query.*WITH sharedReportsWithTransactions'"
alias master='echo -ne "\033[0;36mconnecting to db1.sjc\033[0;0m\n" && ssh db1.sjc'
alias bj='ssh -A bastion1.sjc'
alias sc='cat ~/.ssh/config'
alias ops="cd ~/expensify/Ops-Configs/"
alias db='echo -ne "\033[0;36mconnecting to db2.rno\033[0;0m\n" && ssh db2.rno'
alias fab="fab -g bastion1.sjc -u carlos"
alias pab="fab -P -z 100 -u carlos"
alias lw="ssh log1.uw1"
alias df="diff -y -s --suppress-common-lines"
alias dfw="diff -y -s --suppress-common-lines -w"
if [[ $OSTYPE == 'darwin'* ]]
then
function push(){
branch=`git rev-parse --abbrev-ref HEAD`
if [ $branch == 'master' ]; then
echo "DO NOT PUSH TO MASTER"
elif [ $branch == 'main' ]; then
echo "DO NOT PUSH TO MAIN"
else
git push origin $branch
fi
}
function pushf(){
branch=`git rev-parse --abbrev-ref HEAD`
if [ $branch == 'master' ]; then
echo "DO NOT PUSH TO MASTER"
elif [ $branch == 'main' ]; then
echo "DO NOT PUSH TO MAIN"
else
git push -f origin $branch
fi
}
function pr(){
remote=`git remote -v | grep origin | head -1 | awk '{print $2'} | sed 's/.*:\(.*\)*/\1/' | sed 's/\.git$//'`
branch=`git rev-parse --abbrev-ref HEAD`
open "https://github.com/$remote/compare/${1:-main}...$branch?expand=1&assignee=cead22"
}
function vm (){
if [[ `screen -list | grep vm` ]]; then
echo "Attaching existing screen session"
screen -r vm
else
echo "Initiating new screen session"
screen -S vm bash -c "cd ~/Expensidev/; vagrant ssh;"
fi
}
function as (){
ss
fab -g bastion1.sjc -H ${1:-db2.rno} -- "echo -ne \"status\\r\\nconnection:close\\r\\n\\r\\n\" | nc -w 60 localhost 9999 | tail -1 | jq '(\"\(.host) \(.state)\"), (.peerList[] | \"\(.host) \(.state)\")'" | grep 4445 | sed "s/0.0.0.0/auth.${1:-db2.rno}/" | cut -d' ' -f 3-4 | sed 's/auth\.//' | sed 's/:4445//' | tr -d '"' && cd - 2&>/dev/null
}
function bs (){
ss
fab -H virt${1:-1.sjc} -- "echo -ne \"status\\r\\nconnection:close\\r\\n\\r\\n\" | nc -w 60 webrock${1:-1.sjc} 8888 | tail -1 | jq '(\"\(.host) \(.state)\"), (.peerList[] | \"\(.host) \(.state)\")'" | grep 8889 | sed "s/.*\..*\..*\./webrock.${1:-1.sjc}/" | cut -d' ' -f 3-4 | sed 's/webrock//' | sed 's/:8889//' | tr -d '"' && cd - 2&>/dev/null
}
function count_csv (){
tr ',' '\n' | grep -v '^$' | sort -rf | uniq -ci | sort -k 1,1nr
}
function pretty_csv {
column -t -s, "$@" | less -F -S -X -K
}
fi