-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc_osx
142 lines (117 loc) · 3.55 KB
/
zshrc_osx
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#
#
# (macOS only)
#
# Nice ls
alias ls="ls -Galh"
alias l="ls -Glh"
export PATH=~/bin:$PATH
export PATH=/usr/local/bin:$PATH
# --Rust--
export PATH=$HOME/.cargo/bin:$PATH
source $HOME/.cargo/env
# --Go--
export GOPATH=$HOME/c/go
export PATH=$PATH:$GOPATH/bin
export GOROOT=`go env GOROOT` # b/c installed via Homebrew
export PATH=$PATH:$GOROOT/bin
# --Pip bins--
export PATH=$HOME/.local/bin:$PATH
# -- AWS --
export AWS_SDK_LOAD_CONFIG=1
# -- Nvm --
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# Set up a Go project for contribution.
# $1 - the origin of the package, e.g. "github.com/spf13/hugo"
# $2 - the name of the package in the fork, e.g. "hugo"
#
# usage: gohack github.com/sigstore/cosign cosign
export GHUSER="trevrosen"
gohack (){
echo "[-] Getting package $1"
go get $1
pushd $GOPATH/src/$1
echo "[-] Creating fork environment for $2"
git remote rename origin upstream
git remote add origin git@github.com:$GHUSER/$2
git fetch --all
echo "[-] Setting up main"
git branch main --set-upstream-to origin/main
git checkout main
git checkout -b upstream-main --track upstream/main
echo "[-] Done!"
popd
}
# Use netcat to check for a listener on a given host and port
# $1 - host
# $2 - port
# usage: chkport localhost 32769
chkport (){
nc -zv $1 $2
}
# Easily jump into Go packages
gocd () { cd `go list -f '{{.Dir}}' $1` }
# --Editor stuff--
export EDITOR="nvim"
export GIT_EDITOR="nvim"
alias n="nvim"
alias v="nvim"
alias m="mvim --remote-silent"
# --Laziness--
alias pingoo="ping 8.8.8.8"
alias scrum="m ~/.scrumlog.txt"
alias listening="lsof -i -P | grep -i 'listen'"
alias gohub="cd ~/c/github.com"
alias codehub="cd ~/c/github.com"
alias tf="terraform"
alias fast="networkQuality -v" # like fast.com
alias update="softwareupdate -l" # update all software
alias pip="pip3"
alias python="python3"
# -- Git --
alias gl="git log --color --graph --decorate"
alias gp="git push"
alias gc="git checkout"
alias gd="git diff"
alias gs="git status"
alias gpr="git pull --rebase"
alias gcommit="git commit -a -s"
alias gforce="git push --force-with-lease"
# -- Containers/Clusters --
#alias docker="podman"
alias d="docker"
alias drmc="docker ps --filter status=exited -q | xargs docker rm"
alias dregistry="docker run -d -p 5000:5000 --restart=always --name registry registry:2"
alias drit="docker run -it"
alias k="kubectl"
# oras config - https://oras.land/
export ORAS_CACHE=~/.oras/cache
# ko default to local repo
export KO_DOCKER_REPO=localhost:5000
# OpenSSL from Homebrew
alias brewssl="/opt/homebrew/opt/openssl@3/bin/openssl"
# VSCode Insiders
alias inside="code-insiders"
# -- Zsh working like Vi --
# ((remember to set up the vi-mode in the plugins line in ~/.zshrc))
# ctrl-r starts searching history backward
# Vi mode
bindkey -v
bindkey '^r' history-incremental-search-backward
# Drop the timeout for switching between modes
export KEYTIMEOUT=1
source $HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# -- MANUAL STEPS --
## Source this file in the default .zshrc
# echo "\n\n# Personal config\nsource ~/.dotfiles/zshrc_osx\n" >> ~/.zshrc
#
## Ensure aliases work in non-interactive shells like Vim
# ln -s $HOME/.zshrc $HOME/.zshenv
#
# Install materialshell-oceanic.itermcolors from this repo into iTerm
#
## -- Make key repeating not suck --
# defaults write -g InitialKeyRepeat -int 12
# defaults write -g KeyRepeat -int 3