Skip to content

Instantly share code, notes, and snippets.

View monperrus's full-sized avatar

Martin Monperrus monperrus

View GitHub Profile
@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).

@monperrus
monperrus / apply_patch.md
Last active August 16, 2026 17:57
`apply_patch`: OpenAI's freeform patch tool, its transport, and its grammar

apply_patch: OpenAI's freeform patch tool, its transport, and its grammar

OpenAI's Codex CLI (and the GPT-5 model family more broadly) ships a tool called apply_patch for editing files. Unlike almost every other tool in the ecosystem, its argument isn't JSON — it's raw text, constrained by a formal grammar. This note covers what that means, exactly how it's wired into the API, and what happens when you actually probe it against real endpoints.

Why a non-JSON tool exists at all

@monperrus
monperrus / README-gist.md
Last active August 8, 2026 07:53
Independent, open-data ranking of the world's largest scholarly publishers by citation impact

Most-cited publishers — independent measurement

Independent, reproducible ranking of the world's largest scholarly publishers by citation impact, in the spirit of open-impact-factor and open-h5: open data source, open computation logic, reproducible by anyone.

Publisher-level citation rankings are often self-reported by publishers themselves, computed on data and methodology nobody outside the company can