forked from ryanb/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaliases
executable file
·90 lines (72 loc) · 2.84 KB
/
aliases
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
#!/usr/bin/env bash
# Clear all aliases
unalias -a
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
# Fix my ls options
if [ -z `which gdircolors` ] ; then
if [ -z `which dircolors` ] ; then
false
else
eval `dircolors -b ~/.dir_colors` # -b for bash
fi
else
eval `gdircolors -b ~/.dir_colors` # -b for bash
fi
export LS_OPTIONS=" -CF "
if `ls --help 2>/dev/null | grep -q gnu` ; then
LS_OPTIONS="$LS_OPTIONS -SX -b -T 0"
if [ "$TERM" == "dumb" ] ; then false ; else LS_OPTIONS=" --color=auto $LS_OPTIONS" ; fi
fi
if [ "$MACHINE" == "OSX" ] && [ -d /usr/local/Cellar ] ; then
brew_prefix=/usr/local
source $HOME/.bash/brew_aliases
unalias printf # leave it at the system one
LS_OPTIONS="$LS_OPTIONS --color=auto -SX -b -T 0"
alias ls='gls $LS_OPTIONS'
fi
# Fix my less options
export LESS="-eFXir" # -r means 'show raw ctrl chars' -- makes output colored
alias more=less
# pretty ruby dox
export RI='-f ansi'
# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en1"
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
alias whois="whois -h whois-servers.net"
# Flush Directory Service cache
alias flush="dscacheutil -flushcache"
# View HTTP traffic
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
# Start an HTTP server from a directory
alias server="open http://localhost:8080/ && python -m SimpleHTTPServer 8080"
# Show/Hide hidden files in Finder
alias finder_hidden_show="defaults write com.apple.Finder AppleShowAllFiles -bool true && killall Finder"
alias finder_hidden_hide="defaults write com.apple.Finder AppleShowAllFiles -bool false && killall Finder"
# Show/Hide all desktop icons (useful when presenting)
alias finder_desktop_show="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
alias finder_desktop_hide="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
# # emacs from the commandline
# alias emacs="/usr/local/Cellar/emacs/HEAD/Emacs.app/Contents/MacOS/Emacs -nw"
####################### Configure Commands########################
# Other Env Vars
export PWD DISPLAY
# Tell CVS where it lives
export CVSROOT=:ext:[email protected]:/cvsroot/hola
export CVS_RSH=ssh
export RSYNC_RSH=ssh
# This changes the output of the "time" builtin
# grep for TIMEFORMAT in man bash
export TIMEFORMAT=$'\nreal\t%3lR\tuser\t%3lU\tsys\t%3lS\tpct\t%P'
# misc
alias reload='. ~/.bash_profile'
alias diff=colordiff