-
Notifications
You must be signed in to change notification settings - Fork 0
/
.develenv
278 lines (229 loc) · 7.11 KB
/
.develenv
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# vim:ft=sh:
## Random useful stuff
alias ls='ls --color'
PROXY_INDT=172.18.216.7
#PS1="\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}$ "
alias vncn9="vncviewer ${N92_IP}:0"
alias psgrep='ps aux | grep '
alias fgrep='find|grep --exclude="*~" --exclude="*.swp"'
alias sendpatch='arc diff --reviewers lmoura,tullio,luck,hugopl,dakerfp,lacerda,setanta,sergio,zanoni HEAD~1'
alias reattach-tmux='tmux attach -tprogramming'
export ZBAR=/home/nick/apm-2012/apps/buscape/zbar-0.10
export BUSCAPE=/home/nick/apm-2012/apps/buscape/git-repo/searchfoot
alias zxing=/home/nick/apm-2012/apps/buscape/zxing-2.0/cpp/build/zxing
alias zbarimg=/home/nick/apm-2012/apps/buscape/zbar-0.10/build/zbarimg/zbarimg
export EDITOR=vim
export VISUAL=vim
export NODE_PATH=/usr/local/lib/node_modules
export PATH=~/.bin:~/local/bin:$PATH
export MUCURA="nick@mucura.local"
#icecc_setup
export USE_SCHEDULER=10.60.69.53
function icecc_setup {
#export ICECC_VERSION=$HOME/.icecc/linux-x86_64-gcc4.6.3-x86_64.tar.gz
#export ICECC_VERSION=$HOME/.icecc/linux-x86_64-gcc4.8.1-x86_64.tar.gz
export ICECC_VERSION=$HOME/.icecc/linux-x86_64-gcc4.7.3-x86_64.tar.gz
export CCACHE_PREFIX=icecc
for i in gcc g++ cc c++; do
ln -sf /usr/bin/ccache $HOME/bin/$i
done
}
#nix-related
WEBKIT=$HOME/projects/webkit-nix
if [ -f $WEBKIT/nix-env.sh ]; then
export WEBKIT
. $WEBKIT/nix-env.sh
fi
alias vim='vim -c "set columns=$COLUMNS"'
export RPI_NICK=pi@10.60.69.52
#alias vim='vim -c "set columns=$COLUMNS"'
alias ssh-diegoyam-server='ssh server-amazon -i ~/key_amazon_server.pem'
# Create a ssh reverse tunnel to my amazon cloud server
reverse_tunnel_server() {
ssh -R 30000:localhost:22 server-amazon
}
# When using git-svn to manipulate a svn repo
# through git tool, the SVN tags are not automatically
# imported as GIT tags, instead, the svn tagas are
# initially git remote branches
#
# This functions tranforms those svn tags in actual
# git tags
git_import_svn_tags() {
if [ "x$1" = "x--do-it" ]; then
DO_IT=1
fi
git for-each-ref --format="%(refname:short) %(objectname)" refs/remotes/tags |
while read BRANCH REF; do
TAG_NAME=${BRANCH#*/}
BODY="$(git log -1 --format=%s $REF)"
#echo "ref=[$REF] parent=[$(git rev-parse $REF^)] tagname=[$TAG_NAME] branch=[$BRANCH]" >&2
echo "git tag -a -m \"$BODY\" $TAG_NAME $REF^"
echo "git branch -r -d $BRANCH"
if [ ! -z $DO_IT ]; then
git tag -a -m "$BODY" $TAG_NAME $REF^
git branch -r -d $BRANCH
fi
done
if [ -z $DO_IT ]; then
echo ##################################
echo Only showing what to do!
echo To actually do that run: $0 --do-it
echo ##################################
fi
}
# git completion in Arch
if [ -f /usr/share/git/completion/git-completion.bash ]; then
. /usr/share/git/completion/git-completion.bash
fi
# Enables a (already xrandr configured) second monitor,
# to see current configured outputs:
#
# $ xrandr -q
#
# usage: enable_display [<XRANDR_OUTPUT_ID>]
# Running Wayland
if [ ! -z $WAYLAND_DISPLAY ]; then
export DISPLAY_MAIN='XWAYLAND0'
export DISPLAY_AUX='XWAYLAND1'
export DISPLAY_AUX='XWAYLAND2'
else
# Running Xorg
export DISPLAY_MAIN='LVDS1'
export DISPLAY_AUX1='VGA1'
export DISPLAY_AUX2='HDMI1'
fi
MODE_DISPLAY_AUX="1440x900"
enable-display-aux1() {
xrandr --output $DISPLAY_AUX1 --mode $MODE_DISPLAY_AUX $@
}
enable-display-aux2() {
xrandr --output $DISPLAY_AUX2 --mode $MODE_DISPLAY_AUX $@
}
enable-display-main() {
xrandr --output $DISPLAY_MAIN --auto $@
}
disable_display() {
OUTPUT_ID=$1
[ -z $OUTPUT_ID ] && OUTPUT_ID=$DISPLAY_AUX1
xrandr --output $OUTPUT_ID --off
}
alias disable-display-main="disable_display $DISPLAY_MAIN"
alias disable-display-aux1="disable_display $DISPLAY_AUX1"
alias disable-display-aux2="disable_display $DISPLAY_AUX2"
fix_resolution_main_monitor() {
xrandr --newmode "1440x900" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
xrandr --addmode $DISPLAY_MAIN "1440x900"
xrandr --output $DISPLAY_MAIN --mode "1440x900"
}
fake-arrange-displays() {
echo xrandr \
--output $DISPLAY_AUX2 --mode "$MODE_DISPLAY_AUX" --primary \
--output $DISPLAY_AUX1 --mode "$MODE_DISPLAY_AUX" --right-of $DISPLAY_AUX2 \
--output $DISPLAY_MAIN --auto --right-of $DISPLAY_AUX1
}
arrange-displays() {
case $1 in
0)
disable-display-aux2 && sleep 1 &&
enable-display-main --right-of $DISPLAY_AUX1;;
1)
enable-display-aux1 --left-of $DISPLAY_MAIN && sleep 1 &&
disable-display-main && sleep 1 &&
enable-display-aux2 --left-of $DISPLAY_AUX1;;
*)
xrandr --output $DISPLAY_AUX2 --left-of $DISPLAY_AUX1 \
--output $DISPLAY_AUX1 --left-of $DISPLAY_MAIN \
--output $DISPLAY_MAIN --auto;;
esac
}
reset_findsrc_dir() {
export FINDSRC_DIR='.'
}
reset_findsrc_dir
findsrc() {
DIR='.'
[ -z $FINDSRC_DIR ] && DIR=$PWD
find $DIR | grep "$1.c\$\|$1.cpp\$\|$1.h\$"
}
grepsrc() {
grep $@ `find -name "*[.cpp,.h]"`
}
export POWERLINE_PATH="$HOME/.local/lib/python2.7/site-packages/powerline"
#. $POWERLINE_PATH/bindings/bash/powerline.sh
# replacing something in several files
#cat /tmp/xxxxx | xargs -I '{}' sed -i 's/RenderPartObject {IFRAME}/RenderIFrame {IFRAME}/g' {}
alias grep="grep --exclude='*~' --exclude='*.swp'"
alias remove_colors='sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"'
alias pjson='json | pygmentize -l json'
# open vim session
v() {
local arg=`test -z $1 || echo -S ~/.vim/sessions/$1`
vim $arg
}
_vim_sessions() {
local cur prev sessions
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
sessions=$([ -d ~/.vim/sessions ] && basename -a `ls ~/.vim/sessions`)
COMPREPLY=( $(compgen -W "${sessions}" -- ${cur}) )
return 0
}
complete -F _vim_sessions v
remove_from_path() {
local p d dirs
dirs=$@
for d in $dirs; do
p=`echo $PATH | sed -e "s,:$d,,"`
export PATH=$p
done
}
# Set $verbose_env var to see debug messages
# from env scripts
#verbose_env=on
tools_dir=$HOME/devtools
if [ -d ~/.tools-env.d ]; then
for env_script in ~/.tools-env.d/*.sh; do
if [ -r $env_script ]; then
. $env_script
fi
done
unset i
fi
proj_dir=$HOME/projects
if [ -d ~/.projects-env.d ]; then
for env_script in ~/.projects-env.d/*.sh; do
if [ -r $env_script ]; then
. $env_script
fi
done
unset i
fi
#export curr_proj_build_dir=$src_drunk_clt/build
export curr_proj_build_dir="$src_ibmo_tool/.build/linux"
export curr_proj_target="Msys-x86_64"
unset tools_dir
unset proj_dir
screenshot() {
local file="$HOME/Pictures/screenshot-`date +'%b-%d-%y_%H:%M:%S'`.jpg"
echo "## Select the screen region."
echo "## Will save it in $file"
gm import "$file" && nautilus "$file"&
}
get_external_ip() {
curl -s http://whatismyip.org/ | grep -oP '(\d{1,3}\.){3}\d+'
}
bashrc-reload() {
source ~/.bashrc
}
alias load-ssh-keys='eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_rsa_2016'
alias image-dimensions="identify -format \"%i -> %w x %h\n\" $@"
trust-key() {
local key=$1
gpg --recv-key $key
gpg --lsign $key
}
set-window-title() {
which wmctrl || { echo "Error! 'wmctrl' not installed!"; return 1; }
wmctrl -r :ACTIVE: -N "$1"
}