Skip to content

Instantly share code, notes, and snippets.

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@smontanaro
smontanaro / dusort.sh
Created November 7, 2022 11:01
I got this du postprocessing script from "the net" in the dark ages (probably from Usenet in the 80s or 90s). I have no idea who the original author was. I've never modified it **at all**. It has always just worked.
#!/bin/sh
#
# sort a "du" listing by directory size
# usage: du | dusort
FILES=
TFORM=0
while test $# -ge 1; do
case $1 in
-t) TFORM=1; ;;
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active December 2, 2026 09:38
Complete Recent Discord Quest

Caution

As of August 26th 2026, Discord has started suspending quest access of people caught automating quest completion.

Some users have received the following system message:

image

There isn't much I can do to make the script undetected, so use it at your own risk, as you WILL get flagged by doing so.

Complete Recent Discord Quest

@S22F5
S22F5 / gameWithPublicPDB.txt
Last active December 2, 2026 09:29
List of Games with Public Debug Symbols
AbioticFactor-Win64-Shipping.exe
AbioticFactor-Win64-Shipping.pdb
acs.exe
acs.pdb
acs_x86.exe
acs_x86.pdb
arktika1.exe
arktika1.pdb
AstroColony-Win64-Shipping.exe
AstroColony-Win64-Shipping.pdb
@TotallyNotNero
TotallyNotNero / iCloudBypass.sh
Created November 13, 2019 20:40
iOS iCloud Bypass
echo "==> Installing dependencies..."
brew install libusbmuxd
clear
echo "********* Checkra1n iCloud Bypass **********"
echo
echo "=> By Nero, et al"
echo "=> - @TotallyNotNero"
echo
echo "==> DISCLAIMER: I can not be held accountable if you decided to use this tool for illegal purposes. That is on you. DO NOT use this for illegal purposes."
@xikhar
xikhar / metroidvania-prompt.md
Created December 1, 2026 22:06
metroidvania-prompt

Build a high quality complete pixel style metroidvania game in the browser.

Platform and constraints: It should run in the browser. Graphics drawn using webgl. Gameplay engine built on top of webgl as well, no external libraries. you need to invent all the code to make and run the game great.

First part: Research. It needs to be a Metroidvania, so research on how they look like and what are the gameplay mechanisms, camera movements, world design, Techniques to build it. Webgl things to understand. study the existing games for some references. Read ENGINE section below for what more to research on that.

Second part: reference & Design. Use PIXELGAME.jpg in main-ref folder as the source of truth. Use available models on FAL MCP to generate more reference images as you need, or any video that you need. The first part of the process is to explore reference ideas and have a concrete plan of what to build, along with what it should look like. And the entire theme should be consistent across the game. generate mo

@HackingLZ
HackingLZ / EDR.md
Created May 4, 2026 22:31
Large EDR Prompt

EDR Reverse Engineering Workspace

Universal workflow for complete reverse engineering of endpoint detection and response (EDR) products. Every EDR dropped into this workspace gets the same systematic treatment: full decompilation, rule extraction, ML model extraction, vulnerability analysis, detection gap analysis, and tradecraft development.

Standardized Folder Structure

When given a new EDR product, create this structure under <product>/:

<product>/
@sorrycc
sorrycc / gist:296b442bbe07c6f76442a4fa6233904d
Created March 6, 2026 04:45
语雀文档导出工具
// ==UserScript==
// @name 语雀文档导出工具
// @namespace http://tampermonkey.net/
// @version 0.1.0
// @description 导出语雀文档为 Markdown 文件
// @author sorrycc
// @match https://www.yuque.com/*
// @match https://yuque.antfin.com/*
// @require https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js@v2.0.4/dist/FileSaver.min.js
// @require https://cdn.jsdelivr.net/gh/Stuk/jszip@v3.0.0/dist/jszip.min.js