-
Notifications
You must be signed in to change notification settings - Fork 1
/
funcs.zsh
64 lines (49 loc) · 1.66 KB
/
funcs.zsh
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
if command -v nvim > /dev/null; then
alias vim=nvim
fi
alias gitprune="git remote prune origin"
alias dockerrmdangling="docker images --filter 'dangling=true' -q | xargs docker rmi"
alias pg="gist -pc"
alias pubkey="cat ~/.ssh/id_ed25519.pub | pbcopy | echo 'Public key copied to pasteboard.'"
# If the last character of the alias value is a blank, then the next command
# word following the alias is also checked for alias expansion. This makes sudo
# work correctly with aliases.
alias sudo='sudo '
alias gack='ack --ignore-dir=vendor --ignore-dir=testdata --ignore-dir=mocks'
alias gt='go test ./...'
who-listen() {
lsof -t -i :$1
}
# OSX only.
if [ $(uname -s) = "Darwin" ]
then
alias fixau=sudo killall -9 appleeventsd
alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder"
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
# This makes open work in tmux.
alias open="reattach-to-user-namespace open"
alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"
fi
notes() {
base=$HOME/notes
dirname=$base/$(date +'%Y/%m-%b')
filename=$(date +'%b-%d-%Y.md')
mkdir -p $dirname
cd $base
vim $dirname/$filename
}
gitclose() {
BRANCH=$(git rev-parse --abbrev-ref HEAD)
(git checkout master || git checkout main || git checkout prod) && git pull && git branch -d $BRANCH
}
# K8s
alias k=kubectl
alias kgp="kubectl get pods"
alias kdp="kubectl describe pod"
alias kgn="kubectl get nodes"
alias kc=kubectx
alias kns=kubens
jl() {
jq -r -R '. as $raw | try fromjson catch $raw'
}