Created
July 15, 2013 06:39
-
-
Save jcspencer/5997904 to your computer and use it in GitHub Desktop.
Check system internet connectivity. Add -m for minimal output. Add these files to your path and run online. :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
node ~/.dotfiles/bin/online.js $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var colors = require('colors') | |
var minimal = false; | |
if(process.argv.indexOf('-m') > -1) { | |
minimal = true; | |
} | |
require('dns').resolve('www.google.com', function(err) { | |
if(err) { | |
console.log(minimal ? 'false' : 'You are not connected to the internet!'.red.bold) | |
} else { | |
console.log(minimal ? 'true' : 'You are connected to the internet!'.green.bold) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment