Skip to content

Instantly share code, notes, and snippets.

@nibalizer
Created September 20, 2012 23:31
Show Gist options
  • Select an option

  • Save nibalizer/3758958 to your computer and use it in GitHub Desktop.

Select an option

Save nibalizer/3758958 to your computer and use it in GitHub Desktop.
myping the thing to ping
#!/usr/bin/env python
import subprocess, commands
while True:
foo = commands.getoutput('ping -c 1 marine.cat.pdx.edu | grep "ms" | cut -d "=" -f 4')
# foo = sub.Popen("ping -c 1 marine.cat.pdx.edu")
# print foo
foo = foo.split(" ")[0]
#print "#"*int(float(foo)*100)
try:
print float(foo)
except ValueError:
print foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment