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 stream = require('stream') | |
module.exports = function(opts) { | |
opts = opts || { objectMode: true } | |
return function(fn) { | |
var s = new stream.Transform(opts) | |
s._transform = function (chunk, encoding, done) { |
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 bash | |
for i in $(seq 0 4 255); do | |
for j in $(seq $i $(expr $i + 3)); do | |
for k in $(seq 1 $(expr 3 - ${#j})); do | |
printf " " | |
done | |
printf "\x1b[48;5;${j}mcolour${j}\x1b[48;0;" | |
[[ $(expr $j % 4) != 3 ]] && printf " " | |
done | |
printf "\n" |
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 get(name) { | |
var c = arguments.callee.caller | |
while(c) { | |
if (c[name]) return c[name] | |
c = c.arguments.callee.caller | |
} | |
} | |
function set(name, value) { | |
var p = arguments.callee.caller |
Q. How available will my source files be for development and for runtime?
A. normalize
works like a browser. This value proposition should be the loudest on the site. Since people already understand how this works, it's a good mental gateway. The next thing people will ask is: "where are my files?". Since this is a radical departure from the existing workflow of downloading shit-tons of files and having even more copies of them everywhere, an explaination of how files get onto your disk and where they are kept would be great.
Q. What is the proxy and how does the proxy work?
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 level = require('level') | |
var net = require('net') | |
var mts = require('monotonic-timestamp') | |
var multilevel = require('multilevel') | |
var db = level('./db', { valueEncoding: 'json' }) | |
var cl = level('./cl', { valueEncoding: 'json' }) | |
var put = db.put | |
db.put = function(key, value, options, cb) { |
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
~/w/g/h/l/test (master) $ g++ -o bigdb ../deps/leveldb/libleveldb.a bigdb.cc -I../deps/leveldb/include/ -lpthread -std=gnu++11 | |
~/w/g/h/l/test (master) $ rm -rf testdb/ | |
~/w/g/h/l/test (master) $ time ./bigdb | |
524288 keys generated with 1024 bytes of random data in each value using 16 threads 2.99 real 3.19 user 2.87 sys | |
~/w/g/h/l/test (master) $ rm -rf testdb/ | |
~/w/g/h/l/test (master) $ time ./bigdb | |
524288 keys generated with 1024 bytes of random data in each value using 16 threads 2.60 real 3.01 user 2.90 sys | |
~/w/g/h/l/test (master) $ time ./bigdb | |
524288 keys generated with 1024 bytes of random data in each value using 16 threads 3.36 real 3.39 user 3.06 sys | |
~/w/g/h/l/test (master) $ time ./bigdb |
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
#include <iostream> | |
#include <iomanip> | |
#include <thread> | |
#include <string> | |
#include "leveldb/db.h" | |
#include "leveldb/write_batch.h" | |
using namespace std; |
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
A man in a hot air balloon realized he was lost. He reduced altitude and | |
spotted a woman below. He descended a bit more and shouted, "Excuse me, | |
can you help me? I promised a friend I would meet him an hour ago, but I | |
don't know where I am." | |
The woman below replied, "You're in a hot air balloon hovering | |
approximately 30 feet above the ground. You're between 40 and 41 degrees | |
north latitude and between 59 and 60 degrees west longitude." | |
"You must be an engineer," said the balloonist. "I am," replied the woman, |
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
/* | |
* To compile | |
* | |
* smpl net.cc | |
* | |
*/ | |
#include <net> | |
#include <through> |
OlderNewer