forked from jessfraz/mac-dev-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.helpers
66 lines (52 loc) · 1.95 KB
/
.helpers
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
# postgresql server
alias pgdown="pg_ctl -D /usr/local/var/postgres stop -s -m fast"
alias pgup="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start"
# ipython notebook
alias ipynb='ipython notebook --pylab=inline'
# python virtualenv
alias pyvirall='virtualenv venv --system-site-packages && source venv/bin/activate'
alias pyvir='virtualenv venv && source venv/bin/activate'
# vhosts
alias hosts='sudo vim /etc/hosts'
alias vhosts='sudo vim /etc/apache2/extra/httpd-vhosts.conf'
#copy working directory
alias cwd='pwd | tr -d "\r\n" | pbcopy'
# copy file interactive
alias cp='cp -i'
# move file interactive
alias mv='mv -i'
# untar
alias untar='tar xvf'
# Call from a local repo to open the repository on github/bitbucket in browser
function repo() {
local giturl=$(git config --get remote.origin.url | sed 's/git@/\/\//g' | sed 's/.git$//' | sed 's/https://g' | sed 's/:/\//g')
if [[ $giturl == "" ]]; then
echo "Not a git repository or no remote.origin.url is set."
else
local gitbranch=$(git rev-parse --abbrev-ref HEAD)
local giturl="http:${giturl}"
if [[ $gitbranch != "master" ]]; then
local giturl="${giturl}/tree/${gitbranch}"
fi
echo $giturl
open $giturl
fi
}
# Query Wikipedia via console over DNS
mwiki() { dig +short txt "$*".wp.dg.cx; }
# Get colors in manual pages
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
# Pipe my public key to my clipboard.
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"
# Pipe my private key to my clipboard.
alias prikey="more ~/.ssh/id_rsa | pbcopy | echo '=> Private key copied to pasteboard.'"