Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rvagg's full-sized avatar

Rod Vagg rvagg

View GitHub Profile
/** Dependency: 'colors', `npm install colors` first **/
/**
*
* This file demonstrates some broken parts of NPM's API, in particular the use of
* outfd and logfd options. This module will span 4 child processes to run NPM via
* its API, first for npm.commands.search and then for npm.commands.install. The 4
* child processes use different outfd & logfd options:
* (1) stdout (i.e. `1`)
* (2) an actual file descriptor
@rvagg
rvagg / 2012-05-19-ender-roundup.md
Created May 19, 2012 04:10
DailyJS "Ender Roundup" #4, May 2012

layout: post title: "Ender Roundup: tablesort.js, Moment.js, jwerty, SelectNav.js, ender-events, ender-assert, Categorizr.js, Arbiter" author: Rod Vagg categories:

  • ender
  • frameworks
  • modules
  • libraries
  • time
function getTempImg(base64Image, filename, callback) {
var decodedImage = new Buffer(base64Image, 'base64');
var filename = 'cache/' + filename + '.jpg';
fs.writeFile(filename, decodedImage, function(err, data) {
console.log(data);
if (err) return callback(err);
callback(null, filename);
})
}
@rvagg
rvagg / gist:3936994
Created October 23, 2012 05:47
Australian npm package owners
DamonOehlman: Brisbane, Australia
cliffano: Melbourne, Australia
unnali: Melbourne, Australia
samcday: Brisbane, Australia
chriso: Sydney, Australia
z0w0: Australia
morganrallen: Sydney, Australia
anthonyshort: Newcastle, Australia
balupton: Sydney, Australia
deoxxa: Melbourne, Australia
@rvagg
rvagg / gist:3943404
Created October 24, 2012 02:45
npm CouchDB registry/_design/app
{
"_id": "_design/app",
"_rev": "607-6efd9a48552b62b0e2f52b1851589ea2",
"views": {
"updated": {
"map": "function (doc) {\n var l = doc[\"dist-tags\"].latest\n , t = doc.time && doc.time[l]\n if (t) emit(t, 1)\n}"
},
"listAll": {
"map": "function (doc) { return emit(doc._id, doc) }"
},
@rvagg
rvagg / .jshintrc
Created January 4, 2013 02:35
My .jshintrc as of January 2013
{
"predef": [ "assert", "refute", "define" ]
, "boss": true
, "bitwise": true
, "shadow": true
, "trailing": true
, "immed": true
, "latedef": true
, "forin": false
, "curly": false
@rvagg
rvagg / gist:4663748
Last active December 11, 2015 21:38 — forked from andrepadez/gist:4663588
Location = {
referencia: {
type: Number,
unique: true
},
owner: {
type: Schema.Types.ObjectId,
ref: 'Owner'
},
accounts: [
@rvagg
rvagg / make.markdown
Created February 11, 2013 00:29
node make -j X

Node master, 4 core CPU with plenty of RAM.

$ make clean >& /dev/null; ./configure >& /dev/null ; date; make -j 4 >& /dev/null; date; make clean >& /dev/null; ./configure >& /dev/null; date; make -j 25 >& /dev/null; date
Mon Feb 11 11:21:11 EST 2013
Mon Feb 11 11:22:58 EST 2013
Mon Feb 11 11:22:59 EST 2013
Mon Feb 11 11:24:23 EST 2013
@rvagg
rvagg / node_original_headers.js
Created February 15, 2013 11:37
Get the original headers from a Node HTTP request.
var http = require('http')
http.createServer(function (req, res) {
console.log('Original Headers:', req.socket._originalHeaders)
console.log('Messed up Headers:', req.headers)
res.end('BINGO')
})
.on('connection', function (socket) {
if (!socket.parser._onHeadersComplete)
socket.parser._onHeadersComplete = socket.parser.onHeadersComplete
@rvagg
rvagg / README.md
Last active April 21, 2024 08:33
Kindleberry "Paperwhite" Pi

Work in progress, I'll write this up properly when I'm done.

Almost all credit goes to @maxogden for putting me on to this and pointing me in the right direction for each of these items.

Prerequisites:

  • Raspberry Pi
  • Kindle Paperwhite freed from its locked down state (jailbroken) http://www.mobileread.com/forums/showthread.php?t=198446
    • You have to downgrade your Kindle to 5.3.1 to install the current jailbreak; that's just a matter of getting the old version image, putting it on your Kindle via USB and telling it to install "upgrade". Then you put in the Jailbreak files, load the ebook and break.
  • Your kindle will be quick to detect an upgrade is available so it'll want to upgrade soon afterwards but the jailbreak will last but you have to reinstall the developer certificates so it's a bit of a pain but doable. Find all the instructions on the mobileread.com forums and wiki.