This program notifies you when Internet goes down and when it comes back up.
It pings Google's DNS every 4 seconds; when a ping fails it quickly tries a few more times and switches to downtime mode. When Internet is available again, the cycle restarts.
osascript(AppleScript, for the OSX notifications)
Remove lines with
osascript to make it compatible outside OS X