-
Notifications
You must be signed in to change notification settings - Fork 1
/
_bashrc
261 lines (220 loc) · 6.35 KB
/
_bashrc
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
source /etc/profile
CVSROOT=/mnt/RedHat/cvs
SVN_ROOT=svn://127.0.0.1
MOZ_DISABLE_PANGO=1
EDITOR=vim
VISUAL=vim
home_path(){
check_path=$1
aim_var=$2
if [ -d $check_path ]
then
export $aim_var=$check_path
export PATH=$check_path/bin:$PATH
fi
}
home_path /opt/*jdk* JAVA_HOME
home_path /opt/*maven* MAVEN_HOME
home_path /opt/*ant* ANT_HOME
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
if [ -d /usr/programming/jars ]
then
for jar in $(find /usr/programming/jars/ -name '*.jar');do
CLASSPATH=$CLASSPATH:$jar
done
fi
PATH=~/tools:/opt/firefox:/opt/texlive/2005/bin/i386-linux/:~/pieces/combine/gc_trunk:$PATH:
export PATH CLASSPATH CVSROOT SVN_ROOT MOZ_DISABLE_PANGO EDITOR VISUAL
BIBINPUTS=.:/home/wizard/programming/tex/mybibs
export BIBINPUTS
[[ -f /etc/profile.d/bash-completion ]] && source /etc/profile.d/bash-completion
# xmodmap ~/.xmodmap
CENV="env LC_ALL=C "
alias iconv2utf8="iconv -c -f gb18030 -t utf8 "
alias iconv2gbk="iconv -c -f utf8 -t gb18030 "
alias updateTables="rake db:migrate VERSION=0 && rake db:migrate"
alias freemind="sh ~/other_tools/freemind/freemind.sh"
alias xargs="xargs -I '{}'"
alias svnbin2txt="svn pd svn:mime-type"
alias scat="/usr/programming/apache-tomcat-5.5.27/bin/startup.sh"
alias kcat="/usr/programming/apache-tomcat-5.5.27/bin/shutdown.sh"
alias rcat="kcat && scat"
alias fir2="mplayer -loop 0 -vo null /mnt/data/mov/fir/2/[^A]*"
alias l="ls"
alias ll="ls -l"
alias la="ls -a"
alias xpdf="$CENV xpdf" # dirty fix xpdf speed
alias glade="$CENV glade-3"
alias scilab="$CENV ~/somebins/scilab-5.1.1/bin/scilab"
# For colourful man pages (CLUG-Wiki style)
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
# for fun
#fun(){
#find /mnt/data/mov/fir/2/ -not -name 'AVS*' -print0 | xargs ls
#}
# for svn create project
function mksvndir(){
mkdir -p $1/{trunk,tags,branches}
svn import $1 $SVN_ROOT/$1 -m "Init $i" && rm -rf $1 && svn co $SVN_ROOT/$1/trunk ${1}_trunk
echo "$1 initiated OK."
}
function buildstruts2(){
cd ~/programming
tar cvzf struts2_skel.tar.gz struts2_skel
}
function mkstruts2dir(){
unset pro skelname proskelname tarball packagename
pro=$1
skelname=SKEL
proskelname=PRONAME
tarball=~/programming/struts2_skel.tar.gz
packagename=cn.cublog.drunkedcat.$1
tar xvf $tarball
mv struts2_skel $pro
grep -R -l $skelname $pro | xargs -I '{}' sed -i -e "s/$skelname/$packagename/g" {}
grep -R -l $proskelname $pro | xargs -I '{}' sed -i -e "s/$proskelname/$pro/g" {}
make -C $pro/WEB-INF/src/java
echo "$pro init ok."
unset pro skelname proskelname tarball packagename
}
# random encry pdf file
function pdfencrypt(){
password=$(whoami)$(perl -e "print rand()")$(date --iso-8601)
mv $1 raw_$1
pdftk raw_$1 output encry_$1 owner_pw $password
echo "$1 encrypted to encry_$1, raw_$1 is backup."
}
# use two functions to toggle, the first function is default action
function toggle(){
if [ $kkkkk ] ; then
$2
unset kkkkk
else
export kkkkk=1
$1
fi
}
# $$a must be : eval echo $`echo $a`
# this is better: echo ${x[$pp]}
function toggle2(){
flag_name=toggle_$3
if [ ${toggle[$flag_name]} ] ; then
$2
unset toggle[$flag_name]
else
export toggle[$flag_name]=1
$1
fi
}
kk_on(){
echo on
}
kk_off(){
echo off
}
function afterX(){
xpmroot ~/.fvwm/back.png &
conky &
~/tools/status.bar
}
function easyandroid(){
mkdir $1
android create project --target 2 --package cn.cublog.drunkedcat.$1 --name $1 --activity $(echo $1 | sed -e 's/^\([a-z]\)/\u\1/') --path $1
}
function eg(){
git init
git add .
git commit -a -m $(pwd | sed -e 's@.*/\([^/]\+\)@\1@')
}
function sfeg(){
mkdir $1
cd $1
git init
git config user.name "whitelilis"
git config user.email "[email protected]"
git remote add origin ssh://whitelilis@$1.git.sourceforge.net/gitroot/$1/$1
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
echo '[email protected]' > email
git add email
git commit email -m 'my email'
git push origin master
}
function ss(){
if [ -e ~/.dropbox-dist/dropboxd ]
then
ps ux | grep -v grep | grep dropbox > /dev/null 2>&1
if [ $? -ne 0 ]
then
~/.dropbox-dist/dropboxd &
fi
fi
startx
}
#set -x
#set -o vi
#export CDPATH=.:~
export UMLGRAPH_HOME=/usr/local/lib/umlgraph
export PERL5LIB=~/programming/gits/whitelilisnaive/perl_wizard
# for admin
# for history
shopt -s histappend # append all teminals' history
PROMPT_COMMEND='history -n; history -a' # add all history to every terminal
HISTSIZE=100000
HISTFILESIZE=100000
HISTTIMEFORMAT='%a %T '
export PROMPT_COMMEND HISTFILESIZE HISTSIZE HISTTIMEFORMAT
function sc(){
#screen -D -RR
tmux a || tmux
}
for f in ~/.private ~/.work
do
if [ -e $f ]
then
source $f
fi
done
d (){
pdsh -R exec -u 17 -f 5 -w ^$@
}
longd (){
pdsh -R exec -u 300 -f 10 -w ^$@
}
pdf (){
acroread "$@" 2>/dev/null
}
new-repo (){
repo=$1
mkdir $repo
cd $repo && git init . && git config --bool core.bare true
cd -
}
which brew > /dev/null 2>&1
if [ $? -eq 0 ] # brew exist
then
if [ -f $(brew --prefix)/etc/bash_completion ]
then
. $(brew --prefix)/etc/bash_completion
fi
fi
alias tda='java -jar /home/wizard/src/tda/tda.jar'
alias work='mplayer ~/music/secret_garden/*.mp3'
alias R='LC_ALL=C R'
alias ccl_update="ccl -n -e '(rebuild-ccl :update t :full t)'"
wps_prefix="$HOME/my_src/wps-office_8.1.0.3724~b1p2_x86"
function wps(){
$wps_prefix/wps $*
}
function wpp(){
wpp=$wps_prefix/wpp $*
}
function et(){
$wps_prefix/et $*
}