Skip to content

Instantly share code, notes, and snippets.

@palladius
Last active August 29, 2015 14:04
Show Gist options
  • Save palladius/9f9448985e7b9d735e7c to your computer and use it in GitHub Desktop.
Save palladius/9f9448985e7b9d735e7c to your computer and use it in GitHub Desktop.
#!/bin/bash
VER=1.0a
# This script extracts stats from previous one (latency-eu-us-script) and also publishes your public
# IP and the city you use script from.
# This part might not be super reliable, though.
#
# **Requires**
#
# 1. "latency-eu-us-script" which you can find ehre:
# https://gist.github.com/palladius/f382e6e4e4b15230725e
# RAW use: curl https://gist.githubusercontent.com/palladius/9f9448985e7b9d735e7c/raw/f4e9c21bc72b42be98c026b4997edbae56238920/extraxt-latency-stats | sh
#
# 2. "avg" script which you can find here:
# https://raw.githubusercontent.com/palladius/sakura/master/bin/avg
MYIP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
MY_CITY="$(lynx -dump http://www.ip-adress.com/ip_tracer/?QRY=$1|sed -nr s/'^.*My IP address city: (.+)$/\1/p')"
echo "= Statistics to access EU vs US datacenters (v$VER) ="
echo "My current IP is: $MYIP"
echo "My City is: $MY_CITY"
for DATACENTER in eu us; do
for PROTO in http https; do
for handler in fast slow; do
URL="$PROTO://$DATACENTER-ricc-test.appspot.com/$handler"
echo -en " + $DATACENTER-$PROTO-$handler: \t"
cat out/testricc-*/synoptic-*.txt | grep "$DATACENTER-$PROTO-$handler" | #| wc -l
awk '{print $2}' | avg | egrep ^avg
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment