Skip to content

Instantly share code, notes, and snippets.

View ryangoree's full-sized avatar
🌎

Ryan Goree ryangoree

🌎
View GitHub Profile
@ryangoree
ryangoree / privacy-pools-ceremony_attestation.log
Created February 28, 2025 18:13
Attestation for Privacy Pools Ceremony MPC Phase 2 Trusted Setup ceremony
Hey, I'm ryangoree-3289505 and I have contributed to the Privacy Pools Ceremony.
The following are my contribution signatures:
Circuit # 1 (withdraw)
Contributor # 499
Contribution Hash: 2a9dc7df 157d1efd e26552c4 3b1f5ee8
b16eaf2c f9eef243 44e49d7f 0f76aeeb
10f8272f b1e8363a 3a739711 574bf433
e0242565 275625c4 e7dbeb83 331dc5c1
@ryangoree
ryangoree / README.md
Last active February 27, 2025 01:27
Util types for unions

Union Types

A tiny set of utility types for working with unions.

📦 Install

npm i gist:5d48bb3b92fa02cd9eb34ee87d3c7050
@ryangoree
ryangoree / anvil-reverse-proxy.ts
Last active February 23, 2025 23:49
Reverse proxy for monitoring RPC requests to a local anvil server
import { createWriteStream, writeFileSync } from 'node:fs';
import { createServer, request } from 'node:http';
// Settings //
const TARGET_HOST = '127.0.0.1';
const TARGET_PORT = 8545;
const PROXY_PORT = 8546;
// Server //
@ryangoree
ryangoree / Slice.ts
Last active January 24, 2025 21:01
Get a sliced subset of a tuple type.
type BuildTuple<
L extends number,
T extends any[] = [],
F = unknown,
> = `${L}` extends `-${number}`
? never
: T["length"] extends L
? T
: BuildTuple<L, [...T, F], F>;
@ryangoree
ryangoree / Length.ts
Created January 24, 2025 01:39
Get the length of a string.
/**
* Get the length of a string.
*
* @example
* ```ts
* type L = Length<"hello">; // 5
* ```
*/
type Length<
T extends string,
@ryangoree
ryangoree / Tuple.ts
Last active January 24, 2025 01:04
Get a tuple type with a length of `TCount` where each element is of type `T`.
/**
* Get a tuple type with a length of `TCount` where each element is of type `T`.
*
* @example
* ```ts
* type ThreeTuple = Tuple<string, 3>;
* // [string, string, string]
* ```
*/
export type Tuple<T = any, TCount extends number = number> = (
@ryangoree
ryangoree / Extended.ts
Last active January 24, 2025 21:28
Get a superset of `T` that allows for arbitrary properties.
/**
* Get a superset of `T` that allows for arbitrary properties.
*
* @example
*
* ```ts
* interface Order {
* account: `0x${string}`;
* amount: bigint;
* }
@ryangoree
ryangoree / s3reporter.js
Last active January 22, 2025 18:20
A node.js test reporter that formats results as CSV and uploads to S3.
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
const currentPath = [];
const csvRows = ["test_name,duration,passed,error,skipped,skip_message,logs"];
let pendingRow;
let diagnostics = [];
/**
* A test reporter that formats results as CSV and uploads to S3.
* @see https://nodejs.org/api/test.html#custom-reporters
@ryangoree
ryangoree / Mask.ts
Last active March 1, 2025 07:26
Create a subset of an object type based on a mask/template type.
/**
* Creates a new type that only includes properties from `T` that match the
* structure defined in `M`. Useful for creating a subset of an object type
* based on a mask/template type. Handles special cases for built-in objects
* (Functions, Maps, Sets, Arrays) by preserving their structure rather than
* attempting to deeply map their properties.
*
*
* @example
* ```ts
@ryangoree
ryangoree / FirstSpecific.wip.ts
Last active February 20, 2025 21:19
🚧 WIP 🚧 - Get the first member of a tuple that is more or as specific as the member following it.
// 🚧 WIP 🚧 //
/**
* Get the first member of a tuple, {@linkcode T}, that is more or as specific
* as the member following it.
*
* @example
* ```ts
* type Status = "success" | "error" | "idle"
* type ActiveStatus = "success" | "error"