forked from TheHitchhiker/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_profile
122 lines (102 loc) · 4.7 KB
/
.bash_profile
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
# alias ssbg='/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background'
#export PATH=/usr/local/bin:$PATH # /usr/local/bin is already in the PATH
#export PATH=~/bin:$PATH:/usr/texbin # See pathadd() below
# alias rot13='~/bash/rot13.bash'
# alias manGrowlNotify='man /usr/local/man/man1/growlnotify.1'
alias ..='cd ..'
export EDITOR=/usr/bin/vim
alias tarmake='tar -cpzf'
alias untar='tar -xzf'
alias netusage='lsof -P -i -n | cut -f 1 -d " " | uniq'
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
alias realias="$EDITOR ~/.bash_profile; . ~/.bash_profile"
alias ralias='. ~/.bash_profile'
alias mou='open -a Mou'
alias pdflatex='pdflatex -halt-on-error'
# Rename the tmux window according to the new directory.
if [ $(uname -m) == 'armv6l' ]; then JO_DIRABBREV=~/.dotfiles/bin/dirabbrev-rpi
else JO_DIRABBREV=~/.dotfiles/bin/dirabbrev; fi
function cd() { builtin cd "$@"; (tmux rename-window $($JO_DIRABBREV) >/dev/null 2>&1;) }
# Add an item to $PATH without duplicating it
pathadd() { if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then PATH="${PATH:+"$PATH:"}$1"; fi }
pathadd ~/bin
pathadd /usr/texbin
pathadd /Library/usr/texbin
pathadd /usr/local/texlive/2015/bin/x86_64-darwin
pathadd /Applications/LilyPond.app/Contents/Resources/bin
# RPi? Raw git. Have hub (new version of gh)? Use hub Have gh? Use gh. Otherwise, use raw git.
if ! hash brew 2>/dev/null; then
alias git='git'
elif hash hub 2>/dev/null; then
alias git='hub'
elif hash gh 2>/dev/null; then
alias git='gh'
fi
function gitignore() { curl http://www.gitignore.io/api/$@ ;}
# iTerm 2 only
# growl() { echo -e $'\e]9;'${1}'\007' ; return ; }
# Minecraft Server
function mcServer {
tmux new -s Bukkit "cd ~/Documents/minecraft/publicServer/; java -Xmx2G -Xms1G -jar craftbukkit.jar --log-append true --log-count 5 --log-limit 100000 $*; echo -n 'Exit? '; read -n 1"
}
function mcServerRam {
tmux new -s Bukkit "cd ~/Documents/minecraft/publicServer/; java -Xmx$1 -Xms$2 -jar craftbukkit.jar --log-append true --log-count 5 --log-limit 100000; echo -n 'Exit? '; read -n 1"
}
alias mcClient='tmux attach -t Bukkit'
function mcRestore {
BACKUP_VOL=/Volumes/Misc
BACKUP_DIR=$BACKUP_VOL/rdiffPublicServerBackups
if [ -d $BACKUP_VOL ]; then
BUP=$1
if [ -n $1 ]; then
echo No backup specified, using latest
BUP=0B
fi
echo External disk mounted, commencing restore
# ${$1:-0B} is $1, defaulting to '0B' if unset or empty
rdiff-backup --force -r $BUP $BACKUP_DIR /Users/josh/Documents/minecraft/publicServer
echo Restore complete\!
else
echo External disk not mounted, no backup made
fi
}
#alias unzipMc='cd ~/Downloads && mkdir mctmp; cd mctmp && jar xf ~/Library/Application\ Support/minecraft/bin/minecraft.jar'
#alias zipMc='cd ~/Downloads/mctmp && rm -r META-INF && jar uf ~/Library/Application\ Support/minecraft/bin/minecraft.jar ./'
alias killMc='killall JavaApplicationStub'
alias forceKillMc='killall -9 JavaApplicationStub'
# NPM
alias pushNpmVersion='git push && git push --tags && npm publish'
# tmux
alias tnew='tmux new -s'
alias tattach='tmux attach -t'
# coding
# alias gitstats='/Users/josh/bash/gitstats/gitstats'
# alias gitstats-zipper='gitstats /Users/josh/Documents/coding/cocoa/Zipper/ /Users/josh/bash/gitstats-output/Zipper && open "file:///Users/josh/bash/gitstats-output/Zipper/index.html"'
# alias gitstats-quizzer='gitstats /Users/josh/Documents/coding/cocoa/Quizzer/ /Users/josh/bash/gitstats-output/Quizzer && open "file:///Users/josh/bash/gitstats-output/Quizzer/index.html"'
# rdiff-backup
# alias backupThumb='echo JOSHO3; rdiff-backup /Volumes/JOSHO3 /Volumes/Misc/thumbdrivebups/rdiff/JOSHO3'
# bup
#export BUP_DIR=/Volumes/Misc/bup
#export BUP_DIR=/Volumes/Shared/People/Josh/ThumbDrives/bup2
export BUP_DIR=/Users/josh/Documents/ThumbDriveBup
alias backupThumb='echo JOSHO3; bup index /Volumes/JOSHO3 && bup save -n JOSHO3 /Volumes/JOSHO3/'
# brew completion (don't try without homebrew installed)
# -f tests for regular file, it is a symlink on OS X, so -e
if hash brew 2>/dev/null && [ -e $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Misc
function pidof {
# sort to get oldest (lowest pid), the highest pid gets the pid of the grep process
ps -A | sort | grep -m1 $1 | awk '{print $1}'
}
# brew-cask
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
# travis completion
[ -f /Users/josh/.travis/travis.sh ] && source /Users/josh/.travis/travis.sh
# ignore case with completion
bind "set completion-ignore-case on"
# ensure ssh-agent is available
#eval $(ssh-agent)
# promptline (only on OS X with homebrew present)
test -f ~/.dotfiles/.promptline.sh && hash brew 2>/dev/null && source ~/.dotfiles/.promptline.sh