Skip to content

Instantly share code, notes, and snippets.

View jimpick's full-sized avatar
💭
Hi!

Jim Pick jimpick

💭
Hi!
  • HexCamp
  • Victoria, BC, Canada
  • X @jimpick
View GitHub Profile
@jimpick
jimpick / 20190207_06_58_34.txt
Created February 7, 2019 07:42
Example output of distributed tracing - 15 runs, random-collaboration test from peer-base, 12 peers x 1000 characters
Starting Rendezvous
Test Run 1 of 15
PID: 8745
Test Node.js
rendezvous: Listening on: http://0.0.0.0:9090

 collaboration with random changes
Swarm listening on /ip4/127.0.0.1/tcp/9090/ws/p2p-websocket-star/ipfs/Qmc5WHmQzyBn9pi6qrMg9XHcU7m51Myo5CchEjMb3qmFo9
@jimpick
jimpick / output.txt
Created January 24, 2019 08:15
Bad rga join
$ node rga-fail.js
replicaPear initial: p
replicaVowels: ea
replicaPear after applying vowels: pea
replicaPear final: pear
Apply deltas in original order:
replica1: pear
Apply deltas in modified order:
@jimpick
jimpick / 0 - read-log.js
Last active November 12, 2018 14:14
Example of async iterators + scuttlebutt
// To run: node -r esm read-log
import ssbClient from 'ssb-client'
import pull from 'pull-stream'
import toIterator from 'pull-stream-to-async-iterator'
import { promisify } from 'util'
const openSsbClient = promisify(ssbClient)
async function run () {
$ hexdump db-from-beaker/content/bitfield
0000000 05 02 57 00 00 0d 00 00 00 00 00 00 00 00 00 00
0000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000d20
@jimpick
jimpick / crdt-ormap-with-maddrs.js
Created November 1, 2018 02:00
join problems - using ormap to store maddrs in peer-star-app membership CRDT
const CRDT = require('delta-crdts')
const ORMap = CRDT('ormap')
const membersPinner = ORMap('peer-zbe')
membersPinner.applySub('zbe', 'mvreg', 'write', [ 'maddr/zbe' ])
console.log('pinner 1', membersPinner.value())
console.log('pinner 1 state()', membersPinner.state())
@jimpick
jimpick / proof.json
Created October 31, 2018 17:36
ipfs-social-proof jimpick
{
"handle": "Jim Pick",
"ipfsId": "QmX7S4KLxVfhMT7BwsyA2GkKfWD7LPHgPdK75pzErgqBWG",
"proof": {
"message": {
"statement": "I am @jimpick on github.com",
"username": "@jimpick",
"service": "github.com"
},
"timestamp": 1541007329378,
@jimpick
jimpick / devtools.js
Last active October 22, 2018 18:01
dump rga state
console.log(JSON.stringify([[...doc.shared.state()[0]], [...doc.shared.state()[1]], [...doc.shared.state()[2]]], null, 2))
@jimpick
jimpick / gist:aea87c262b93b74ff6f8ba1e3df994fd
Last active October 13, 2018 00:30
raw ipfs + blake2b vs. sodium-universal
$ echo 'record a' > record-a.bin
$ hexdump -C record-a.bin
00000000 72 65 63 6f 72 64 20 61 |record a|
00000008
$ ipfs dag put -f raw --input-enc raw --hash blake2b-256 record-a.binzCT5htkeC8GjDQn53ve8HDuhFQS8q4UVh7NX9KhNHSjnAczWEUbS
$ cid format zCT5htkeC8GjDQn53ve8HDuhFQS8q4UVh7NX9KhNHSjnAczWEUbS -b base16 -f '%c%L %h %D'
raw 32 blake2b-256 d4309131176a941e14881dc27f85a10b17a1f35970a87a2e28c85179f2558851
@jimpick
jimpick / learn-to-multiwriter.md
Last active September 26, 2018 23:41
Help test the multiwriter Dat command-line

Install

$ npm install -g @jimpick/dat-next

Make a directory with some sample files

$ mkdir sample-files