Skip to content

Instantly share code, notes, and snippets.

View dominictarr's full-sized avatar

Dominic Tarr dominictarr

View GitHub Profile
{ '@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519': 'wx.larpa.net:8008:@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519',
'@D0GsAaMyt96Ze3q1YiiuzWhPkyou2fVTUgw8Xr+G7Jo=.ed25519': '9ithub.com:8008:@D0GsAaMyt96Ze3q1YiiuzWhPkyou2fVTUgw8Xr+G7Jo=.ed25519',
'@dBQlwh9Gtr3i5YMOGtIOKtGNVepeu+nyb6KGl1vtOcM=.ed25519': 'sp9.solarpunk.dk:8008:@dBQlwh9Gtr3i5YMOGtIOKtGNVepeu+nyb6KGl1vtOcM=.ed25519',
'@SP4xNZmDsOuRrjDS6NCcmr3xoieXQOMPBQ4TkUHSJ2M=.ed25519': 'sp4.solarpunk.dk:8008:@SP4xNZmDsOuRrjDS6NCcmr3xoieXQOMPBQ4TkUHSJ2M=.ed25519',
'@BzMp3eRNjPUonwRd/0loT3KaRKIMFx7ZOZQE1F+XDug=.ed25519': 'sbot.ktorn.com:8008:@BzMp3eRNjPUonwRd/0loT3KaRKIMFx7ZOZQE1F+XDug=.ed25519',
'@eM4e8pmRiZpeCBitqp6vq3lT8EwC5UjjKuajHbpWnNI=.ed25519': '198.199.97.80:8008:@eM4e8pmRiZpeCBitqp6vq3lT8EwC5UjjKuajHbpWnNI=.ed25519',
'@YXquIbh1OqCCdMuqCO4tSJuYR7RL811CTuu59n7G0pk=.ed25519': 'post.tableflip.io:8008:@YXquIbh1OqCCdMuqCO4tSJuYR7RL811CTuu59n7G0pk=.ed25519',
'@nSCVHJ5OSajcynWgo3Xh0bChZN3e4oV1ooIuFWdxrmg=.ed25519': 'hub.devcontr
"data:application/octet-stream;base64,AGFzbQEAAAAByQM0YAABf2AEf39/fwBgAX8AYAAAYAF/AX9gA39/fwF/YAJ/fwBgCn9/f39+f35/f38Bf2ACf34AYAl/f39+f35/f38Bf2AJf39/fn9/fn9/AX9gCX9/f39+f35/fwF/YAR/f35/AX9gA39/fgBgBH9/fn8AYAJ/fwF/YAZ/f39+f38Bf2AHf39/fn9/fwF/YAV/f35/fwF/YAZ/f35/f38Bf2ADf39/AGABfwF+YAN/f38BfmAEf39/fwF/YAN/f34Bf2ACfn8BfmAFf39/f38AYAZ/f39/fn8AYAV/f39/fwF/YAJ+fgF+YAx/f39/f39/f39/f38Bf2AHf35/fn9+fwF/YAV/f35+fwF/YAR/fn9/AX9gCH9+f35/fn9/AX9gBn9/fn5/fwF/YAN/fn8Bf2AIf39/f35/fn8Bf2AIf39/f39+f34Bf2AFf39/fn8Bf2AGf39/fn9/AGAFf39/fn8AYAR/fn9/AGAFf39+f38AYAZ/f35/f38AYAZ/f35/fn8AYAR/f39+AGAHf39/f39/fwF/YAh/f39/f39/fwF/YAt/f39/f39/f39/fwF/YAZ/f39/f38Bf2AKf39/f39/f39/fwF/AosCDQNlbnYORFlOQU1JQ1RPUF9QVFIDfwADZW52CFNUQUNLVE9QA38AA2VudgZtZW1vcnkCAYACgAIDZW52BXRhYmxlAXAAAANlbnYNZW5sYXJnZU1lbW9yeQAAA2Vudg5nZXRUb3RhbE1lbW9yeQAAA2VudhdhYm9ydE9uQ2Fubm90R3Jvd01lbW9yeQAAA2Vudg5fX19hc3NlcnRfZmFpbAABA2VudgtfX19zZXRFcnJObwACA2VudgZfYWJvcnQAAwNlbnYXX2Vtc2NyaXB0ZW5fYXNtX2NvbnN0X2kABANlbnYWX2Vtc2NyaXB0ZW5fbWVtY3B5X2JpZwAFA2Vudghfc3lzY29uZgAEA/
$ node stream-heap.js
Readable 358.53592 134
Writable 623.37824 258
Transform 709.05584 1310
$ node pull-heap.js
values 155.2692 70
map 84.50328 7
@dominictarr
dominictarr / thumbnails.js
Last active January 1, 2018 06:53
test script for generating thumbnails in an electron app
//updated to save thumbnails!
var h = require('hyperscript')
var fs = require('fs')
var pull = require('pull-stream')
var paramap = require('pull-paramap')
var path = require('path')
//XXX note, I added `module.exports = downsample` to the bottom of this file, TODO: make PR
var downsample = require('downscale/src/downsample')
Verifying that "dominictarr.id" is my Blockstack ID. https://onename.com/dominictarr
@dominictarr
dominictarr / box-stream-with-nonce.js
Last active February 9, 2017 13:36
example of how to read a fixed size binary prefix to a pull-stream
var Reader = require('pull-reader')
var box = require('./')
var pCont = require('pull-cont')
var randomBytes = require('crypto').randomBytes
var pull = require('pull-stream')
var Cat = require('pull-cat')
//key is 32 bytes and nonce is 24 bytes, written to start of stream.
exports.unbox = function UnboxStreamWithNonce (key) {
@dominictarr
dominictarr / index.js
Created April 29, 2016 01:47
nested-representation-state-transfer.js
'use strict'
var h = require('hyperscript')
/*
running this example:
browserify index.js | indexhtmlify > test.html
# then open in your browser
*/

Consistent Archive Tree

motivation

Despite it's considerable age, Tape ARchive format (tar) is still in widespread use. This is unfortunate because has as several features that are footguns in a modern context.

Firstly, because it contains timestamps (ctime, mtime) then archiving the same files twice will give a tar file that has a few bytes different, and thus will have a different hash. creating a archive deterministically was not a priority when tar was designed.

@dominictarr
dominictarr / README.md
Last active February 15, 2016 14:30
expandable buffers pool

a pool of expandable buffers

pool noodles, thanks @maxogden

anyone who has played around with getting performant IO in node will tell you to get really great performance you need to avoid unnecessary memory allocations and memory copying.

Working on pull-file I could get about 1gb/s read on a warm cache, but if I just reused the same buffer over and over I could get 2gb/s!

reusing memory is easy to do in a benchmark, but in an a real system when you read data in order to do something with it. maybe you write it to another file or socket, or maybe you encrypt it? maybe you pass it to a multiplexer which adds framing and then writes that to a socket?

here are the most useful pull streams modules

combining pull streams

a library of simple functions that will be familiar functional programmers.