-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases
117 lines (94 loc) · 4.53 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
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
#!/usr/bin/env bash
alias npx='npx --yes'
alias am='amplify'
alias codemod='npx --yes @next/codemod'
alias cp='cp -i'
alias cl='clear'
alias create-svelte-app='npx --yes degit sveltejs/template'
alias prettier='npx --yes prettier'
alias grep="GREP_COLOR='1;32' grep --color"
alias ls='lsd'
alias la='lsd -la --group-dirs first --date relative --size short'
alias lt='lsd --tree --ignore-glob node_modules --ignore-glob .git'
alias mv='mv -i'
alias nest='npx --yes @nestjs/cli'
alias pip='pip3'
alias ppp='pnpm'
alias ppx='pnpm dlx'
alias rm='rm -i'
alias tw='twilio'
alias lzg='lazygit'
alias lzd='lazydocker'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
alias update-dotfiles='git -C ~/dotfiles pull origin master'
alias lvimrc='lvim ~/dotfiles/config/lvim/config.lua'
alias zshrc='lvim ~/dotfiles/zshrc'
alias fnm='fnm2'
alias ag='ag --path-to-ignore ~/dotfiles/.agignore'
alias killhasura='kill -9 $(lsof -ti:9695)'
alias dl='cd ~/Downloads'
alias dt='cd ~/Desktop'
alias mp='cd ~/Projects'
alias dc='docker-compose'
alias dcrun='docker-compose run --rm'
alias npmlist='npm list --location=global --depth=0'
alias ngrok='~/Applications/ngrok'
alias openlocal='ngrok http --region=us --hostname=ants.ngrok.io' # -region=eu -subdomain=sa -host-header=rewrite 3000'
alias redis='redis-cli'
# For golang development
alias air='~/.local/bin/air'
alias luamake='~/.config/lua-language-server/3rd/luamake/luamake'
alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
# Control mongodb
alias startmongo='mongod --config /Users/sangdth/.local/mongodb/mongod.conf'
alias stopmongo='killall mongod'
alias findmongo='lsof -iTCP -sTCP:LISTEN | grep mongod'
# Control spotlight
alias togglespotlight='sudo mdutil -a -i off'
alias upgradenvm='curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash'
# Get my current IP addresses
alias myip="dig TXT +short o-o.myaddr.l.google.com @ns1.google.com"
# Get ip of local network
alias localip="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# Show active network interfaces
alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"
# View HTTP traffic
alias sniff="sudo grep -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 \/.*\""
# Canonical hex dump; some systems have this symlinked
command -v hd > /dev/null || alias hd="hexdump -C"
# macOS has no `md5sum`, so use `md5` as a fallback
command -v md5sum > /dev/null || alias md5sum="md5"
# macOS has no `sha1sum`, so use `shasum` as a fallback
command -v sha1sum > /dev/null || alias sha1sum="shasum"
# JavaScriptCore REPL
jscbin="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc";
[ -e "${jscbin}" ] && alias jsc="${jscbin}";
unset jscbin;
# Recursively delete `.DS_Store` files
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
# Empty the Trash on all mounted volumes and the main HDD.
# Also, clear Apple’s System Logs to improve shell startup speed.
# Finally, clear download history from quarantine. https://mths.be/bum
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'"
# Show/hide hidden files in Finder
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
# 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"
# URL-encode strings
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it
alias plistbuddy="/usr/libexec/PlistBuddy"
# Airport CLI alias
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'
# One of @janmoesen’s ProTip™s
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
alias "$method"="lwp-request -m '$method'"
done
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec $SHELL -l"
# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'