Code Snippets

All Snippets

The latest code snippets.

Find and Replace with sed

Edit a file in place with sed -i, replacing matches globally.

Author: chris

curl GET with JSON Response

Pipe a JSON response through jq for clean extraction.

Author: chris

Loop Over Files in a Directory

Iterate over matched files with a glob — safe with nullglob set.

Author: chris

SQLite with the sqlite3 Stdlib

Create a table, insert rows, and query with parameterized SQL.

Author: chris

Asyncio with aiohttp

Concurrent HTTP requests with asyncio.gather and aiohttp.

Author: chris