-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev_wrapper
More file actions
51 lines (46 loc) · 1.14 KB
/
dev_wrapper
File metadata and controls
51 lines (46 loc) · 1.14 KB
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
############################
# Add list of servers here #
############################
declare -A SERVERS
SERVERS[DEFAULT]="0.0.0.0"
#############
# Dev alias #
#############
alias getpid="ps -au $(whoami) | grep $1"
alias whereis="grep -rni ${1} ."
alias refresh="source ~/.zshrc"
#################
# Dev Functions #
#################
connect() {
if [[ $# == 1 ]]; then
ssh -i ~/.key_${1} ${1}@${SERVERS[DEFAULT]}
elif [[ $# == 2 ]]; then
ssh -i ~/.key_${2} ${1}@${SERVERS[$2]}
else
echo "Connect to the remote server using ssh.\nUsage: connect <username> [servername]";
_server_list
fi
}
mconnect() {
if [[ $# == 1 ]]; then
mosh --ssh="ssh -i ~/.key_${1}" ${1}@${SERVERS[DEFAULT]}
elif [[ $# == 2 ]]; then
mosh --ssh="ssh -i ~/.key_${2}" ${1}@${SERVERS[$2]}
else
echo "Connect to the remote server using mosh.\nUsage: mconnect <username> [servername]"
_server_list
fi
}
_server_list() {
for i in ${(k)SERVERS}; do
echo "${i}: ${SERVERS[$i]}"
done
}
attach() {
if [[ -n $1 ]]; then
tmux attach-session -t $1
else
tmux a
fi
}