small pixel drawing of a pufferfish dotfiles

Merge branch 'master' of git.cyberia.club:j3s/dotfiles
j3s j3s@c3f.net
Sat, 08 Feb 2020 18:42:22 -0600
commit

65fade64821f4fdbe7d135570bf3d2a4706b2a6f

parent

ea63c36e259dea2abfaa650fc25b0a5d88519126

3 files changed, 60 insertions(+), 0 deletions(-)

jump to
A bin/MACC02VK5ECHTD7/jws-fetch

@@ -0,0 +1,26 @@

+#!/bin/sh + +date=$(date +%s) +for r in us-east-1 us-west-2; do + for p in browse cgraph; do + for e in test stage prod; do + dir="/tmp/jws/${r}/${p}/${e}" + mkdir -p "$dir" + echo "Fetching ${r}/${p}/${e}" + aws ec2 describe-instances --profile "${p}_${e}" --region "$r" --output text --query "Reservations[*].Instances[*].{ + Instance:InstanceId, + Type:InstanceType, + AZ:Placement.AvailabilityZone, + Name:Tags[?Key==\`Name\`]|[0].Value, + pubIP:PublicIpAddress, + IP:PrivateIpAddress, + State:State.Name + }" | sed "s/$/ ${p}_${e}/" > "$dir/$date" & + # add profile to end for easy greppin' + # link current for other scripts + ln -fs "$dir/$date" "$dir/current" + done + done +done + +wait
A bin/MACC02VK5ECHTD7/jws-grep

@@ -0,0 +1,9 @@

+#!/bin/sh + +stuff=$(cat /tmp/jws/*/*/*/current) + +for i in $@; do + stuff=$(echo "$stuff" | grep -i $i) +done + +echo "$stuff"
A bin/MACC02VK5ECHTD7/jws-ssh

@@ -0,0 +1,25 @@

+#!/bin/sh +# input: us-east-1a 172.29.71.236 i-0a7eb3896d61b4d22 Krakencld-app-ASG-A running m5.large None browse_test +# ssh's to hosts listed from jws-grep output + +if ! [ -z "$1" ]; then + echo "This script cannot be used interactively" + exit 1 +fi + + +tmux set default-shell "/bin/sh" +# tmux new-window 'sleep 0.1' +while IFS='$\n' read -r i; do + ip=$(echo "$i" | awk '{print $2}') + tmux split-window "ssh $ip" + tmux select-layout tiled +done +tmux set -u default-shell +# tmux select-layout tiled +# tmux setw synchronize-panes on + +# todo? +# if one result, directly ssh +# if more than one result, do new window tmux madness +