Serving MBTiles with datasette-media
2024-08-15
The [MBTiles](https://github.com/mapbox/mbtiles-spec) format uses SQLite to bundle map tiles for use with libraries such as Leaflet.
160 words
|
1 minute
Adding a CORS policy to an S3 bucket
2024-08-14
Amazon S3 buckets that are configured to work as public websites can support CORS, allowing assets such as JavaScript modules to be loaded by JavaS...
550 words
|
3 minutes
Ensure labels exist in a GitHub repository
2024-08-13
I wanted to ensure that when [this template repository](https://github.com/simonw/action-transcription) was used to create a new repo that repo wou...
161 words
|
1 minute
Registering new Datasette plugin hooks by defining them in other plugins
2024-08-13
I'm experimenting with a Datasette plugin that itself adds new plugin hooks which other plugins can then interact with.
150 words
|
1 minute
Combining substr and instr to extract text
2024-08-13
Derek Willis has [a Datasette instance full of political campaign emails](https://political-emails.herokuapp.com/) running on Heroku.
534 words
|
3 minutes
One-liner for running queries against CSV files with SQLite
2024-08-12
I figured out how to run a SQL query directly against a CSV file using the `sqlite3` command-line utility:
516 words
|
3 minutes
Calculating the AQI based on the Purple Air API for a sensor
2024-08-11
[Purple Air](https://www.purpleair.com/) sensors have an API at `https://www.purpleair.com/map.json?show=SENSOR-ID-HERE`, which returns JSON that l...
353 words
|
2 minutes
Using pprint() to print dictionaries while preserving their key order
2024-08-11
While parsing a CSV file using `csv.DictReader` today I noticed the following surprising result:
198 words
|
1 minute
Configuring auto-update for an Electron app
2024-08-11
This is _almost_ really simple. I used [electron/update-electron-app](https://github.com/electron/update-electron-app) for it, the instructions for...
391 words
|
2 minutes
Debugging a Click application using pdb
2024-08-11
This tip is for when you are working on a Python command-line application that runs using that program's name, as opposed to typing `python my_scri...
265 words
|
1 minute
Ordered group_concat() in SQLite
2024-08-11
I was trying to use `group_concat()` to glue together some column values into a stiched together Markdown document. My first attempt looked like this:
231 words
|
1 minute
Safely outputting JSON
2024-08-10
Carelessly including the output of `json.dumps()` in an HTML page can lead to an XSS hole, thanks to the following:
81 words
|
1 minute
Replicating SQLite with rqlite
2024-08-09
I tried out [rqlite](https://github.com/rqlite/rqlite) today, a "lightweight, distributed relational database, which uses SQLite as its storage eng...
323 words
|
2 minutes
Setting cache-control: max-age=31536000 with a Cloudflare Transform Rule
2024-08-06
I ran https://simonwillison.net/ through [PageSpeed Insights](https://pagespeed.web.dev/) and it warned me that my static assets were not being ser...
646 words
|
3 minutes
Constant-time comparison of strings in Node
2024-08-06
When comparing secrets, passwords etc it's important to use a constant-time compare function to avoid timing attacks.
116 words
|
1 minute
Redirecting a domain using Cloudflare Pages
2024-08-05
I wanted to redirect https://global-power-plants.datasettes.com/ to https://datasette.io/ - I decided to spin up a Cloudflare Pages site to do the ...
682 words
|
3 minutes
Limited JSON API for Google searches using Programmable Search Engine
2024-08-05
I figured out how to use a JSON API to run a very limited Google search today in a legit, non-screen-scraper way.
538 words
|
3 minutes
Loading lit from Skypack
2024-08-05
[Lit 2](https://lit.dev/blog/2021-09-21-announcing-lit-2/) stable was released today, offering a tiny, feature-full framework for constructing web ...
108 words
|
1 minute
Bulk editing status in GitHub Projects
2024-08-05
GitHub Projects has a mechanism for bulk updating the status of items, but it's pretty difficult to figure out how to do it.
137 words
|
1 minute
Saving an in-memory SQLite database to a file in Python
2024-08-05
I was messing around in Python with an in-memory SQLite database, when I decided I actually wanted to save my experimental database to a file so I ...
126 words
|
1 minute
Writing an Azure Function that serves all traffic to a subdomain
2024-08-04
[Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/) default to serving traffic from a path like `/api/FunctionName` - for ex...
157 words
|
1 minute
Remember to commit when using datasette.execute_write_fn()
2024-08-04
I was writing some code for [datasette-auth-tokens](https://github.com/simonw/datasette-auth-tokens) that used [db.execute_write_fn()](https://docs...
190 words
|
1 minute
shot-scraper for a subset of table columns
2024-08-04
For [Datasette issue #1844](https://github.com/simonw/datasette/issues/1844) I wanted to create the following screenshot:
249 words
|
1 minute
GitHub Pages: The Missing Manual
2024-08-04
[GitHub Pages](https://pages.github.com/) is an excellent free hosting platform, but the documentation is missing out on some crucial details.
519 words
|
3 minutes