Skip to content

Instantly share code, notes, and snippets.

View elithrar's full-sized avatar
🌐
usually busy

Matt Silverlock elithrar

🌐
usually busy
View GitHub Profile
@elithrar
elithrar / synchronous-sqlite-codemod.md
Last active January 16, 2026 17:49
2026/01/16 - lint (and rewrite) Cloudflare Workers code using ast-grep (https://ast-grep.github.io/)

Code that uses await here for a synchronous call:

export class MyDurableObject extends DurableObject {
  async query() {
    const rows = await this.ctx.storage.sql.exec("select 1");
    return rows;
  }
}
@elithrar
elithrar / gist-readme.md
Created January 6, 2026 23:52
Agent-friendly CLI example using @clack/prompts - outputs YAML schema for machine consumption
@elithrar
elithrar / jj.md
Last active January 13, 2026 22:21
a jj cheat sheet for git users

jj Cheat Sheet for Git Users

🗣️ this is a useful guide to help you memorize + better understand how Jujutsu works, but it's not a replacement for learning the mental model or deeper strategies!

Core Concepts

  • No staging area — all changes in the working copy are automatically part of the current “change”
  • Changes vs commits — jj tracks “changes” (mutable) that become “commits” (immutable) when pushed
  • @ — a symbol pointing to the current working copy change (like HEAD, but for changes)
  • @- — the parent of @
@elithrar
elithrar / cross-repo.ts
Last active January 5, 2026 17:08
2026/01/05 - draft/hack version of a cross-repo tool for OpenCode. latest version always at https://github.com/elithrar/dotfiles/blob/main/.config/opencode/tool/cross-repo.ts
/**
* Cross-Repo Tool for OpenCode
*
* Enables operations on GitHub repositories other than the current working repository.
* Useful for coordinated changes across multiple repos, updating related repos,
* or opening PRs in different repositories.
*
* ## Security Model
*
* Authentication is context-aware:
@elithrar
elithrar / AGENTS.md
Last active January 10, 2026 22:32
a very helpful AGENTS.md! copy to the root of your repos - modern coding agents will use it. happy coding!

AGENTS.md

Instructions for AI coding agents working in this repository.

Decision-making

  • When possible, defer decisions to larger groups. Ensure all stakeholders have an opportunity to weigh in before proceeding.
  • Demand precision. Insist on clarifying ambiguities and edge cases before beginning any implementation.
  • Reopen previously settled matters if new participants join or if conditions have changed, even slightly.
  • Raise questions about whether the current approach aligns with long-term strategy. Suggest forming a working group if uncertainty remains.
@elithrar
elithrar / index.ts
Created March 25, 2025 17:55
Cloudflare Agents SDK + Gemini 2.5 Pro Experimental 03-25 + prompt - https://developers.cloudflare.com/agents/
import { Agent, AgentNamespace, routeAgentRequest } from 'agents';
import { GoogleGenerativeAI, HarmCategory, HarmBlockThreshold } from '@google/generative-ai';
// Define the environment variables and bindings required by the Worker and Agent
interface Env {
// Binding for the Agent Durable Object
SECURITY_AUDIT_AGENT: AgentNamespace<SecurityAuditAgent>;
// Secret holding the Google Gemini API Key
GEMINI_API_KEY: string;
// Optional: Secret holding a GitHub API token for higher rate limits / private repos
@elithrar
elithrar / index.html
Created February 25, 2025 14:27
Claude 3.7 + building Cloudflare Agents using the agents-sdk
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Cloudflare Agent Chat</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
@elithrar
elithrar / Hypersubatomic.json
Last active February 12, 2025 02:39
USGraphics Hypersubatomic editor theme for the Zed editor (zed.dev) • https://github.com/usgraphics/hypersubatomic-vscode-theme
{
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
"name": "Hypersubatomic",
"author": "Converted from VSCode theme",
"themes": [
{
"name": "Hypersubatomic Dark",
"appearance": "dark",
"style": {
"background": "#0F111A",
@elithrar
elithrar / index.ts
Created December 6, 2024 16:45
workers.es - a (silly) example of writing Cloudflare Workers in Spanish (2024/12/6)
import { Solicitud, Respuesta, ContextoDeEjecucion, Entorno, Prometo, URL } from "./workers.es";
export default {
async obtener(solicitud: Solicitud, entorno: Entorno, contexto: ContextoDeEjecucion): Prometo<Respuesta> {
let url = new URL(solicitud.url);
let nombre = url.parametrosBusqueda.get("nombre") || "mundo";
return Respuesta.json({
mensaje: `hola ${nombre}`,
});
@elithrar
elithrar / index.ts
Last active February 12, 2025 07:42
Bluesky API + Cloudflare Workers example: https://docs.bsky.app/docs/get-started + https://developers.cloudflare.com/workers/ = 😎
import { BskyAgent } from "@atproto/api";
type Env = {
BLUESKY_APP_PASSWORD: string;
POST_TOKEN: string;
};
export default {
async fetch(request, env, ctx): Promise<Response> {
let url = new URL(request.url);