Skip to content

Instantly share code, notes, and snippets.

@lmchawla
Last active March 30, 2018 04:58
Show Gist options
  • Save lmchawla/51f15e4c1191f69947eb8e03ed41d0cc to your computer and use it in GitHub Desktop.
Save lmchawla/51f15e4c1191f69947eb8e03ed41d0cc to your computer and use it in GitHub Desktop.
Screamer for mac, keep working while it informs when internet is down and back online. Accommodates sensitivity for erratic connections
import os
import time
working = 0
while True:
response = os.system("ping -c 1 8.8.8.8")
print(response, working)
if response == 0:
working = max(1, working + 1)
time.sleep(5)
else:
working = min(-1, working - 1)
time.sleep(0.1)
if working == 5:
os.system("say 'net AA gA yaaa'")
if working == -3:
os.system("say 'net cha la gA yaaa'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment