Skip to content
View scrub.js
#!/usr/bin/env node
var minimist = require('minimist')
var argv = minimist(process.argv.slice(2), {
alias: { i: 'ignore' },
string: [ 'ignore' ]
})
var to = require('to2')
var ignore = [].concat(argv.ignore)
var osmdb = require('osm-p2p')
View hmac_capability_system.md

hmac capability system

We can use HMACs to implement a distributed capability system.

var crypto = require('crypto')

var rootkey = crypto.randomBytes(32)
var propkey1 = hmac(rootkey, 'propname1')
var propkey2 = hmac(rootkey, 'propname2')
View hyperdrive.js
var level = require('level')
var hyperdrive = require('hyperdrive')
var db = level('/tmp/whatever.db')
var drive = hyperdrive(db)
var link = Buffer(process.argv[4], 'hex')
var archive = drive.createArchive(link, { live: true })
//console.log(archive.key.toString('hex'))
if (process.argv[2] === 'write') {
View digest.js
var hyperdrive = require('hyperdrive')
var memdb = require('memdb')
var drive = hyperdrive(memdb())
var archive = drive.createArchive({ live: true })
console.log(archive.key.toString('hex')) // stays the same
var digests = {}
commit0(function () {
commit1(function () {
View drive.js
var hyperdrive = require('hyperdrive')
var level = require('level')
var db = level('/tmp/test.db')
var drive = hyperdrive(db)
var cmd = process.argv[2]
var link = process.argv[3]
if (link) link = Buffer(link, 'hex')
View neocities_headers.txt
$ curl https://mafintosh.neocities.org -i
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 17 May 2016 09:56:06 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Cached: EXPIRED
<body>
View drive.js
var hyperdrive = require('hyperdrive')
var memdb = require('memdb')
var drive = hyperdrive(memdb())
var archive = drive.createArchive()
archive.createFileWriteStream('hello.txt').end('BEEP BOOP\n')
archive.finalize(function () {
archive.createFileReadStream('hello.txt').pipe(process.stdout)
})
View server.js
var router = require('routes')();
router.addRoute("GET /articles/:title?", function (req, res, params) {
// perform some IO...
res.end('article content goes here...\n');
});
router.addRoute("POST /articles/:title", function (req, res, params) {
// perform some IO...
res.setHeader('content-type', 'text/plain');
res.end('updated ' + params.title + '\n');
View hyperlog-kdb-index leveldb benchmark
5000 records written in 13.717 seconds
364 records per second
-----
replicated in 15.951 seconds
313 records per second
View before.c
float diric (float n, float x);
vec3 hsl2rgb (float h, float s, float l);
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
float x = fragCoord.x - 400.0;
float y = fragCoord.y - 800.0;
float t = iGlobalTime*2.0;
float z = 200.0 - (1.0 + sin(t/20.0)) / 20.0 * 40.0;
float z0 = 350.0 - (1.0 + sin(t/20.0)) / 2.0 * 40.0;
Something went wrong with that request. Please try again.