-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase.bashrc
109 lines (103 loc) · 1.94 KB
/
base.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
alias l="ls"
alias c="cd"
alias la="ls -a"
alias le="less"
alias py="python"
alias py3="python3"
up()
{
tmp=.. # finally `cd` parameter
if [ $# -eq 0 ];then
cd $tmp
elif [ $1 -eq 1 ];then
cd $tmp
else
for i in $(seq 2 $1)
do
tmp=$tmp/..
done
cd $tmp
fi
pwd
}
alias ss_bashrc="source ~/.bashrc"
alias ser_http="ifconfig|grep 'inet addr';python -m SimpleHTTPServer"
space2dline()
{
find . -maxdepth 1 -name "* *" |
while read name; do
echo $name
na=$(echo $name | tr ' ' '_')
mv "$name" $na
done
}
bx(){ cd `mktemp -d /tmp/sandbox_$1_XXXX`; }
bx_clr(){ /bin/rm /tmp/sandbox* -rf;}
bx_ls(){ ls /tmp|grep sandbox;}
font_install()
{
sudo mkdir -p /usr/share/fonts/windows
sudo cp `ls|grep ttf` /usr/share/fonts/windows
sudo mkfontscale
sudo mkfontdir
sudo fc-cache -fv
}
alias font_show="fc-list "
alias font_showzh="fc-list :lang=zh"
alias font_fresh="fc-cache"
alias v="vim"
gitall()
{
git add -A
git commit -m "$1"
}
alias gitb="git branch"
alias gitc="git checkout"
alias gits="git status"
pathadd() {
echo "Adding $1 to PATH"
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
export PATH="$1:$PATH"
fi
}
# Add to ld_library _path if not already there
ldpathadd() {
echo "Adding $1 to LD_LIBRARY_PATH"
if [ -d "$1" ]; then
if [[ ":$LD_LIBRARY_PATH:" != *":$1:"* ]]; then
# For non-empty, only add if not already there
export LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH"
fi
fi
}
pylog()
{
nohup python -u $1 > py.log 2>&1 &
}
py3log()
{
nohup python3 -u $1 > py3.log 2>&1 &
}
gbk2utf8()
{
iconv -f gbk -t utf8 $1 -o tmp.tmp
mv tmp.tmp $1
}
utf82gbk()
{
iconv -f utf8 -t gbk $1 -o tmp.tmp
mv tmp.tmp $1
}
rm ()
{
if [[ $1 == / || $2 == / || $3 == / ]];then
echo "I save you"
elif [[ $1 == /* || $2 == /* || $3 == /* ]];then
echo "I save you"
else
/bin/rm $*
fi
}
alias install="sudo apt get install -y"
alias update="sudo apt get update -y"
alias myip="ip -br -c a"