Skip to content

Instantly share code, notes, and snippets.

@rondale-sc
Created January 3, 2013 18:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rondale-sc/4445960 to your computer and use it in GitHub Desktop.
Save rondale-sc/4445960 to your computer and use it in GitHub Desktop.
class TestConnection
def repeat_test
while true do
if packet_loss > 0
`say 'link down'`
end
end
end
def packet_loss
ping_google.split(",").last =~ /(\d+\.\d+)\%/
$1.to_i
end
def ping_google
`ping -t 5 -q google.com`
end
end
if __FILE__ == $0
tc = TestConnection.new
tc.repeat_test
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment