Skip to content

Instantly share code, notes, and snippets.

View blahah's full-sized avatar

Rik Smith-Unna blahah

  • upward spiral ∞⟨X∴↯⟩∞
  • Bristol / Berlin / Nairobi
  • X @blahah404
View GitHub Profile
@blahah
blahah / README.md
Last active June 7, 2025 16:47
Autobase multi-writer single-reader pattern using public key encryption via blind-pairing

Multi-Writer Single-Reader Autobase

A comprehensive example demonstrating how to create an Autobase where multiple peers can write encrypted data, but only the bootstrapper can read the aggregated view. This implements a "single-reader" pattern using public key encryption.

Overview

This example shows how to layer encryption on top of standard Autobase multi-writer patterns to create a system where:

  • Multiple writers can connect and send encrypted messages
  • Only the bootstrapper (reader) can decrypt and view the content
@blahah
blahah / distributed-rpc-marketplace.js
Last active June 4, 2025 09:47
Distributed n-n RPC with request-fulfilment pattern using Autobase/blind-pairing/hypercore ecosystem
const BlindPairing = require('blind-pairing')
const Autobase = require('autobase')
const Corestore = require('corestore')
const Hyperswarm = require('hyperswarm')
const crypto = require('hypercore-crypto')
const z32 = require('z32')
const FUNCTIONS = {
add: (a, b) => Number(a) + Number(b),
multiply: (a, b) => Number(a) * Number(b),
@blahah
blahah / hypercore-2way-RPC-demo.js
Created June 3, 2025 14:59
RPC/function delegation in hypercore with networking
const Hypercore = require('hypercore')
const Hyperswarm = require('hyperswarm')
const crypto = require('hypercore-crypto')
// Available functions for delegation
const AVAILABLE_FUNCTIONS = {
add: (a, b) => a + b,
multiply: (a, b) => a * b,
greet: (name) => `Hello, ${name}!`,
getCurrentTime: () => new Date().toISOString(),
@blahah
blahah / hypercore-function-delegation.js
Last active June 3, 2025 14:44
RPC/function delegation with hypercore
const Hypercore = require('hypercore')
const Hyperswarm = require('hyperswarm')
const crypto = require('hypercore-crypto')
// Available functions for delegation
const AVAILABLE_FUNCTIONS = {
add: (a, b) => a + b,
multiply: (a, b) => a * b,
greet: (name) => `Hello, ${name}!`,
getCurrentTime: () => new Date().toISOString(),
@blahah
blahah / consoleStdout.js
Created June 2, 2025 16:16
Pear app developer console -> STDOUT streaming
/**
* Console stdout streaming for Pear applications
* Duplicates console output to both devtools and terminal stdout/stderr
*/
// Store original console methods
const originalConsole = {
log: console.log,
error: console.error,
warn: console.warn,
@blahah
blahah / 10kb.random
Created July 21, 2022 17:40
random 10kb text file
rYau27jmONOO0WWV1t3KV6dhlKpbqRyHMGFrhqchhN3d19BFNvAl2vtjuexPx5kUIuVR6KItBZBD
/UhbRu0nyNqXm3uH3Uw6jPngEmKt/SaHr1BIZUeMtarG6eWlxUz6Jduj377RsxYQtYA0TKlZBNnU
4/93/irOOSG+F4dGcGBUeCAyGtlF6yEFIyn3aU1TX5p5dISyysX+4uhz3CD6PFxo8sThBCO1sIYL
y6D91AQz4eWIMyXqGtS0xxY8kEblTaRKpZlqb8CU1PTOvVXnjX+ggi3gNFKzAOXRKR64IOwZAeUT
loD1SF+QmipZ04Mgf1mElmPSuSdhrtCxHW5hmgvzostRe/LR8GC2Y6ENsa1dM3A7sgI0T7OvGnd9
SOYbvI4NrqdfDb+wlAJPEV7TCnlB8BVOYJApfrNNzIBxmhugHSigjDD1zQHcT/IDsrR+36tcC+qX
TlIERfXj/YQeDeXhIshARiTLDoQXm1pjn7CSfTP4FXfwS4QIR6b6MwMU7r2+TQ56CEjdGPEuXhvg
5XshpCukSK1zZn/4UaxCozsuK/ubmNqiDzL+6dUaRVmd9eMrQ974oyvo3MGaFq0jdSjdJiKU/+YH
UmBwtT9E3DdUbuCzGPWB9eiRi7Rdsn98PR3kKXgNyNS7VinsyOTOrUC35x3/iK24KCzoZiliGd+s
isokDsvi1u/jhbzZc6RjpP5LG8FdIA21FYL9vmcdztSn9tWoZDutm5h1aVo/CsXerFfAb9WGxSGd
dat://6d8edce490908c12d3acc38b93ec1973395cf299b44094c99c1e5d0f618654f6
@blahah
blahah / 00_README.md
Last active November 16, 2020 06:56
_Dendrosenecio_ molecular phylogeny (chloroplast genome)
{ "one": "hello", "two": "venus", "three": "help", "four": "I'm stuck here" }
{ "one": "hello", "two": "mercury", "three": "help", "four": "I'm stuck here" }
{ "one": "hello", "two": "earth", "three": "help", "four": "I'm stuck here" }
{ "one": "hello", "two": "mars", "three": "help", "four": "I'm stuck here" }