Skip to content

Instantly share code, notes, and snippets.

View pennig's full-sized avatar
🧠
Thinkin' 'bout stuff

Matt Pennig pennig

🧠
Thinkin' 'bout stuff
  • Slack
  • Twin Cities, MN
View GitHub Profile

Keybase proof

I hereby claim:

  • I am pennig on github.
  • I am pennig (https://keybase.io/pennig) on keybase.
  • I have a public key whose fingerprint is 16FD 0B25 48BA 5040 F040 779F EE72 B6A8 9459 87BD

To claim this, I am signing this object:

@pennig
pennig / gist:1797222
Created February 11, 2012 06:25
Read my cable modem's status page, and store as JSON into a txt file
require 'nokogiri'
require 'json'
require 'time'
require 'timeout'
def parse
doc = Nokogiri::HTML(`curl -s http://admin:password@192.168.100.1/cgi-bin/ConnectionCgi`)
error_log = Nokogiri::HTML(`curl -s http://admin:password@192.168.100.1/cgi-bin/EventLogCgi`)
tables = doc.css('td table')
function convert(text) {
var word = /^\w/,
tag = /^\s*<(a|b|i|strong|em|cite)([ \=\'\"\w\-\/\.\:]+)*>/i,
tokens = text.split('\n'), token, src = [];
for (var i=0, len=tokens.length; i < len; i++) {
token = tokens[i];
if (word.test(token) || tag.test(token)) {
src.push('<p>' + token + '</p>');