Skip to content

Instantly share code, notes, and snippets.

View joeltg's full-sized avatar

Joel Gustafson joeltg

View GitHub Profile
@joeltg
joeltg / hyperbee.d.ts
Created August 10, 2022 17:35
TypeScript type declarations for hypercore libraries
declare module "hyperbee" {
import type { Feed } from "hypercore"
import type stream from "node:stream"
interface HyperBeeOptions {
keyEncoding: "utf-8" | "binary" | "ascii"
valueEncoding: "utf-8" | "binary" | "ascii"
}
type Key = string | Uint8Array
@joeltg
joeltg / index.d.ts
Created May 9, 2022 16:26
@types/ipfs-only-hash
declare module "ipfs-only-hash" {
export function of(input: string | Uint8Array | AsyncIterable<Uint8Array>, options?: {}): Promise<string>
}
@joeltg
joeltg / index.d.ts
Created May 9, 2022 16:24
@types/hyperbee
declare module "hyperbee" {
import type { Feed } from "hypercore"
import type stream from "node:stream"
interface HyperBeeOptions {
keyEncoding: "utf-8" | "binary" | "ascii"
valueEncoding: "utf-8" | "binary" | "ascii"
}
type Key = string | Uint8Array
@joeltg
joeltg / cfupdater
Created April 25, 2022 01:49
Cloudflar Dynamic DNS Script
#!/bin/sh
zone_identifier=""
record_name=""
auth_token=""
get_response=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/${zone_identifier}/dns_records?name=${record_name}&type=A" -H "Authorization: Bearer ${auth_token}" -H "Accept: application/json")
get_success=$(echo ${get_response} | jq .success)
@joeltg
joeltg / snarkjs.d.ts
Created November 21, 2021 21:28
TypeScript type declarations for snarkjs
declare namespace snarkjs {
namespace groth16 {
async function fullProve(
input: Record<string, string>,
wasmPath: string,
zkeyPath: string
): Promise<{ publicSignals: string[]; proof: Object }>
async function verify(
verificationKey: any,
tasl = *( block newline ) block
block = *WSP [ line-comment / statement *WSP ]
statement = namespace-definition
/ literal-definition
/ class-declaration
keyword-namespace = %x6E.61.6D.65.73.70.61.63.65
keyword-literal = %x6C.69.74.65.72.61.6C
@joeltg
joeltg / literals.md
Last active December 8, 2020 21:37
tasl manual
@joeltg
joeltg / schemas.md
Last active October 27, 2020 15:16
declare module "signed-varint" {
function encode(input: number): number[]
function decode(input: Uint8Array, offset?: number): number
function encodingLength(input: number): number
}
@joeltg
joeltg / index.d.ts
Created October 16, 2020 16:15
TypeScript module declaration for rdf-canonize
declare module "rdf-canonize" {
type Term = {
termType: string
value: string
language?: string
datatype?: Term
}
type Quad = { subject: Term; predicate: Term; object: Term; graph: Term }
function canonize(
dataset: Quad[],