GNU/Linux ◆ alacritty ◆ bash 38 views

#!/usr/bin/env bash
# quickly run any of the breathing moos on moolist.com with tt++
# requires: curl, fzy (or fzf but update script), tt++
# https://asciinema.org/a/633014

set -euo pipefail

html_content=$(curl -s 'https://moolist.com/all.php')

telnet_uris=$(
  echo "$html_content"        |
    grep 'Up'                 | # breathing moos only
    grep -oP 'telnet://[^<]+' |
    sed "s/'>.*//"            |
    sed 's/telnet:\/\///'     |
    sort                      |
    uniq
)

selected_uri=$(echo "$telnet_uris" | fzy -l 50)

[[ -z $selected_uri ]] && exit 0

host=$(echo "${selected_uri}" | awk -F':' '{print $1}')
port=$(echo "${selected_uri}" | awk -F':' '{print $2}')
tt++ -e "#session moo {$host} {$port}"

$0

https://gist.github.com/shmup/d644711dc4ad4654a4c5b8b6563ec672