-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmybashrc.bash
executable file
·172 lines (120 loc) · 4.11 KB
/
mybashrc.bash
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
#!/bin/bash
# set -x
# From https://askubuntu.com/a/22257/333952
confirm() {
echo -n "Do you want to run $*? [N/y] "
read -N 1 REPLY
echo
if test "$REPLY" = "y" -o "$REPLY" = "Y"; then
"$@"
else
echo "Cancelled by user"
fi
}
export PATH=$PATH:~/bin/
export PATH=$PATH:~/bin/local/
export PATH=$PATH:~/bin/gitTools/
. ~/bin/ps1git.bash
. ~/bin/.git-prompt.sh
alias parseMultiLineInsert="sed \'s$),($),\n($g\'"
export BC_ENV_ARGS=~/.bcrc
alias usage='find . -mindepth 1 -maxdepth 1 -print0 | xargs -0 du -s | sort -n -r -k 1'
alias usageFiilesOnly='find . -maxdepth 3 -type f -print0 | xargs -0 du | sort -nrk 1'
alias mv='mv -vi'
alias cp='cp -vi'
alias bc='bc -l'
export PS1="\h $PS1"
export TMOUT=43200
export EDITOR=vi
export TERM=xterm-256color # For tmux & vim compatibilty
gcd() {
cd `git rev-parse --show-toplevel`
}
gpwd() {
git rev-parse --show-toplevel | tr -d '\n'
}
# To see git log from all branches. You can specify a file after
gitChangesAllBranches="git log --all --" #From https://stackoverflow.com/a/7466798/1611925
# git deploy steps
alias gitDeployStep1_updateMaster='git checkout master && git pull'
alias gitDeployStep2_mergeFromToDeploy='confirm "git merge toDeploy && git push && git checkout release && git pull"'
alias gitDeployStep3_mergeFromMasterAndDeploy="confirm bash -c 'git merge master && git push && rvmDo cap production deploy'"
echo "gitDeploySteps have been set, might want to try them"
fn='-mutt-clearlyu-medium-r-normal--0-0-100-100-p-0-iso10646-1'
alias alert="xmessage -fn $fn -nearmouse"
echo $DISPLAY > ~/.currentDisplay
which dropbox > /dev/null && ((! dropbox running) || dropbox status)
alias newBranch='git checkout --track '
alias clipboard='xsel --clipboard'
# For ssh agent fowrading in bash
# From https://gist.github.com/martijnvermaat/8070533#gistcomment-1317075
if [[ -S "$SSH_AUTH_SOCK" && ! -h "$SSH_AUTH_SOCK" ]]; then
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock;
fi
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock;
alias firefox-reboot='untilDone.bash firefox; firefox'
PROMPT_COMMAND='echo -en "\033]0; $("hostname")@$("pwd") \a"'
alias battery=acpi
function settitle() {
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$*\a\]"
PS1=${ORIG}${TITLE}
}
alias set-title=settitle
function railsConsole() {
TITLE="\[\e]2;console\a\]"
PS1=${ORIG}${TITLE}
bash --login -c 'rvm default do rails c'
}
case "$-" in
*i*)
echo -n "Tab name: "
read tabName
if [[ ! -z "$tabName" ]]; then
if [[ ! -z "$TMUX" ]]; then
tmux rename-window "$tabName"
else
settitle $tabName;
fi
fi
;;
esac
#alias rvmDo='rvm default do'
function rvmDo() {
if which rvm > /dev/null; then
rvm default do "$@"
else
toRun="$@"
toRun="rvm default do $toRun"
bash --login -c "$toRun"
fi
}
alias rmvDo='echo No rmvDo. I think you meant rvmDo'
#alias findSortByDate='find . -printf "%T@ %Tc %p\n" | sort -n'
#alias findSortBySize='find . -type f -exec du -h {} + | sort -r -h'
alias filesBySize="find . -type f -ls -printf '\0' | sort -zk7n | tr -d '\0'"
alias railsConsole="bash --login -c 'rvm default do rails c'"
alias dimForNight=redshift
alias removeSpaces="rename -v -e 's/ /_/g' "
alias renameSpaces=removeSpaces
alias removeSpacesOld="rename -v 's/ /_/g' "
alias whatIsMyIp="wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'"
alias dnsReset="sudo /etc/init.d/dns-clean restart; sudo /etc/init.d/networking force-reload"
alias addColumn="paste -sd+ | bc"
alias stopFirefox='killall -g -STOP firefox'
alias continueFirefox='killall -g -CONT firefox'
alias firefoxStop=stopFirefox
alias firefoxContinue=continueFirefox
alias dockerReset='docker-compose down; docker rm -f $(docker ps -a -q); docker volume rm $(docker volume ls -q)'
alias dockerLs="docker container ls"
alias htmlToPng=cutycapt
#Diables shell suspension: https://unix.stackexchange.com/a/12108/159862
stty -ixon
echo TMOUT set to `echo $TMOUT/'(60*60)' | bc | cut -d. -f 1` hours
umask 027
echo
echo umask set to `umask`
echo
shopt -s direxpand