Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

import random | |
import asyncio | |
from contextlib import asynccontextmanager | |
from typing import AsyncIterable, AsyncIterator, TypeVar | |
from anyio import create_memory_object_stream, create_task_group | |
from anyio.abc import ObjectReceiveStream, TaskStatus | |
from anyio.streams.memory import MemoryObjectSendStream | |
T = TypeVar("T") |
# YAML syntax highlight for the terminal. Just pipe YAML through it. | |
alias yc='yq -C eval-all' | |
# Less with YAML syntax highlighting | |
alias yless='yq -C eval-all | less -R' |
macOS 13 Ventura introduced support of running amd64 binaries with Rosetta inside of arm64 Linux VMs when using Apple Virtualization framework.
Lima VM v0.14.0 and later support the new feature.
Setup:
# Install Docker client and Lima
brew install docker docker-compose docker-credential-helper lima
import logging | |
import sys | |
from typing import List | |
import structlog | |
import uvicorn | |
from fastapi import FastAPI | |
from structlog.stdlib import ProcessorFormatter | |
from structlog.types import Processor |
# Copyright 2024 Gordon D. Thompson, [email protected] | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.
Then, you can use Structlog loggers or standard logging
loggers, and they both will be processed by the Structlog pipeline (see the hello()
endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!
Requests are assigned a correlation ID with the asgi-correlation-id
middleware (either captured from incoming request or generated on the fly).
All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented.
This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog.
You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom
Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.
Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.
The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.
Based on this blogpost.
To sign Git commits, you need a gpg key. GPG stands for GNU Privacy Guard and is the de facto implementation of the OpenPGP message format. PGP stands for ‘Pretty Good Privacy’ and is a standard to sign and encrypt messages.
Install with Homebrew:
$ brew install gpg