small pixel drawing of a pufferfish dotfiles

bin/MACC02VK5ECHTD7/jmass

#!/bin/bash
query="$1"
shift 2> /dev/null

text=$(
    printf "$*" | \
    sed -e 's/bpe/-p browse_prod -r us-east-1/g' | \
    sed -e 's/bpw/-p browse_prod -r us-west-2/g' | \
    sed -e 's/bse/-p browse_stage -r us-east-1/g' | \
    sed -e 's/bsw/-p browse_stage -r us-west-2/g' | \
    sed -e 's/bte/-p browse_test -r us-east-1/g' | \
    sed -e 's/btw/-p browse_test -r us-west-2/g' | \
    sed -e 's/cpe/-p cgraph_prod -r us-east-1/g' | \
    sed -e 's/cpw/-p cgraph_prod -r us-west-2/g' | \
    sed -e 's/cse/-p cgraph_stage -r us-east-1/g' | \
    sed -e 's/csw/-p cgraph_stage -r us-west-2/g' | \
    sed -e 's/cte/-p cgraph_test -r us-east-1/g' | \
    sed -e 's/ctw/-p cgraph_test -r us-west-2/g'
)

ips=$(awless list instances --filter state=running,name="$query" $text --format json | jq -r '.[] | [.PrivateIP] | .[]')

tmux set default-shell "/bin/sh"

tmux new-window 'sleep 0.1'
while IFS= read -r i
  do tmux split-window "ssh $i"
done <<< "$ips"

tmux set -u default-shell
tmux select-layout tiled
tmux setw synchronize-panes on