[ssh] Cleaning up shells and ssh configurablility when not at home
This commit is contained in:
16
bash/.aliases
Normal file
16
bash/.aliases
Normal file
@ -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"
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
33
bin/.bin/onsubnet
Executable file
33
bin/.bin/onsubnet
Executable file
@ -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
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>Label</key>
|
||||
<string>homebrew.mxcl.postgresql@14</string>
|
||||
<key>LimitLoadToSessionType</key>
|
||||
<array>
|
||||
<string>Aqua</string>
|
||||
<string>Background</string>
|
||||
<string>LoginWindow</string>
|
||||
<string>StandardIO</string>
|
||||
<string>System</string>
|
||||
</array>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/opt/homebrew/opt/postgresql@14/bin/postgres</string>
|
||||
<string>-D</string>
|
||||
<string>/opt/homebrew/var/postgresql@14</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/opt/homebrew/var/log/postgresql@14.log</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/opt/homebrew/var/log/postgresql@14.log</string>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/opt/homebrew</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -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
|
||||
|
||||
42
zsh/.zshrc
42
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"
|
||||
|
||||
Reference in New Issue
Block a user