diff --git a/bash/.aliases b/bash/.aliases new file mode 100644 index 0000000..46d142b --- /dev/null +++ b/bash/.aliases @@ -0,0 +1,16 @@ +alias dc="docker-compose $argv" +alias dj="poetry run python manage.py $argv" +alias sysu="systemctl --user $argv" +alias fsync="find . -type f -name '*.sync-conflict*'" +alias vi="vim $argv" +alias dus="du -sh * | sort -h" +alias rhea="ssh rhea.local" +alias pandora="ssh pandora.unbl.ink" +alias bastion="ssh bastion.unbl.ink" +alias pull="git pull --rebase --autostash" +alias push="git push" +alias asso="aws sso login --profile $argv" +alias aeks="aws eks update-kubeconfig --name surepreme-sandbox-k8s-use1 --profile $argv" +alias bookpull="rsync --delete -avzichP root@rhea.local:/tank/books/ ~/.calibre/" +alias bookpush="rsync --delete -avzichP ~/.calibre/ root@rhea.local:/tank/books/" +alias chglg="git add ./changelog/ && git commit -m 'Add changelog' && git push" diff --git a/bash/.bashrc b/bash/.bashrc index 95110cd..294cbc3 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -3,6 +3,11 @@ [ -f ~/.fzf.bash ] && source ~/.fzf.bash +export GOPATH="$HOME/.go" +export PATH=$HOME/.bin:$HOME/var/bin:/usr/local/bin:$PATH:$HOME/.go/bin + +source "$HOME/.aliases" + ### 15Five Functions set-sts-env() { @@ -46,5 +51,3 @@ set-deploy-env() { set-pg-env() { source /home/powellc/src/github.com/15five/aws-cli-tooling/set-pg-env.sh } - - diff --git a/bin/.bin/onsubnet b/bin/.bin/onsubnet new file mode 100755 index 0000000..9225366 --- /dev/null +++ b/bin/.bin/onsubnet @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "" ]] ; then + printf "Usage:\n\tonsubnet [ --not ] partial-ip-address\n\n" + printf "Example:\n\tonsubnet 10.10.\n\tonsubnet --not 192.168.0.\n\n" + printf "Note:\n\tThe partial-ip-address must match starting at the first\n" + printf "\tcharacter of the ip-address, therefore the first example\n" + printf "\tabove will match 10.10.10.1 but not 110.10.10.1\n" + exit 0 +fi + +on=0 +off=1 +if [[ "$1" == "--not" ]] ; then + shift + on=1 + off=0 +fi + +regexp="^$(sed 's/\./\\./g' <<<"$1")" + +if [[ "$(uname)" == "Darwin" ]] ; then + ifconfig | grep -F 'inet ' | grep -Fv 127.0.0. | cut -d ' ' -f 2 | grep $1 +else + hostname -I | tr -s " " "\012" | grep -Fv 127.0.0. | grep $1 +fi + +if [[ $? == 0 ]]; then + exit $on +else + exit $off +fi + diff --git a/launchd/Library/LaunchAgents/homebrew.mxcl.postgresql@14.plist b/launchd/Library/LaunchAgents/homebrew.mxcl.postgresql@14.plist deleted file mode 100644 index 1ea2226..0000000 --- a/launchd/Library/LaunchAgents/homebrew.mxcl.postgresql@14.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - KeepAlive - - Label - homebrew.mxcl.postgresql@14 - LimitLoadToSessionType - - Aqua - Background - LoginWindow - StandardIO - System - - ProgramArguments - - /opt/homebrew/opt/postgresql@14/bin/postgres - -D - /opt/homebrew/var/postgresql@14 - - RunAtLoad - - StandardErrorPath - /opt/homebrew/var/log/postgresql@14.log - StandardOutPath - /opt/homebrew/var/log/postgresql@14.log - WorkingDirectory - /opt/homebrew - - diff --git a/ssh/.ssh/config b/ssh/.ssh/config index 04967ae..ce388f3 100644 --- a/ssh/.ssh/config +++ b/ssh/.ssh/config @@ -97,8 +97,13 @@ Host *.local *.service VerifyHostKeyDNS no ## Jail hosts all need a jump -Host *.local 192.168.40.* *.service +Match exec "onsubnet 192.168.40." host *.service User root IdentityFile ~/.ssh/jails Hostname %h - #ProxyJump bastion.unbl.ink + +Match exec "onsubnet --not 192.168.40." host *.service + User root + IdentityFile ~/.ssh/jails + Hostname %h + ProxyJump bastion.unbl.ink diff --git a/zsh/.zshrc b/zsh/.zshrc index 7fa4ab8..5178643 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -10,23 +10,8 @@ plugins=(git z fzf asdf direnv emacs yarn) source $ZSH/oh-my-zsh.sh - -# Example aliases -alias dj="poetry run python manage.py $argv" -alias sysu="systemctl --user $argv" -alias fsync="find . -type f -name '*.sync-conflict*'" -alias vi="vim $argv" -alias dus="du -sh * | sort -h" -alias rhea="ssh rhea.local" -alias pandora="ssh pandora.unbl.ink" -alias bastion="ssh bastion.unbl.ink" -alias pull="git pull --rebase --autostash" -alias push="git push" -alias asso="aws sso login --profile $argv" -alias bookpull="rsync --delete -avzichP root@rhea.local:/tank/books/ ~/.calibre/" -alias bookpush="rsync --delete -avzichP ~/.calibre/ root@rhea.local:/tank/books/" -alias chglg="git add ./changelog/ && git commit -m 'Add changelog' && git push" - +# See ~/.aliases for the various aliases seen in here +source "$HOME/.aliases" newemail () { curl -X POST --user colin@unbl.ink:$(pass personal/colin@unbl.ink | head -n 1) -d "address=$1@unbl.ink" -d "forwards_to=colin@unbl.ink" https://box.unbl.ink/admin/mail/aliases/add @@ -60,14 +45,13 @@ sush() { if [[ $1 == "sbx" ]] then asso sure-inc - aws eks update-kubeconfig --name surepreme-sandbox-k8s-use1 --profile sure-inc + aeks sure-inc kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash fi if [[ $1 == "qa" ]] then - asso np-farmers - aws eks update-kubeconfig --name farmers-qa-k8s-use1 --profile np-farmers + aeks np-farmers kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash fi @@ -79,6 +63,18 @@ sush() { fi } +roc() { + asso np-farmers + aeks np-farmers + kubectl port-forward $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) 5001:8080 +} + +portforward() { + asso np-farmers + aeks np-farmers + kubectl port-forward $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) $1:8080 +} + alias qa="sush qa" alias sbx="sush sbx" alias prod="sush prod" @@ -90,8 +86,8 @@ prep_pg_for_sure() { } refresh_sure_db() { echo "This will likely take about 10 minutes" - asso np-farmers - aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump + #asso np-farmers + #aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump dropdb -U sure surepreme --force createdb -U sure surepreme psql -U sure surepreme -c "CREATE EXTENSION postgis" @@ -111,3 +107,5 @@ export AWS_PROFILE=sure-inc local hostname="%{$fg_bold[white]%}%m" PROMPT="${hostname} ${PROMPT}" + +export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"