-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbashrc_orca.sh
190 lines (150 loc) · 4.54 KB
/
bashrc_orca.sh
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/env bash
#--------------------------------------------------
# Prompt Setting
#--------------------------------------------------
HOST=$(hostname | cut -d. -f1)
if [ "$PS1" ]; then
PS1="\u_$HOST$ "
ignoreeof=1
fi
#--------------------------------------------------
# General ENV
#--------------------------------------------------
#export LANG=en_US
#export LC_CTYPE="utf-8"
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export CVSEDITOR=vim
export PATH=$HOME/local/bin:$PATH
export PATH=/Applications/CMake.app/Contents/bin:$PATH
# For MacPort:
export PATH=/opt/local/bin:$PATH
# Ruby
export PATH=/usr/local/opt/ruby/bin:$PATH
#--------------------------------------------------
# General Aliases
#--------------------------------------------------
alias l="ls"
alias ll="l -lh"
alias lsd="l -d */"
alias p="pwd"
alias rl="root -l"
alias rm~="rm *~"
alias cdoutlook="cd /Users/xshi/Library/Group\ Containers/UBF8T346G9.Office/Outlook/Outlook\ 15\ Profiles/Main\ Profile/Data/Message\ Attachments"
alias sr="ssh -R 52699:localhost:52698"
alias sd="ssh -D 9999 [email protected]"
alias si="ssh -D 9999 [email protected]"
alias jk="bundle exec jekyll serve"
alias dk_tracs="docker run --interactive --rm --tty --volume $HOME:/data --name=tracs rd50/tracs bash"
#. ~/local/share/root/bin/thisroot.sh
#. ~/local/share/root_v6.16.00/bin/thisroot.sh
#. /Applications/root_v6.20.04/bin/thisroot.sh
. ~/local/share/root6-build/bin/thisroot.sh
#--------------------------------------------------
# Functions
#--------------------------------------------------
bak(){
if [ -z "$1" ]; then
echo "IHEPBox(i) Ocean(o) Ocean2(o2) Ocean3(o3)?"
elif [ "$1" = "i" ]; then
echo "No more use..."
#rsync -avuE --exclude-from=$HOME/.sys/exclude.list -P $HOME/Documents $HOME/IHEPBox
elif [ "$1" = "o" ]; then
rsync -avuE -P $HOME/Documents /Volumes/Ocean/Documents
rsync -avuE -P $HOME/Pictures /Volumes/Ocean/Pictures
rsync -avuE -P $HOME/Movies /Volumes/Ocean/Movies
elif [ "$1" = "o2" ]; then
rsync -avuE -P /Volumes/Ocean/ /Volumes/Ocean2/
elif [ "$1" = "o3" ]; then
rsync -avuE -P $HOME/Documents /Volumes/Ocean3/Documents
rsync -avuE -P $HOME/Pictures /Volumes/Ocean3/Pictures
rsync -avuE -P /Volumes/Ocean/Pictures/Photos\ Library.photoslibrary /Volumes/Ocean3/Pictures/Photos\ Library.photoslibrary
rsync -avuE -P $HOME/Movies /Volumes/Ocean3/Movies
fi;
}
et() {
echo "Recursively generating TAGS for *.cc *.h *.py ..."
find . -name "*.cc" -print -or -name "*.h" -print -or -name "*.py" -print | xargs etags
}
ki() {
hostnames=(cern fnal lepp)
if [ -z "$1" ]; then
for hostname in ${hostnames[*]}
do
subst="$hostname"
echo " ["$hostname"]" ${!subst}
done
read menu
else
menu=$1
fi
case $menu in
lepp) kinit -f -l 7d [email protected]
;;
fnal) kinit -f [email protected]
;;
cern) kinit -Af -l 1d [email protected]
;;
esac
}
ks() {
if [ -z "$1" ]; then
echo "lepp (l) , fnal (f), cern (c) ?"
elif [ "$1" = "l" ]; then
kswitch -p [email protected]
elif [ "$1" = "f" ]; then
kswitch -p [email protected]
elif [ "$1" = "c" ]; then
kswitch -p [email protected]
fi;
}
setsys() {
echo -ne "Setting system ...\r"
sudo cp ~/.sys/etc_krb5.conf /etc/krb5.conf
cp ~/.sys/ssh_config ~/.ssh/config
cp ~/.sys/dot_hgrc ~/.hgrc
echo "Setting system ... done."
}
sl() {
# echo "[tn] ssh [email protected] -L 10080:remote.cern.ch:80 -N"
# cat ~/.ssh/id_dsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
hostnames=(cern xteam ihep ihep7 lepp pixel emc)
export [email protected]
export [email protected]
export [email protected]
export [email protected]
export [email protected]
export [email protected]
if [ -z "$1" ]; then
for hostname in ${hostnames[*]}
do
subst="$hostname"
echo " ["$hostname"]" ${!subst}
done
read menu
else
menu=$1
fi
for hostname in ${hostnames[*]}
do
subst="$hostname"
if [[ $menu == $hostname ]];
then
echo "Logging into" ${!subst} "..."
case $menu in
cepc) echo "Using port 52699 for remote edit."
ssh -Y -R 52699:127.0.0.1:52698 ${!subst}
;;
* )
ssh -Y ${!subst}
;;
esac
fi
done
}
function tabname {
printf "\e]1;$1\a"
}
function winname {
printf "\e]2;$1\a"
}