Skip to content

Instantly share code, notes, and snippets.

View mikeal's full-sized avatar

Mikeal Rogers mikeal

View GitHub Profile
@mikeal
mikeal / No2887.md
Created May 11, 2025 16:42
Sutra on the Profound Kindness of Parents

No. 2887

Sutra on the Profound Kindness of Parents

佛說父母恩重經 The Buddha Speaks the Sutra on the Profound Kindness of Parents

如是我聞。一時佛在王舍城耆闍崛山中。與大菩薩摩訶薩及聲眷屬俱。亦與比丘比丘尼優婆塞優婆夷。一切諸天人民及天龍鬼神。皆來集會。一心聽佛說法。瞻仰尊顏。目不暫捨。 Thus have I heard. One time the Buddha was staying at Gṛdhrakūṭa Mountain in Rājagṛha, together with great bodhisattvas (mahāsattva) and śrāvaka disciples, as well as bhikṣus, bhikṣunīs, upāsakas, and upāsikās. All devas, humans, and also heavenly dragons and spirits gathered together, wholeheartedly listening to the Buddha’s teaching of the Dharma, gazing upon his revered countenance without averting their eyes for even a moment.

@mikeal
mikeal / blocks-in-ipfs.js
Created October 20, 2020 20:24
Filecoin Liftoff
import * as Block from 'multiformats/block'
import { sha256 as hasher } from 'multiformats/hashes/sha2'
import * as codec from '@ipld/dag-cbor'
import { CID } from 'multiformats'
let value = { hello: 'world' }
let hello = await Block.encode({ value, codec, hasher })
let bbbb = await Block.encode({ value: { foo: hello.cid }, codec, hasher })
const publicIp = require('public-ip')
const bent = require('bent')
const get = bent('json', 'https://my-lambda-url')
exports.handler = async function http (req) {
let { retries, ips } = req.queryStringParameters
const ip = await publicIp.v4()
if (ips) ips = ips.split(',')
else ips = []

We’ve been saying for a long time that we need “something like a CAP theorum for IPLD.” By this, I mean that we need a way to talk about the design tradeoffs that are made when designing data structures in IPLD.

This is going to end up looking a lot different than the CAP theorem but the end goal is to have something that provides us a blueprint for how to discuss the performance tradeoffs of different data structure designs.

Anyway, here’s my attempt at a first draft. It’s incomplete but I need some feedback in order to iterate on it and turn it into a proper PR.


@mikeal
mikeal / missing.sh
Created July 1, 2020 21:38
show functions with missing coverage
cat coverage/tmp/coverage-* | jq '.result[] | select(.url == "file:///root/dagdb/src/kv.js")
| .functions[] | select(.ranges[].count == 0)'
{
"carUrl": "https://dumbo-v2-cars-encode-public.s3.us-west-2.amazonaws.com/bafyreifxo4u7nuyvjjwhlibvnzjxrb6bxo3ok6xeukze6iybdyc7kvngum%2Fbafyreifxo4u7nuyvjjwhlibvnzjxrb6bxo3ok6xeukze6iybdyc7kvngum.car",
"dataset": "encode-public",
"parts": [
"mAVUSIG7RzFYiX3JUIBAJzDy/V1dgHlI/3yp8/brAZWkDZZWe",
"mAVUSICl6Enz7p+XpsR19HX3rXFbT98sP1GS98L2nm7pwMsI0",
"mAVUSIFlxWE0UJw41r+YniU9oieqKfQgolSDLU0apaB5LD5CZ",
"mAVUSIMmZlwF2h1G2HkUgK62LxJAhNrD0XfBrRpoeUl1WBm7K",
"mAVUSILZYhlK40rJ0Fxfexl5ugh60G9agykgXqyQKYwqpeh+3",
"mAVUSIOqqvN4gCRPRqFMgmw2nuNxKgTdKNf2jhblmSPyuzwA0",
const gen = require('ipld-schema-gen')
const parse = require('ipld-schema')
const schema = `
type DataLayout map
advanced DataLayout
type Data bytes representation advanced DataLayout
`
const DataLayout = {
testMethod: node => {
@mikeal
mikeal / bunde-size-action.yml
Created August 20, 2019 02:57
What you need to add to your GitHub Action to add bundle size badges to your readme.
- uses: mikeal/bundle-size-action@master
- uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@mikeal
mikeal / example.js
Created March 11, 2019 17:38
async-ready
class NeedsReady {
constructor () {
this.ready = new Promise(resolve => setTimeout(resolve, 1000))
}
async foo () {
await this.ready
return 'bar'
}
}
@mikeal
mikeal / stateless-interface.js
Created February 27, 2019 17:49
stateless interface example
class Database {
constructor (storage) {
this.count = 0
this.storage = storage
}
async get (cid) {
this.count += 1
return this.storage.get(cid.toBaseEncodedString())
}
async put (block) {