/
.aliases
66 lines (48 loc) · 2.6 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
# Navigation
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias -- -='cd -'
# Kubernetes
alias k='kubectl'
alias ksys='kubectl -n kube-system'
# URLs
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
# Current bitcoin value
alias bitcoin='curl -s https://api.cryptowat.ch/markets/summaries | jq ".result.\"kraken:btceur\".price.last"'
# cURL
alias curltime="curl -w \"\nConnect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n\""
# Recursively delete `.DS_Store` files
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
# Docker
alias doc="docker-compose"
alias doce="docker-compose exec"
# Golang list imports recursively in a project
alias golist='go list -f "$(printf '"'"'{{.ImportPath}}:\n{{range .Imports}} {{.}}\n{{end}}'"'"')" ${1+"$@"}'
# DNS
alias dnsclear="dscacheutil -flushcache && sudo killall -HUP mDNSResponder"
# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en7"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# Lock screen when going AFK
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
# Hide/show all desktop icons (useful when presenting)
alias hidedesktop='defaults write com.apple.finder CreateDesktop -bool false && killall Finder'
alias showdesktop='defaults write com.apple.finder CreateDesktop -bool true && killall Finder'
# Network interfaces
alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"
# Copies public key to clipboard
alias pubkey="cat ~/.ssh/id_rsa.pub | pbcopy | echo '-> Public key copied to clipboard.'"
# Starts a timer
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
# Updates macOS applications and updates Homebrew packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup'
# Merge some PDFs, usage: pdfmerge file1.pdf file2.pdf
alias pdfmerge='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py -o output.pdf'
# Generates a localhost certificate (localhost.key and localhost.crt)
alias genlocalhostcert='openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj ''/CN=localhost'' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")'