Skip to content

Instantly share code, notes, and snippets.

@hiroshiro
Created September 8, 2017 16:52
Show Gist options
  • Save hiroshiro/47ab686ab3457d86749b5e08d6b24617 to your computer and use it in GitHub Desktop.
Save hiroshiro/47ab686ab3457d86749b5e08d6b24617 to your computer and use it in GitHub Desktop.
One liner speed test by ping
function lan_speed_one_liner
set -l host $argv[1]
set -l datasize $argv[2]
printf "password: "
read -l pass
echo $pass | sudo -S ping -c 10 -s $datasize $host | grep avg | cut -d\/ -f5 | awk '{print $1/1000}' | awk '{print 120000/$1}' | awk '{print $1*8/1024/1024"Mbps"}'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment