-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc-doanac
executable file
·115 lines (99 loc) · 3.9 KB
/
bashrc-doanac
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
# increase the defaults for history
export HISTSIZE=3000
export HISTFILESIZE=4000
alias reckless="ssh -A -XC reckless"
alias og="ssh -A og"
alias fioctl-meds="fioctl -c /home/doanac/code/meds-fioed/creds/fioctl.yaml"
alias git-meds="FIOCTL_CONFIG=/home/doanac/code/meds-fioed/creds/fioctl.yaml git"
export EDITOR=vim
eval $(systemctl --user show-environment | grep SSH_AUTH_SOCK)
export SSH_AUTH_SOCK
#aliases for using a single gvim instance
function gvim-s ()
{
if [ $# -eq 0 ] ; then
gvim
else
gvim --remote-tab-silent $*
fi
}
alias gvim="gvim-s"
#aliases for using a single console instance
function vim-s ()
{
if [ $# -eq 0 ] ; then
vim --servername DOANAC-LAP
else
vim --servername DOANAC-LAP --remote-tab-silent $*
fi
}
alias ssh-forget="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
alias scp-forget="scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
alias vi=vim
# k8s stuff
function first_pod ()
{
kubectl --context $1 --namespace $2 get pods | grep Running | grep $3 | head -n1 | cut -d\ -f1
}
function jobserv-shell ()
{
pod=$(first_pod $1 jobserv jobserv)
echo == conecting to $pod ...
kubectl --context $1 --namespace jobserv exec -it $pod -- /bin/sh
}
alias jobserv-og="jobserv-shell gke_osf-prod_us-central1-a_osf-prod"
function k8s-tail ()
{
pod=$(kubectl --context $1 --namespace $2 get pods | grep $3 | head -n1 | cut -d\ -f1)
echo == conecting to $pod ...
kubectl --context $1 --namespace $2 logs --tail 1000 -f $pod
}
function k8s-shell ()
{
pod=$(first_pod gke_osf-prod_us-central1-a_osf-prod $1 $2)
echo == conecting to $pod ...
kubectl --context gke_osf-prod_us-central1-a_osf-prod --namespace $1 exec -it $pod -- /bin/sh
}
alias ota-lite-og="k8s-shell ota-lite api"
alias jobserv-tail-api='kubectl --namespace jobserv logs -f deployment/jobserv --all-containers=true'
alias jobserv-tail-gitpoller='k8s-tail gke_osf-prod_us-central1-a_osf-prod jobserv git-poller'
alias jobserv-tail-workermonitor='k8s-tail gke_osf-prod_us-central1-a_osf-prod jobserv worker'
alias lite-tail-worker='k8s-tail gke_osf-prod_us-central1-a_osf-prod partner partner-worker'
alias lite-tail-api='k8s-tail gke_osf-prod_us-central1-a_osf-prod ota-lite api'
alias lite-tail-gateway='k8s-tail gke_osf-prod_us-central1-a_osf-prod ota-lite gateway'
alias lite-tail-dg='k8s-tail gke_osf-prod_us-central1-a_osf-prod ota-lite device-gateway'
alias analyticz-tail='k8s-tail gke_osf-prod_us-central1-a_osf-prod data analyticz'
alias jobserv-curl="curl -H \"OSF-TOKEN: $(cat $HOME/.osf-token)\" $*"
function jobserv-rerun(){
if [ $# -ne 3 ] ; then
echo "Usage: jobserv-rerun <project> <build> <run>"
else
jobserv-curl -X POST https://api.foundries.io/projects/$1/builds/$2/runs/$3/rerun
fi
}
alias kubectl-esh='kubectl --namespace esh'
alias kubectl-jobserv='kubectl --namespace jobserv'
alias kubectl-ota-lite='kubectl --namespace ota-lite'
alias kubectl-partner='kubectl --namespace partner'
alias kubectl-stag-ota-lite='kubectl --namespace stag-ota-lite'
alias kubectl-stag2-ota-lite='kubectl --namespace stag2-ota-lite'
alias kubectl-subscriber-registry='kubectl --namespace subscriber-registry'
function apc_reboot() {
if [ $# != 1 ] ; then
echo "Usage: api_reboot <port>"
else
curl "http://reckless:4321/power/control/reboot?hostname=apc-pdu&port=$1"
fi
}
alias pdu-reboot-rpi-1="apc_reboot 1"
alias pdu-reboot-rpi3-2="apc_reboot 2"
alias pdu-reboot-rpi3-3="apc_reboot 3"
alias pdu-reboot-synquacer="apc_reboot 4"
alias pdu-reboot-minnowboard="apc_reboot 5"
alias pdu-reboot-dragonboard="apc_reboot 6"
alias pdu-reboot-rpi4-1="apc_reboot 7"
alias pdu-reboot-apm="apc_reboot 8"
#alias pdu-reboot-rpi0="curl 'http://reckless:4321/power/control/reboot?hostname=ykush&port=3&delay=5'"
#alias pdu-reboot-rpi3-1="curl 'http://reckless:4321/power/control/reboot?hostname=ykush&port=1&delay=5'"
alias chromium="chromium --disable-gpu-driver-bug-workarounds"
alias pass="GNUPGHOME=/home/doanac/.gnupg-local pass"