Skip to content

Instantly share code, notes, and snippets.

View monperrus's full-sized avatar

Martin Monperrus monperrus

View GitHub Profile
@monperrus
monperrus / post.md
Created October 3, 2026 03:47
How long does a prompt cache live? Measured TTLs for 11 LLM endpoints

How long does a prompt cache live? Measured TTLs for 11 LLM endpoints

Every major LLM API now caches prompt prefixes: send the same beginning twice and the second call is cheaper and faster. What vendors rarely say is how long a cached prefix survives. Anthropic documents it (5 min, or 1 h on request); OpenAI gives a range ("5 to 10 minutes of inactivity, up to an hour", 24 h on opt-in); DeepSeek says "hours to days". Z.ai, Moonshot (Kimi) and Mistral publish nothing. I could not find a page that measures it.

So I measured it.

@monperrus
monperrus / gist.md
Created September 21, 2026 08:00
Copy-paste from a remote tmux to your local clipboard (OSC 52)

Copy-paste from a remote tmux to your local clipboard

Three layers must all cooperate. Any one of them broken and copy silently does nothing — no error, no clipboard. 🧩

[ remote app / tmux copy-mode ]  →  OSC 52 escape  →  [ ssh ]  →  [ local terminal ]  →  clipboard

Layer 1 — the terminal emulator must speak OSC 52 📋

@monperrus
monperrus / native-grammar-decoding.md
Last active September 6, 2026 06:45
Native support of grammar-based Decoding in inference servers

Native support of grammar-based Decoding in inference servers

This note distinguishes server-side constrained decoding from prompt-only formatting. In constrained decoding, the inference server masks invalid next tokens while generating; it does not merely ask the model to follow a format and parse the finished text.

Constraint interfaces

Interface Expressive power Typical use
JSON Schema Structured JSON objects and arrays API responses, function arguments
Regex Regular languages IDs, dates, fixed records
@monperrus
monperrus / run.superwebapp-tab.json
Created August 26, 2026 06:20
Martin's Super Webapp tab: Run
{
"1": {
"tab": {
"id": "run",
"label": "Run",
"html": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">\n<title>Run Pace</title>\n<style>\n html, body { margin: 0; height: 100%; background: #0d1117; color: #c9d1d9;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }\n * { box-sizing: border-box; }\n \n .app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; padding: 12px; gap: 8px; }\n \n .header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }\n .header h1 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; }\n .status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }\n .status-dot.idle { background: #8b949e; }\n .status-dot.running { background: #3fb950; box-shadow: 0 0 12px rg
@monperrus
monperrus / paint.superwebapp-tab.json
Created August 25, 2026 18:34
Martin's Super Webapp tab: Paint
{
"1": {
"tab": {
"id": "paint",
"label": "Paint",
"html": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">\n<title>Paint</title>\n<style>\n html, body {\n margin: 0; height: 100%;\n background: #0d1117; color: #c9d1d9;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n overflow: hidden;\n -webkit-user-select: none; user-select: none;\n }\n #app { display: flex; flex-direction: column; height: 100%; }\n\n /* Top bar */\n header {\n display: flex; align-items: center; gap: 6px;\n padding: 8px 10px;\n background: #161b22; border-bottom: 1px solid #30363d;\n flex-shrink: 0;\n }\n header h1 {\n font-size: 16px; margin: 0 8px 0 0; font-weight: 600; color: #58a6ff;\n flex-shrink: 0;\n }\n .hbtn {\n min-width: 44px; height: 44px;\n display: flex; align-items: center; justify-conte
@monperrus
monperrus / jmap-email.superwebapp-tab.json
Last active August 25, 2026 17:48
Martin's Super Webapp tab: Email
{
"1": {
"tab": {
"id": "jmap-email",
"label": "Email",
"html": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>JMAP Email</title>\n<style>\n html, body { margin: 0; height: 100%; background: #0d1117; color: #c9d1d9;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }\n * { box-sizing: border-box; }\n .app { display: flex; flex-direction: column; height: 100%; max-width: 600px; margin: 0 auto; }\n .header { padding: 12px 16px; border-bottom: 1px solid #30363d; background: #161b22;\n display: flex; align-items: center; gap: 8px; min-height: 52px; }\n .header h1 { margin: 0; font-size: 18px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;\n cursor: pointer; -webkit-user-select: none; user-select: none; }\n .header h1:active { opacity: .7; }\n .header .back-btn { background: none; border: none;
@monperrus
monperrus / openai-report-base64.md
Last active August 23, 2026 11:19
OpenAI OCR on Base64 Data Report
@monperrus
monperrus / piano-tab.superwebapp-tab.json
Created August 22, 2026 20:50
Martin's Super Webapp tab: Piano
{
"1": {
"tab": {
"id": "piano-tab",
"label": "Piano",
"html": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">\n<title>Piano Tab - Jazz Manouche</title>\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/vexflow/4.2.5/vexflow-min.js\"></script>\n<style>\n html, body { margin: 0; height: 100%; overflow: hidden; background: linear-gradient(135deg, #0b0f1a 0%, #0d1117 100%); color: #c9d1d9; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }\n * { box-sizing: border-box; }\n .app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }\n .header { padding: 10px 16px 4px; text-align: center; }\n .header h1 { margin: 0; font-size: 16px; background: linear-gradient(135deg, #58a6ff, #79c0ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 700; }\n .header .sub { font
@monperrus
monperrus / jmap-email.superwebapp-tab.json
Created August 22, 2026 20:45
Martin's Super Webapp tab: Email
{
"1": {
"tab": {
"id": "jmap-email",
"label": "Email",
"html": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>JMAP Email</title>\n<style>\n html, body { margin: 0; height: 100%; background: #0d1117; color: #c9d1d9;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }\n * { box-sizing: border-box; }\n .app { display: flex; flex-direction: column; height: 100%; max-width: 600px; margin: 0 auto; }\n .header { padding: 12px 16px; border-bottom: 1px solid #30363d; background: #161b22;\n display: flex; align-items: center; gap: 8px; min-height: 52px; }\n .header h1 { margin: 0; font-size: 18px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;\n cursor: pointer; -webkit-user-select: none; user-select: none; }\n .header h1:active { opacity: .7; }\n .header .back-btn { background: none; border: none;

agrifood — DG AGRI market price series (no key at all)

GET https://api.tech.ec.europa.eu/agrifood/api/{series}?beginDate=DD/MM/YYYY&endDate=DD/MM/YYYY

No apiKey, no auth. Verified: pigmeat/prices, cereal/prices, sugar/prices return weekly/monthly per-member-state price series. milk/prices → 404, i.e. the series list is narrower than hopeful client code assumes (a public repo's "confirmed" milk series was confirmed not to exist).