Skip to content

Instantly share code, notes, and snippets.

View brycebaril's full-sized avatar

Bryce Baril brycebaril

View GitHub Profile
@brycebaril
brycebaril / README.md
Created September 7, 2013 04:38 — forked from rvagg/README.md

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.
@brycebaril
brycebaril / protobuf.js
Created October 10, 2013 05:36
Run setup.js to create the file the other two use
var probuf = require("leveljs-coding/protobuf")
var fs = require("fs")
var concat = require("concat-stream")
var input = fs.createReadStream("buffs")
input.pipe(concat(function (buffer) {
var offset = 0
var blen = buffer.length
while (offset < blen) {
@brycebaril
brycebaril / hwm.js
Created October 29, 2013 05:31
Demonstrating how highWaterMark works with objectMode streams
var spigot = require("stream-spigot")
var through2 = require("through2")
var HWM = 10000
var limit = 40000
var count = 0
function gen() {
var record = (count++ < limit) ? {record: count} : null
this.push(record)
@brycebaril
brycebaril / baleet.js
Created November 7, 2013 23:50
BALEET
var client = require("redis").createClient()
var pattern = process.argv[2]
if (!pattern) throw new Error("Read codez for usage")
client.keys(pattern, function (err, keys) {
for (var i = 0; i < keys.length; i++) {
client.del(keys[i])
}
@brycebaril
brycebaril / s.js
Created December 18, 2013 05:33
poor-man's multibuffer-stream
var spigot = require("stream-spigot")
var through2 = require("through2")
var terminus = require("terminus")
var mb = require("multibuffer")
spigot(["aaaaaaaaaaa", "bbbbbbbbbbbb", "cccccccccccccccc"])
.pipe(through2(function (chunk, encoding, callback) {
this.push(mb.pack([chunk]))
callback()
}))
@brycebaril
brycebaril / index.js
Created March 14, 2014 22:19
requirebin sketch
// try requiring some modules from NPM and then hit Run
var s = require('stats-lite')
console.log(s.mean([0, 9, 100, 3, 51, 33, Math.random() * 20]))
@brycebaril
brycebaril / index.js
Created March 14, 2014 22:19
requirebin sketch
// try requiring some modules from NPM and then hit Run
var s = require('stats-lite')
console.log(s.mean([0, 9, 100, 3, 51, 33, Math.random() * 20]))
@brycebaril
brycebaril / index.js
Created March 14, 2014 22:19 — forked from max-mapper/index.js
requirebin sketch
var observer = require('continuous-observer')
var cave = require('cave-automata-2d')
var fill = require('ndarray-fill')
var zero = require('zeros')
var raf = require('raf')
var canvas = document.createElement('canvas')
var ctx = canvas.getContext('2d')
// Set up the controls, so that we can control
@brycebaril
brycebaril / index.js
Created March 15, 2014 20:45
requirebin sketch
/*
Browserify Live Demos!
How to make your own:
1. Clone this RequireBin
2. Adjust the REQUIRES section
3. Create a gist with demo snippets that can be run
4. Put the id for that gist into the demoGist variable
*/
/* REQUIRES: Put modules you need in your demo in this Array */
var levelup = require("levelup")
var leveljs = require("level-js")
var db = levelup("./demo", {db: leveljs})
db.put("wow", "mom", function (err, reply) {
if (err) return console.log(err)
db.get("wow", function (err, reply) {
if (err) return console.log(err)
console.log("Got: '%s'", reply)
})