Last active
August 29, 2015 14:07
-
-
Save ross-nordstrom/daaf8bfe9b1ca453c1ea to your computer and use it in GitHub Desktop.
Get ping, download, and upload speeds using Speedtest.net. Requires speedtest cli (https://github.com/sivel/speedtest-cli)
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 characters
#!/usr/bin/env ruby | |
require 'json' | |
speedtest = `speedtest-cli --simple` | |
updown = speedtest.split("\n") | |
bandwidthData = { | |
:Ping => updown[0].split(' ')[1].to_f/1000, | |
:Download => updown[1].split(' ')[1].to_f, | |
:Upload => updown[2].split(' ')[1].to_f | |
} | |
puts bandwidthData.to_json.gsub(/"/, "'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment