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 | |
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" | |
let secs=$((${upSeconds}%60)) | |
let mins=$((${upSeconds}/60%60)) | |
let hours=$((${upSeconds}/3600%24)) | |
let days=$((${upSeconds}/86400)) | |
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"` | |
# get the load averages | |
read one five fifteen rest < /proc/loadavg |
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
ln -s ~/Dropbox/Library/Preferences/com.googlecode.iterm2.plist.lockfile com.googlecode.iterm2.plist.lockfile | |
ln -s ~/Dropbox/Library/Preferences/com.googlecode.iterm2.plist.lockfile com.googlecode.iterm2.plist.lockfile |
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
$(function(){ | |
var socket = io.connect('http://localhost:8080'); | |
socket.on('tweet', function(tweet) { | |
$('body').append('<div class="tweet">' + tweet.text + '</div>'); | |
}); | |
}); |
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
var http = require('http'); | |
var pool = require('generic-pool').Pool({ | |
name : 'http_request', | |
create : function(callback) { | |
var c = http.createClient(80, '127.0.0.1'); | |
callback(null, c); | |
}, | |
destroy : function(client) { }, | |
max : 10, |
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
var request = require('request') | |
, JSONStream = require('JSONStream') | |
, es = require('event-stream') | |
var parser = JSONStream.parse(['rows', true, 'value') //emit parts that match this path (any element of the rows array) ---- Try added true after value | |
, req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'}) | |
, logger = es.mapSync(function (data) { //create a stream that logs to stderr, | |
console.error(data) | |
return data | |
}) |
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
// Ever needed to escape '\n' as '\\n'? This function does that for any character, | |
// using hex and/or Unicode escape sequences (whichever are shortest). | |
// Demo: http://mothereff.in/js-escapes | |
function unicodeEscape(str) { | |
return str.replace(/[\s\S]/g, function(character) { | |
var escape = character.charCodeAt().toString(16), | |
longhand = escape.length > 2; | |
return '\\' + (longhand ? 'u' : 'x') + ('0000' + escape).slice(longhand ? -4 : -2); | |
}); | |
} |
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
aardvark | |
aardwolf | |
aaron | |
aback | |
abacus | |
abaft | |
abalone | |
abandon | |
abandoned | |
abandonment |
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
var app = require('express')() | |
, server = require('http').createServer(app) | |
, express = require('express') | |
, http = require('http') | |
, port = 3000; | |
/* | |
* Express : Configure |
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
//get image with request and pipe it to client. | |
var http = require('http'); | |
var request = require('/usr/local/share/npm/lib/node_modules/request'); | |
var server = http.createServer(function (req, res) { | |
request.get('http://www.1up.com/images/Elements/carouselNav.png').pipe(res); | |
}); | |
server.listen(8000); |
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
var fs = require('fs') | |
, http = require('http') | |
, util = require('util') | |
, path = require('path') | |
, Combinatorics = require('./combinatorics.js').Combinatorics | |
, request = require('request') | |
, ipContainer = [], url2Test, ipContainer2 = [] | |
, cmb = Combinatorics.permutation(['0','1','8','16','46','74','96','106','109','126','127','186','192','255'], 4); | |
cmb = cmb.toArray(); |