Skip to content

Instantly share code, notes, and snippets.

View 2color's full-sized avatar
🎁
Building

Daniel Norman 2color

🎁
Building
View GitHub Profile
@2color
2color / blake3-multihash.ts
Created February 21, 2025 09:52
How to use Verified Fetch with BLAKE3
import { blake3 as b3 } from '@noble/hashes/blake3'
import { from } from 'multiformats/hashes/hasher'
import { createVerifiedFetch } from '@helia/verified-fetch'
export const blake3 = from({
name: 'blake3',
code: 0x1e,
encode: (input) => b3(input),
})
.DS_Store
._.DS_Store
**/.DS_Store
**/._.DS_Store
.vscode
.idea
Thumbs.db
# used to need to run git config --global core.excludesfile ~/.gitignore_global to set this but apparently no longer needed https://x.com/bate5a55/status/1840594630972191118
CID Name Tags
bafyreidyjlqwe7dmvnk5ts2c4firtfaordiy5pzywmtavcqv5lvosa46lu DAG with same 3 blocks balooning into ~444TB
bafybeib66nyby767evpqrnpen4u7jeflavtmrhcdkazptyrxaxhlt4qyaa Monkey JPGs at nft.storage
bafybeifcd5ysgcmgsn3l3nebo3wu7jsuf7xumnsfup55dk2ikis3ujsnue Malformed UnixFS discuss.ipfs.tech
ESM Metagenomic Atlas dataset (around 30TiB total)
bafyaabakaieac Inlined Empty UnixFS dir
bafkqaaa Inlined Empty File
bafybeifiq5oapwiv55ss6vlqpck3mbsh4mzbal35s6zw5yrskphzjm7ypa 1M JSONs: NFT drop that hits wantlist overflow bug
QmeV8PDCHC1HRY3wjDC1WKXu66VyLfYJajMpzYNAgig5Vp IPTV OFFLINE video
QmNwDj9iUY3yJyDUP9yGagF6vFiorXEqx74pGn6RH2uTnz 2.1TB trusted-setup.filecoin.io

Sequence diagram for universal connectivity app

sequenceDiagram
    participant a as Browser1
    participant cr as Bootstrapper & Relay
    note over cr: With CircuitRelayV2 subscribed to GossipSub discovery, and messages topic
    participant b as Browser2
    participant stun as STUN Server
@2color
2color / js-libp2p.ts
Created May 2, 2024 16:00
persistent libp2p peerid
import { IDBDatastore } from 'datastore-idb'
import {
createDelegatedRoutingV1HttpApiClient,
DelegatedRoutingV1HttpApiClient,
} from '@helia/delegated-routing-v1-http-api-client'
import { createLibp2p, Libp2p } from 'libp2p'
import { identify } from '@libp2p/identify'
import { peerIdFromString } from '@libp2p/peer-id'
import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
@2color
2color / ipfs-commands.md
Created May 31, 2022 14:08
Useful IPFS commands

dig +noall +answer TXT \_dnslink.chat.thedisco.zone

@2color
2color / main.rs
Created January 4, 2022 14:37
Mean, median, and mode of a vector with Rust
use std::collections::HashMap;
fn main() {
let v: Vec<u32> = vec![10, 20, 20, 30, 38, 42, 48, 51, 62, 70];
println!("vector: {:?}", v);
println!("mean: {}", mean(&v));
// println!("median: {}", median(&mut v));
println!("median: {}", median_1(&v));
// println!("median: {}", median_2(v.clone()));
println!("mode: {}", mode(&v));
@2color
2color / main.md
Last active December 2, 2021 16:01

Comparing B-Tree and Hash indices

Operation B-Tree Hash
Lookup single record O(log(n)) O(1)
Lookup range O(log(n)) O(n) full table scan
Insertion O(log(n) O(1)
Deletion O(log(n) O(1)