Skip to content

Instantly share code, notes, and snippets.

@devilholk
Created May 24, 2016 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devilholk/397049a5f4a4f98d11459c1686d6c8ab to your computer and use it in GitHub Desktop.
Save devilholk/397049a5f4a4f98d11459c1686d6c8ab to your computer and use it in GitHub Desktop.
timestamp_ping.py
import re, sys, time
t = re.compile(r'time=(.*?) ms')
line = True
while line:
line = sys.stdin.readline()
r = tuple(t.finditer(line))
if len(r) == 1:
print(time.time(), r[0].group(1))
sys.stdout.flush()
#ping ping.sunet.se -i 5 | python ~/timestamp_ping.py | tee ~/sunet_ping_ts.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment