small pixel drawing of a pufferfish dotfiles

Add jws utils
j3s j3s@c3f.net
Fri, 07 Feb 2020 17:17:11 -0600
commit

1b101697da37d5803a7a056d31e4a1cf8cbbf900

parent

f489d9764cc8102f89a770c770c37052f8d672c7

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 +