-
Notifications
You must be signed in to change notification settings - Fork 5
/
.bash_aliases
90 lines (70 loc) · 2.49 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
alias vi="nvim"
if [ ! -z "${IS_LINUX:-}" ]; then
alias wezterm="flatpak run org.wezfurlong.wezterm"
fi
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
#alias ls="exa"
alias ll='ls -alF'
alias be="bundle exec"
alias bi="bundle install"
alias bo="bundle open"
alias bs="bundle show"
# Pretty-print JSON from STDIN
alias json="python -mjson.tool"
# Add an "alert" alias for long running commands. Use like so: sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
if ! command -v seq >/dev/null; then
# OS X didn't have "seq" (a la "for ii in `seq 1 10`; do ... done" for looping from 1 to 10.)
# Shim it instead. (TODO: Add skip as optional middle parameter, eg `seq 1 2 10` for 1 3 5...)
alias seq="ruby -e 'Range.new((ARGV[0].to_i), (ARGV[1].to_i)).each { |i| puts i }'"
fi
if [ "${IS_MAC:-}" ]; then
# Reset the sound when it sometimes goes to hell.
alias osxresetsound="sudo killall coreaudiod"
# Sometimes the Dock sticks around even when you're looking at a fullscreen'd app.
alias osxresetdock="killall Dock"
fi
if [ "${IS_LINUX:-}" ] && command -v ack-grep >/dev/null; then
# Debian has an inconvenient name for its ack.
alias ack="ack-grep"
fi
# Networking.
if [ "${IS_MAC:-}" ]; then
alias netconns="lsof -i | grep -E '(LISTEN|ESTABLISHED)'"
else
alias netconns="netstat -tapn"
fi
# Clipboard
if [ "${IS_LINUX:-}" ]; then
if command -v xclip>/dev/null; then
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
fi
fi
if [ "${IS_MAC:-}" ]; then
alias lsusb="ioreg -p IOUSB -w 0"
fi
# Disk
if [ "${IS_MAC:-}" ]; then
alias eject="diskutil eject" # disk device *or* mountpoint is fine here
fi
# Vim
vis() {
DIR="${1:-.}"
vim -S "${DIR}/Session.vim"
}
# Today's journal log (with yesterday's log in a split pane)
alias log='mkdir -p ~/logs && vim -O ~/logs/`date +%F`.txt ~/logs/`date -v-1d +%F`.txt'
### Elixir ###
alias ie="iex -S mix"
alias iep="iex -S mix phx.server"
### Searching ###
alias rgt="rg --type"
### Esoteric ###
alias trek="play -n -c1 synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120 gain +14" # Infinite starship engine noise. :D
alias weather="curl http://wttr.in/Sydney"
alias minprompt='export PS1="\w$(__git_ps1)\$ "'
alias keysmash='cat /dev/urandom | env LC_CTYPE=C tr -dc "asdfghjkl;" | fold -w 20 | head -n 1'
alias pomo="thyme -r -b"