Search my code examples

Run searches against all of the code examples I have ever included on my blog.

Owned by simonw, visibility: Public

Query parameters

SQL query
with results_stripped as (
  select id, title,
    replace(replace(replace(replace(replace(regexp_replace(
      (regexp_matches(body, '<pre>(.*?)</pre>', 'g'))[1],
        E'<[^>]+>', '', 'gi'
      ), '&quot' || chr(59), '"'), '&gt' || chr(59), '>'), '&lt' || chr(59), '<'), '&#039' || chr(59), chr(39)), '&amp' || chr(59), '&'
    ) as code
  from
    blog_entry
  where
    body ~ '<pre>.*<pre>'
)
select id, title, code, 'https://simonwillison.net/e/' || id as link from results_stripped
where code like '%%' || %(search)s || '%%' order by id desc limit 10

10 rows

id title code link
8327 Interesting ideas in Observable Framework ```js echo const packageName = view(Inputs.select(packages, { value: "sqlite-utils", label: "Package" })); ``` https://simonwillison.net/e/8327
8327 Interesting ideas in Observable Framework ```js echo const packages_sql = "select package from stats group by package order by max(downloads) desc" ``` ```js echo const packages = fetch( `https://datasette.io/content.json?sql=${encodeURIComponent( packages_sql )}&_size=max&_shape=arrayfirst` ).then((r) => r.json()); ``` https://simonwillison.net/e/8327
8326 Weeknotes: Getting ready for NICAR dclient query https://datasette.io/content \ "select * from news limit 3" https://simonwillison.net/e/8326
8296 Embeddings: What they are and why they matter select id, llm_embed_cosine( embedding, ( select embedding from embeddings where id = 'sqlite_sqlite-tg.md' ) ) as score from embeddings order by score desc limit 5 https://simonwillison.net/e/8296
8296 Embeddings: What they are and why they matter select id, hex(embedding) from embeddings https://simonwillison.net/e/8296
8296 Embeddings: What they are and why they matter select id, llm_embed_decode(embedding) from embeddings limit 10 https://simonwillison.net/e/8296
8296 Embeddings: What they are and why they matter with input as ( select llm_embed( 'sentence-transformers/TaylorAI/gte-tiny', :input ) as e ) select id, content from embeddings, input where collection_id = ( select id from collections where name = 'functions' ) order by llm_embed_cosine(embedding, input.e) desc limit 5 https://simonwillison.net/e/8296
8287 LLM now provides tools for working with embeddings llm embed-multi notes \ -d notes.db \ --sql 'select id, title, body from notes' \ -m sentence-transformers/all-MiniLM-L6-v2 https://simonwillison.net/e/8287
8284 Datasette Cloud, Datasette 1.0a3, llm-mlc and more sqlite-utils install sqlite-utils-litecli sqlite-utils litecli data.db # ... Version: 1.9.0 Mail: https://groups.google.com/forum/#!forum/litecli-users GitHub: https://github.com/dbcli/litecli data.db> select jq('{"foo": "bar"}', '.foo') +------------------------------+ | jq('{"foo": "bar"}', '.foo') | +------------------------------+ | "bar" | +------------------------------+ 1 row in set Time: 0.031s https://simonwillison.net/e/8284
8284 Datasette Cloud, Datasette 1.0a3, llm-mlc and more sqlite-utils memory "select jq(:doc, :expr) as result" \ -p doc '{"foo": "bar"}' \ -p expr '.foo' https://simonwillison.net/e/8284
Copy and export data

Duration: 229.87ms