Skip to content

Instantly share code, notes, and snippets.

@kindgracekind
kindgracekind / example.js
Created May 12, 2025 14:59
Programming with needles
import { type, entity, literal } from "./needles.js";
// Schema:
// Person:
// - has_one Name: string
// - has_one Age: number
// - has_many Post
// Post:
// - has_one Title: string
@kindgracekind
kindgracekind / README.md
Last active October 4, 2024 19:16
Multiple pseudonymous accounts with Semaphore

Multiple Pseudonymous Accounts with Zero-Knowledge Proofs

As AI gets better at imitating humans, proof of personhood schemes are becoming increasingly important. These systems set out to accomplish the following goals:

  • Verify that a given user is a human
  • Verify that a given user is unique

The latter goal, in particular, can have drawbacks. For example, users are unable to create multiple pseudonymous accounts, which may be a desired feature in something like a microblogging platform.

In order to solve this problem, we can use Semaphore's external nullifiers to allow up to N pseudonymous accounts while ensuring accounts cannot be linked to each other. This is in contrast to the typical use of external nullifiers, in which a single app uses a single nullifier to prevent duplicate signups.

@kindgracekind
kindgracekind / claudecompletions.js
Last active April 29, 2024 23:13
Claude Completions
async function getCompletion(prompt, { maxTokens, temperature }) {
const response = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"content-type": "application/json",
"anthropic-version": "2023-06-01",
"x-api-key": process.env.ANTHROPIC_API_KEY,
},
body: JSON.stringify({
model: "claude-3-opus-20240229",