Skip to content

Instantly share code, notes, and snippets.

View alanshaw's full-sized avatar
🌶️
https://storacha.network

ash alanshaw

🌶️
https://storacha.network
View GitHub Profile
@alanshaw
alanshaw / gen-did-suffix.go
Created April 22, 2026 13:24
Generate a DID with a particular suffix
package main
import (
"fmt"
"strings"
"github.com/alanshaw/ucantone/principal/ed25519"
"github.com/alanshaw/ucantone/principal/signer"
)
@alanshaw
alanshaw / build.sh
Created April 16, 2026 11:42
Docker build local and tag as dev
docker build . -t sprue && docker tag sprue sprue:dev
import { registerHooks } from 'node:module'
import fs from 'node:fs'
const urls = []
registerHooks({
load(url, context, nextLoad) {
if (!url.startsWith('file://')) {
return nextLoad(url, context)
}
urls.push(url)
@alanshaw
alanshaw / decode_test.go
Created November 12, 2025 18:54
Decode X-Agent-Message header
package main
import (
"fmt"
"testing"
"github.com/storacha/go-ucanto/testing/helpers/printer"
"github.com/storacha/go-ucanto/transport/headercar/message"
)
@alanshaw
alanshaw / find-ipni-genesis.js
Created September 15, 2025 12:17
Find the genesis of an IPNI chain given it is stored in an S3 bucket you have access to.
import { GetObjectCommand, ListObjectsV2Command, S3Client } from '@aws-sdk/client-s3'
import Ora from 'ora'
import * as dagJSON from '@ipld/dag-json'
const spinner = Ora()
const client = new S3Client({ region: 'us-west-2' })
const bucket = 'ipfs-advertisement'
let oldest
let cursor
package main
import (
"encoding/base64"
"fmt"
"os"
"strconv"
"time"
ipnimd "github.com/ipni/go-libipni/metadata"
@alanshaw
alanshaw / maxpiecesize.go
Created July 11, 2025 09:55
Maximum PDP piece size for Piri
package main
import (
"fmt"
"github.com/filecoin-project/go-state-types/abi"
"github.com/storacha/piri/pkg/pdp/proof"
)
func main() {
@alanshaw
alanshaw / print-charm-colours.js
Created July 4, 2025 08:46
Print the charm colours 0-255
import createCharm from 'charm'
const charm = createCharm()
charm.pipe(process.stdout)
charm.reset()
for (var i = 0; i < 256; i++) {
charm.background(i).write(i+'\n')
}
package main
import (
"fmt"
"strconv"
"time"
"github.com/multiformats/go-multibase"
"github.com/multiformats/go-multicodec"
"github.com/multiformats/go-multihash"
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
fmt.Println(ResolveDIDKey())