Last active
August 29, 2015 14:02
-
-
Save deadc/3233df6f5afba5153598 to your computer and use it in GitHub Desktop.
Revisions
-
deadc revised this gist
Jun 10, 2014 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,10 +7,12 @@ SERVERS="http://bashtech.net/twitch/ingest.php" function _best_twlt { for SERVER in $(w3m -dump ${SERVERS}|grep RTMP|grep -oE 'live-.*.twitch.tv'); do LATENCY=$(sudo -i hping -q -c 2 -S -p 80 ${SERVER} 2>&1 | grep -oE '^round-trip.*' | awk '{print $4}' | cut -d '/' -f 2) SRVLT="${LATENCY}:${SERVER}\n${SRVLT}" done BESTLT=$(echo -e ${SRVLT}|sort|awk NF|head -n 1) BESTSV=${BESTLT##*:} BESTLT=${BESTLT%%:*} } -
deadc created this gist
Jun 10, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/usr/bin/env bash # $ Script to check best Twitch server available. # Needs hping / w3m SERVERS="http://bashtech.net/twitch/ingest.php" function _best_twlt { for SERVER in $(w3m -dump ${SERVERS}|grep RTMP|grep -oE 'live-.*.twitch.tv'); do LATENCY=$(sudo -i hping -q -c 2 -S -p 80 ${SERVER} 2>&1 | grep -oE '^round-trip.*' |awk '{print $4}' | cut -d '/' -f 2) SRVLT="${LATENCY}:${SERVER}\n${SRVLT}" done BESTLT=$(echo -e ${SRVLT}|sort|awk NF|head -n 1) BESTSV=${BESTLT##*:} BESTLT=${BESTLT%%:*} } _best_twlt echo "The best server of Twitch right now is ${BESTSV} with ${BESTLT} ms"