Skip to content

Instantly share code, notes, and snippets.

View Frando's full-sized avatar
💭
.

Franz Heinzmann Frando

💭
.
View GitHub Profile
const tape = require('tape')
const hypercore = require('hypercore')
const ram = require('random-access-memory')
const { runAll, replicate } = require('./lib/util')
const { Kappa } = require('..')
const createIndexer = require('../sources/hypercore-sparse')
const topics = ['red', 'blue', 'green', 'yellow']

Keybase proof

I hereby claim:

  • I am Frando on github.
  • I am Frando (https://keybase.io/frando) on keybase.
  • I have a public key whose fingerprint is 6672 052F 6DF2 AC7E 2948 CB40 5CDC 80F9 A1AF ED95

To claim this, I am signing this object:

@Frando
Frando / package.json
Last active August 9, 2019 09:31
hyperswarm local replication test
{
"name": "hyperswarm-replication-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@hyperswarm/replicator": "^1.1.0",
NANOBENCH version 2
> /usr/bin/node bench.js
# write fs 5000 * 4K sequentially
ok ~262 ms (0 s + 261710236 ns)
# write hyperdrive 5000 * 4K sequentially
ok ~3.65 s (3 s + 653388561 ns)
# write client 5000 * 4K sequentially
@Frando
Frando / battery-warn.service
Last active February 19, 2019 17:17
Warn & hibernate on low battery
# put this in ~/.config/systemd/user/battery-warn.service
# and adjust the line in exec-start
[Unit]
Description=Battery warning
[Service]
Type=oneshot
Environment="DISPLAY=:0" "XAUTHORITY=/home/bit/.Xauthority"
ExecStart=/home/.../battery.sh
@Frando
Frando / schema.proto
Last active February 8, 2019 00:26
"hyperclock" schema proposal
message Entry {
message Feed {
required bytes key = 1;
}
message Feeds {
repeated Feed feeds = 1;
optional Feed contentFeed = 2;
}
@Frando
Frando / example.js
Last active March 24, 2018 12:43
smoosh-stream
var flatten = require('.')
var bulk = require('bulk-write-stream')
var stream = bulk.obj(flatten(write))
function write(batch, cb) {
batch.forEach(function(obj) {
console.log(obj)
})
cb(null)
@Frando
Frando / index.js
Created March 23, 2018 18:46
hyperdrive & hypergraph in same hyperdb
var hyperdb = require('hyperdb')
var sub = require('subhyperdb')
var hyperdrive = require('hyperdrive')
var hypergraph = require('hyper-graph-db')
var hyperdriveMessages = require('hyperdrive/lib/messages')
var dbName = process.argv[2]
var op = process.argv[3]
if (op !== 'read' && op !== 'write') {