-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_dawnfunc
152 lines (123 loc) · 3.82 KB
/
.bash_dawnfunc
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
#!/bin/bash
lsgz(){ gzip -l $@; }
alias cq='condor_q'
alias cst='condor_status'
#Perl5
test -d $HOME/perl5/lib/perl5 && eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)
importrc $HOME/perl5/perlbrew/etc/bashrc
##ruby gems
#export GEM_HOME=$HOME/gems
#importrc $HOME/.rvm/scripts/rvm
#pathmunge $HOME/.rvm/bin
#pathmunge $HOME/.rvm/usr/bin
#rvm default ruby-1.9.2
findgrep () { # find | grep
if [ $# -eq 0 ]; then
echo "findgrep: No arguments entered."; return 1
else
# "{.[a-zA-Z],}*" instead of "." makes the output cleaner
find {.[a-zA-Z],}* -type f | xargs grep -n $* /dev/null \
2> /dev/null
fi
}
function sshto () {
host=$1
shift
if [ $# -eq 0 ]; then
ssh -X $host -t "cd '$PWD'; bash --login"
else
ssh $host -t "cd '$PWD'; bash --login" $@
fi
}
#python
#export PYTHONSTARTUP=$HOME/.pythonrc.py
[[ -s "$HOME/.pythonbrew/etc/bashrc" ]] && source "$HOME/.pythonbrew/etc/bashrc"
export PYTHONPATH=$HOME/.local/lib64/python2.7/site-packages:$PYTHONPATH
pathmunge $HOME/.local/bin
pathmunge $HOME/bin
pathmunge $HOME/dawn/bin
#for R
#if [ -f $HOME/bin/R ]; then
# export R_HOME=$HOME/lib64/R
# export PYTHONPATH=${R_HOME}/library/RSPython/libs:$PYTHONPATH
# export PYTHONPATH=${R_HOME}/library/RSPython/Python:$PYTHONPATH
# export LD_LIBRARY_PATH=${R_HOME}/library/RSPython/libs:${R_HOME}/lib:$LD_LIBRARY_PATH
#fi
#Vim
alias vi='DISPLAY= vim'
alias vim='DISPLAY= vim'
alias gvim='gvim -X'
alias vvi=vvim
alias less="/usr/share/vim/vim73/macros/less.sh"
#Clean PATH, LD_LIBRARY_PATH
function listpath(){
echo $@ |sed 's/:/\n/g' |sed '/^[ \t]*$/d' | sed 's\/$\\g'
}
function cleanpath(){
echo $@ |
sed 's/:/\n/g' |
sed '/^[ \t]*$/d' |
sed 's\/$\\g' |
gawk '
BEGIN{n=1;}
{if( (!($1 in p))&&(0==system(sprintf("test -d %s", $1))) ){p[$1]=NR; sp[n++]=$1;} }
END{for(i=1;i<n;i++)printf(":%s", sp[i]);}'
}
export PATH=$(cleanpath $PATH)
export LD_LIBRARY_PATH=$( cleanpath $LD_LIBRARY_PATH )
#notify-send alias, 20120206
function alert(){
test $# -ge 1 || { echo "alert pid something to say" 1>&2; exit 1; }
icond="/usr/share/icons/gnome/scalable/status";
pid=$1
shift
wait $pid && notify-send -i $icond/gtk-dialog-info.svg "$@ ^_^" &
}
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto --sort=time --reverse'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
#alias grep='grep --color=auto -HP'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
alias rm='rm -i'
alias df='df -hl'
#ls related quick access
alias ..="cd .."
alias ...="cd ../.."
alias -- -="cd -"
alias l.='ls -d .*'
alias ll='ls -lhvrt'
alias lld='ls -lUd */'
function md() { mkdir -p "$1" && cd "$1"; }
#ln to make symbolic links
lns() {
bd1=`readlink -f "$1"`
bd2=`readlink -f "$2"`
c=$(python -c "import os; print os.path.commonprefix(['$bd1', '$bd2'])")
if [ $c == "/" ]; then
ln -s $(readlink -f "$1") "$2";
else
ln -s "$1" "$2";
fi
}
#
alias gnuplot='rlwrap -a -c gnuplot'
#LSCOLORS
#eval $(dircolors -b $HOME/dawn/LS_COLORS/LS_COLORS)
eval $(dircolors -b $HOME/.ls_colors)
alias top='top -u `whoami`'
#HISTORY SETTINGS
#export HISTFILE=~/.bash_history
#export HISTTIMEFORMAT="%Y-%m-%d.%T "
export HISTCONTROL=ignoredups:ignorespace
export HISTIGNORE='[ ]*:&:bg:fg:exit'
export HISTFILESIZE=100000000
export HISTSIZE=100000
shopt -s histappend #for multi-term
#export PROMPT_COMMAND="history -a; $PROMPT_COMMAND" #realtime history update, not after shell logout
#export PROMPT_COMMAND='hpwd=$(history 1); hpwd="${hpwd# *[0-9 :]* }"; if [[ ${hpwd%% *} == "cd" ]]; then cwd=$OLDPWD; else cwd=$PWD; fi; hpwd="${hpwd% ### *} ### $cwd"; history -s "$hpwd"'