-
Notifications
You must be signed in to change notification settings - Fork 12
/
.bash_aliases
132 lines (108 loc) · 4.86 KB
/
.bash_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
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
# ~/.bash_aliases
## ALIASES ##
# Initialize
RC_LOADED+=($(basename $BASH_SOURCE))
[ ${BASH_VERSION:0:1} -gt 3 ] && echo "${RC_LOADED[-1]} loaded." >&2
## File system
# Make less more friendly for non-text input files, see lesspipe(1).
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
## Conversion
# Useful converting tools.
alias urldecode='sed "s@+@ @g;s@%@\\\\x@g" | xargs -0 printf "%b"'
type jq >/dev/null 2>&1 &&
alias urlencode='jq -rRs @uri' ||
alias urlencode='curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c3-'
# Other
# Find xdebug files.
#alias xt-files='egrep -o "/[^/]+:[0-9]+"'
## OSX
alias bypass="/System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass"
alias swap_on="sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist"
alias swap_off="sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist"
alias sql_istat='grep -oE "INTO `\w+`" | grep -oE "`\w+`" | sort | uniq -c | sort -nr'
alias kcrash_verbose='sudo nvram boot-args="-v keepsyms=y"'
alias DiskUtility_debug='defaults write com.apple.DiskUtility DUDebugMenuEnabled 1' # http://osxdaily.com/2011/09/23/view-mount-hidden-partitions-in-mac-os-x/
alias eject_force="diskutil unmountDisk force"
# Reload DNS on OSX
alias flushdns="dscacheutil -flushcache"
# Changes Terminal title.
alias title="printf '\033]0;%s\007'"
# Set Mac System Sleep Idle Time
alias systemsleep="sudo systemsetup -setcomputersleep"
alias startup="osascript -e 'tell application \"System Events\" to get name of every login item'"
alias kextstat_noapple='kextstat -kl | grep -v com.apple'
alias jobs_other='sudo launchctl list | sed 1d | awk "!/0x|com\.(apple|openssh|vix)|edu\.mit|org\.(amavis|apache|cups|isc|ntp|postfix|x)/{print $3}"'
alias git-svn='/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-svn'
alias unpause="pkill -CONT -u $UID"
alias trace-kernel="sudo fs_usage | grep -v 0.00"
alias disable-local-backups="sudo tmutil disablelocal"
alias enable-local-backups="sudo tmutil enablelocal"
## DTrace
alias trace-php='sudo dtrace -qn "php*:::function-entry { printf(\"%Y: PHP function-entry:\t%s%s%s() in %s:%d\n\", walltimestamp, copyinstr(arg3), copyinstr(arg4), copyinstr(arg0), basename(copyinstr(arg1)), (int)arg2); }"'
# Files opened by process.
alias trace-files="sudo dtrace -qn 'syscall::open*:entry { printf(\"%s %s\n\",execname,copyinstr(arg0)); }'"
# Syscall count by program.
alias trace-count-by-program="sudo dtrace -n 'syscall:::entry { @num[execname] = count(); }'"
# Syscall count by syscall.
alias trace-count-by-syscall="sudo dtrace -n 'syscall:::entry { @num[probefunc] = count(); }'"
# Syscall count by process.
alias trace-count-by-process="sudo dtrace -n 'syscall:::entry { @num[pid,execname] = count(); }'"
# Memcached
alias flush-memcache='echo flush_all > /dev/tcp/localhost/11211'
# Start/stop indexing on all volumes.
alias spotlight-off='sudo mdutil -a -i off'
alias spotlight-on='sudo mdutil -a -i on'
# Load/unload Spotlight Launch Daemons.
alias spotlight-unload='sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist'
alias spotlight-load='sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist'
# LINUX
# Open any file with the default command for that file
# alias open='xdg-open'
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
#
# Various
alias h='history | grep -- '
alias mv='mv -v'
alias rm='rm -v'
# One letter quickies:
alias p='pwd'
alias x='exit'
#
# Directories
alias play='cd ~/play/'
#
# Rails
#alias src='script/rails console'
#alias srs='script/rails server'
#alias raked='rake db:drop db:create db:migrate db:seed'
#alias rvm-restart='source '\''/home/durrantm/.rvm/scripts/rvm'\'''
#alias rrg='rake routes | grep '
#alias rspecd='rspec --drb '
#
# DropBox - syncd
#WORKBASE="~/Dropbox/97_2012/work"
#alias work="cd $WORKBASE"
#alias code="cd $WORKBASE/ror/code"
#
# DropNot - NOT syncd !
#WORKBASE_GIT="~/Dropnot"
#alias {dropnot,not}="cd $WORKBASE_GIT"
#alias {webs,ww}="cd $WORKBASE_GIT/webs"
#alias {setups,docs}="cd $WORKBASE_GIT/setups_and_docs"
#alias {linker,lnk}="cd $WORKBASE_GIT/webs/rails_v3/linker"
# Helper Drush/Drupal-related aliases
alias drush-dump7="drush sql-dump --ordered-dump --structure-tables cache,cache_filter,cache_menu,cache_page,history,sessions,watchdog --result-file=dump.sql"
alias vagrant-suspend-all="vagrant global-status | awk '/running/{print $1}' | gxargs -r -d '\n' -n 1 -- vagrant suspend"
#
# tmux
#alias {ton,tn}='tmux set -g mode-mouse on'
#alias {tof,tf}='tmux set -g mode-mouse off'