-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.aliases
70 lines (51 loc) · 2.38 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
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# List only directories
alias lsd='ls -l ${colorflag} | grep "^d"'
# Always use color output for `ls`
alias ls="command ls ${colorflag}"
# Colorize grep
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Enable aliases to be sudo’ed
alias sudo='sudo '
# Trim new lines
alias trimnewline="tr -d '\n'"
# ROT13-encode text. Works for decoding, too! ;)
alias rot13='tr a-zA-Z n-za-mN-ZA-M'
# URL-encode strings
alias urlencode='python3 -c "import sys, urllib.parse as ul; print(ul.quote_plus(sys.argv[1]));"'
alias urldecode='python3 -c "import sys, urllib.parse as ul; print(ul.unquote(sys.argv[1]));"'
# Merge PDF files
# Usage: `mergepdf -o output.pdf input{1,2,3}.pdf`
alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py'
# Ring the terminal bell, and put a badge on Terminal.app’s Dock icon
# (useful when executing time-consuming commands)
alias badge="tput bel"
# Intuitive map function
# For example, to list all directories that contain a certain file:
# find . -name .gitattributes | map dirname
alias map="xargs -n1"
# Useful for ephemeral hosts
alias ssh-ignore='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"'
alias scp-ignore='scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"'
alias json2yaml="python -c 'import sys, yaml, json; yaml.safe_dump(json.load(sys.stdin), sys.stdout, default_flow_style=False)'"
alias yaml2json="python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)'"
alias sleepsafe='sudo pmset -a destroyfvkeyonstandby 1 hibernatemode 25'
alias sleepfast='sudo pmset -a hibernatemode 0'
alias sleepdefault='sudo pmset -a hibernatemode 3'
alias gpg-rekey='gpg-connect-agent "scd serialno" "learn --force" /bye'
alias ip='ip -brief -color'
alias journal='${VISUAL:-${EDITOR:-vi}} ~/wiki/journal/$(date -I).md'
alias config='/usr/bin/env git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
alias wg-tunnels='for filename in /var/run/wireguard/*.name; do echo $(basename ${filename%.*}): $(sudo cat $filename); done'
alias wg-quick='sudo WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun-cli WG_SUDO=1 wg-quick'