Skip to content

Instantly share code, notes, and snippets.

View arminsabouri's full-sized avatar
🎯
Focusing

Armin Sabouri arminsabouri

🎯
Focusing
View GitHub Profile
@arminsabouri
arminsabouri / mu.sh
Created July 12, 2022 00:43
I take no credit. SSH tmux multiplexer
#!/usr/bin/env bash
set -exo pipefail
decs_insts=$(aws --region us-east-1 ec2 describe-instances)
ssh_list=($(echo $decs_insts | jq -r --arg match "${1}" '.Reservations[]|select(.Instances[]|select((.Tags[]|select(.Key=="Name")|.Value)|match($match)))|select(.Instances[]|select(.State|select(.Name=="running")))|.Instances[].PrivateIpAddress' | tr '\r\n' ' '))
split_list=()
for ssh_entry in "${ssh_list[@]:1}"; do