Skip to content

Instantly share code, notes, and snippets.

View simonw's full-sized avatar

Simon Willison simonw

View GitHub Profile
{"type":"summary","summary":"Found largest .jsonl files with base64 images","leafUuid":"574136e4-d77c-4bee-b1c9-1eb5f69fc3d1"}
{"type":"file-history-snapshot","messageId":"62031857-21bf-427c-a27d-f0ddc5a7bd2e","snapshot":{"messageId":"62031857-21bf-427c-a27d-f0ddc5a7bd2e","trackedFileBackups":{},"timestamp":"2025-12-17T21:02:54.289Z"},"isSnapshotUpdate":false}
{"parentUuid":null,"isSidechain":false,"userType":"external","cwd":"/Users/simon/.claude","sessionId":"74496df8-85c3-41ed-861d-1115aecd792a","version":"2.0.71","gitBranch":"","type":"user","message":{"role":"user","content":"Write a Python script with no extra dependencies which I can run which finds the .jsonl file in this folder with the most recent modification date and shows me the first few interesting JSON strings from that file plus its date and its folder path and its size in KB and lets me say yes or no on if I want to publish it as a Gist. If I say yes it uses the gh CLI to create the gist with that file as the content and then figures out the
@simonw
simonw / test_cbor2.py
Created December 17, 2025 02:37
Run git clone https://github.com/cbor/test-vectors && cd test-vectors - then in that folder run: uv run test_cbor2.py
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "cbor2"
# ]
# ///
import base64
import datetime as dt
import json
@simonw
simonw / index.html
Created October 24, 2025 19:50
Terminal output HTML
<pre style="background: rgb(42, 42, 42); color: rgb(255, 255, 255); padding: 15px; border-radius: 4px;"><span style="color: rgb(255, 255, 255);">&gt; The terminal-to-html tool should include a checkbox for if the created </span>
<span style="color: rgb(255, 255, 255);">Gist should be private, and it should default to checked </span>
⏺<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> I'll help you add a privacy checkbox to the terminal-to-html tool. Let me</span>
<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> first explore the codebase to understand the current implementation.</span>
⏺<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 255, 255); background: rgb(0, 0, 0);">Search</span><span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);">(pattern: "**/terminal-to-html*")</span>
⏺<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 255, 255); background:
@simonw
simonw / index.html
Created October 24, 2025 19:20
Terminal output HTML
<pre style="background: rgb(42, 42, 42); color: rgb(255, 255, 255); padding: 15px; border-radius: 4px;"><span style="color: rgb(255, 255, 255);">&gt; The logic in AllowedResourcesView has got very complex, could that be refactored to use the new </span>
<span style="color: rgb(255, 255, 255);">datasette.allowed_resources methods? </span>
⏺<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> Good idea! Yes, the </span><span style="color: rgb(162, 168, 247); background: rgb(0, 0, 0);">AllowedResourcesView</span><span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> can be significantly simplified by using the </span><span style="color: rgb(162, 168, 247); background: rgb(0, 0, 0);">datasette.allowed_resources()</span>
<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> method. Let me refactor it:</span>
⏺<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 255, 255); background: rgb(0, 0, 0);">Read</span><span sty
@simonw
simonw / index.html
Created October 24, 2025 19:18
Terminal output HTML
<pre style="background: rgb(42, 42, 42); color: rgb(255, 255, 255); padding: 15px; border-radius: 4px;"><span style="color: rgb(255, 255, 255);">&gt; You broke some tests, try running test_permission_endpoints.py and test_utils_permissions.py </span>
⏺<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 255, 255); background: rgb(0, 0, 0);">Bash</span><span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);">(pytest tests/test_permission_endpoints.py tests/test_utils_permissions.py -xvs)</span>
<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> </span>⎿<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> </span> <span style="color: rgb(252, 81, 109); background: rgb(0, 0, 0);">Error: sys:1: RuntimeWarning: coroutine 'ds_with_permissions' was never awaited</span>
<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> </span><span style="color: rgb(252, 81, 109); background: rgb(0, 0, 0);">===========
@simonw
simonw / index.html
Created October 24, 2025 19:03
Terminal output HTML
<pre style="background: rgb(0, 0, 0); color: rgb(255, 255, 255); padding: 15px; border-radius: 4px;">⏺<span style="color: rgb(242, 242, 242);"> Great! Now I can return to implementing the </span><span style="color: rgb(162, 168, 247);">also_requires</span><span style="color: rgb(242, 242, 242);"> feature for execute-sql. Let me recap the plan:</span>
<span style="color: rgb(242, 242, 242);"> 1. Add an </span><span style="color: rgb(162, 168, 247);">also_requires</span><span style="color: rgb(242, 242, 242);"> field to the Action dataclass</span>
<span style="color: rgb(242, 242, 242);"> 2. Update </span><span style="color: rgb(162, 168, 247);">allowed_resources_sql()</span><span style="color: rgb(242, 242, 242);"> to handle the </span><span style="color: rgb(162, 168, 247);">also_requires</span><span style="color: rgb(242, 242, 242);"> field by generating both SQLs and combining them with an</span>
<span style="color: rgb(242, 242, 242);"> INNER JOIN in a CTE</span>
<span style="color: rgb(242, 242, 242)
@simonw
simonw / index.html
Created October 24, 2025 18:41
Terminal output HTML
<pre style="background: rgb(42, 42, 42); color: rgb(255, 255, 255); padding: 15px; border-radius: 4px;"><span style="color: rgb(255, 255, 255);">&gt; It strikes me that the thing where we namespace our parameters is the source of a whole lot of complexity - I think </span>
<span style="color: rgb(255, 255, 255);">that mechanism exists purely to avoid the unlikely case where two permissions plugins chose the same name for their </span>
<span style="color: rgb(255, 255, 255);">parameters. Maybe we could solve that with a naming convention that we tell plugin authors about instead? </span>
⏺<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 255, 255); background: rgb(0, 0, 0);">Excellent Point: Eliminate Parameter Namespacing Entirely</span>
<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> You're absolutely right! Let's trace through where parameter namespacing happens and why.</span>
⏺<span style="color: rgb(242, 242, 242); background:
@simonw
simonw / index.html
Created October 24, 2025 18:15
Terminal output HTML
<pre style="background: rgb(42, 42, 42); color: rgb(255, 255, 255); padding: 15px; border-radius: 4px;"><span style="color: rgb(255, 255, 255);">&gt; OK I am testing your fix - http://127.0.0.1:8001/-/rules.json?action=view-table&amp;page_size=50&amp;page=2 is working </span>
<span style="color: rgb(255, 255, 255);">correctly, I can see the deny rule at the end (I am accessing it as the root user) - but </span>
<span style="color: rgb(255, 255, 255);">http://127.0.0.1:8001/-/allowed.json?action=view-table&amp;page_size=50 for that root user is still listing those tables in </span>
<span style="color: rgb(255, 255, 255);">content even when actually navigating to http://127.0.0.1:8001/content or http://127.0.0.1:8001/content/repos shows a 403</span>
<span style="color: rgb(255, 255, 255);"> </span>
⏺<span style="color: rgb(242, 242, 242); background: rgb(0, 0, 0);"> Let me investigate this issue. The </span><span style="color: rgb(162, 168, 247); background: rgb(0, 0, 0);">/-/rules</span><span style="color: rg
@simonw
simonw / index.html
Created October 24, 2025 18:02
Terminal output HTML
<pre style="background: rgb(0, 0, 0); color: rgb(242, 242, 242); padding: 15px; border-radius: 4px;"><span style="color: rgb(242, 242, 242);">&gt; </span><span style="color: rgb(255, 255, 255); background: rgb(42, 42, 42);">Take a look at https://github.com/simonw/datasette/issues/2509 and </span><span style="color: rgb(227, 71, 70);">u</span><span style="color: rgb(240, 118, 70);">l</span><span style="color: rgb(247, 183, 77);">t</span><span style="color: rgb(129, 191, 111);">r</span><span style="color: rgb(112, 152, 212);">a</span><span style="color: rgb(136, 107, 188);">t</span><span style="color: rgb(186, 107, 165);">h</span><span style="color: rgb(227, 71, 70);">i</span><span style="color: rgb(240, 118, 70);">n</span><span style="color: rgb(247, 183, 77);">k</span><span style="color: rgb(255, 255, 255); background: rgb(42, 42, 42);"> about what is going on</span>
⏺<span style="color: rgb(242, 242, 242);"> </span><span style="color: rgb(255, 255, 255);">Fetch</span><span style="color: rgb(242, 242, 242);
@simonw
simonw / index.html
Created October 24, 2025 17:15
Terminal output HTML
<pre style="background: rgb(0, 0, 0); color: rgb(180, 36, 25); padding: 15px; border-radius: 4px;"><span style="color: rgb(180, 36, 25);">Error: Git working directory is not clean. Please commit or stash your changes before using --teleport.</span>
<span style="color: rgb(242, 242, 242);">(base) simon@Mac datasette-pretty-traces % </span>
<span style="color: rgb(242, 242, 242);">(base) simon@Mac datasette-pretty-traces % ls</span>
<span style="color: rgb(242, 242, 242);">datasette_pretty_traces Pipfile tests</span>
<span style="color: rgb(242, 242, 242);">datasette_pretty_traces.egg-info README.md</span>
<span style="color: rgb(242, 242, 242);">LICENSE setup.py</span>
<span style="color: rgb(242, 242, 242);">(base) simon@Mac datasette-pretty-traces % git status</span>
<span style="color: rgb(242, 242, 242);">On branch main</span>
<span style="color: rgb(242, 242, 242);">Your branch is up to date with 'origin/main'.</span>