-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc-personal
155 lines (132 loc) · 5.5 KB
/
.bashrc-personal
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
has() {
type "$1" &> /dev/null
}
#----------------------------------Personal to this computer
# export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}/Applications/MATLAB/MATLAB_Compiler_Runtime/v83/runtime/maci64:/Applications/MATLAB/MATLAB_Compiler_Runtime/v83/sys/os/maci64:/Applications/MATLAB/MATLAB_Compiler_Runtime/v83/bin/maci64:
export ECLIPSE_HOME=/Users/blu/Desktop/Software/eclipse
#export PATH=$PATH:/usr/local/opt/go/libexec/bin
if has go; then
export GOPATH=$HOME/ws/go
export PATH=$PATH:$(go env GOPATH)/bin
fi
#-------------- personal aliases
alias rm='echo "Please use rmtrash! (superrmrm for normal rm)"'
alias brew='HOMEBREW_NO_AUTO_UPDATE=1 brew'
alias ampl='/Users/blu/Documents/amplide-demo/ampl'
alias o='figlet -cw'`tput cols`
alias cpwd='echo -n $(pwd) | pbcopy'
alias diff='colordiff' # install colordiff package :) -------------Installed using brew install colordiff
alias mount='mount |column -t' #7: Make mount command output pretty and human readable format
# misc
#alias gce='gcutil --service_version="v1" --project="velvety-renderer-404" ssh --zone="us-central1-a" "base-instance"'
# Proxy stuff
alias proxywifion='sudo networksetup -setsocksfirewallproxystate Wi-Fi on' #on / off
alias proxywifioff='sudo networksetup -setsocksfirewallproxystate Wi-Fi off' #on / off
# Show/Hide Hidden files in Finder
alias showhidden='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
alias hidehidden='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'
#alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
# compile latex
function mklatex {
#local tempdir=/Users/blu/ws/comptex
if [[ ! $@ =~ .*\.tex ]]; then echo $@ ' is not TeX file!'; return; fi
local tempdir=comptex
mkdir $tempdir/
latexmk -bibtex -output-directory=$tempdir -pdf -interaction=nonstopmode $@ 2>&1 | grep --color=auto "Error\|Warning\|Run"
echo makeindex $tempdir/${@%.tex}.nlo -s $tempdir/nomencl.ist -o $tempdir/${@%.tex}.nls
# makeindex $tempdir/${@%.tex}.nlo -s nomencl.ist -o $tempdir/${@%.tex}.nls
# latexmk -silent -bibtex -output-directory=$tempdir -pdf $@
# Outputing
local cwd=${PWD##*/}
cp "$tempdir/${@%.tex}.pdf" "${cwd}.pdf"
open "${cwd}.pdf"
}
# rsync
function rsink {
if [ "${#}" -ne 2 ]; then
echo "Need a two directories"
else
rsync -aPvv --ignore-existing ${1} ${2}
rsync -aPvv --ignore-existing ${2} ${1}
fi
}
function srsink {
if [ "${#}" -ne 2 ]; then
echo "Need a two directories"
else
rsync -aPvv --ignore-existing -e ssh ${1} ${2}
rsync -aPvv --ignore-existing -e ssh ${2} ${1}
fi
}
function nzproxy {
ssh -ND 9876 mezap &
proxywifion
read -p "Press enter to turn off proxy: "
proxywifioff
fg
}
function pwdx {
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}'
}
#---------------------- Matlab
#alias matlabterm='/Applications/MATLAB_R2014b.app/bin/matlab -nojvm -nodisplay -nosplash'
#alias matlabtermjvm='/Applications/MATLAB_R2014b.app/bin/matlab -nodesktop -nosplash'
#function matlab {
# if [ "${#}" -lt 1 ]; then
# matlabterm
# else
# cat "$@" | matlabterm
# fi
#}
#function jmatlab {
# if [ "${#}" -lt 1 ]; then
# matlabtermjvm
# else
# cat "$@" | matlabtermjvm
# fi
#}
# ------------------------------------Convert video to mp3 using vlc
function convertVideos {
# list=$(find /path/to/some/files/ -mindepth 3 -maxdepth 3 -name '*.dat')
#for file in /Users/blu/Music/Assorted\ Stuff/Videos/*.flv; do # edit this!!!
local VLC=~/Applications/VLC.app/Contents/MacOS/VLC
for file in "${@}"; do # edit this!!!
#/Applications/VLC.app/Contents/MacOS/VLC -I dummy "$file" --sout="#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst=\"$(echo "$file" | sed 's/\.[^\.]*$/.mp3/')\"}" vlc://quit
$VLC -I dummy "$file" --sout="#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst=\"$(echo "$file" | sed 's/\.[^\.]*$/.mp3/')\"}" vlc://quit
done
}
# ------------------------------------ Tmux script
function createPanes {
local SESSION=dev
tmux new-session -d -s $SESSION
tmux new-window -t $SESSION:1 -n 'test'
tmux select-window -t $SESSION:1
tmux split-window -h
tmux send-keys 'echo "hi"' C-m
tmux attach -t $SESSION
}
# -------------------------------------------------------- Quick add bash aliases
function addbashfunc {
# I'm not sure what this line is doing, but I think I need it, however its like 500ms to run soooo in func it goes
set -o history -o histexpand
if [ "${#} " -ne 1 ]; then
echo "Need a single aliasname"
else
echo "alias ${1}='"$TEMPCMD"'" >> ~/.bashrc-personal
fi
}
alias addbash='TEMPCMD="$(history -p !!)"; addbashfunc'
# ---------------------------------------------------------------------------Git completion
#source ~/codes/git-completion.bash
#-----------------------------------------------------------------------------RVM
#export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
#----------------found on: http://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html
#export PATH="$PATH:/Users/blu/Library/Android/sdk/platform-tools"
#export ANDROID_HOME=/Users/blu/Library/Android/sdk/
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
has rg && export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git" 2> /dev/null'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# Homebrew sbin
#export PATH="/usr/local/sbin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"