- Thomas Tallis, "If Ye Love Me"
- SATB with piano reduction, 3 pages
| #!/usr/bin/env python3 | |
| # | |
| # Use VS Code themes on the Linux VT (text mode) console. I use this with the themes from | |
| # https://github.com/liviuschera/noctis | |
| # Usage: | |
| # 1) Download a theme JSON file | |
| # 2) python vscode-theme-to-linux-vt.py theme.json | sh | |
| # - or - | |
| # 2) python vscode-theme-to-linux-vt.py theme.json > theme.sh | |
| # 3) chmod +x theme.sh |
| #!/usr/bin/env -S uv run | |
| # /// script | |
| # requires-python = ">=3.14" | |
| # dependencies = [ | |
| # "html5lib", | |
| # "httpx", | |
| # ] | |
| # /// | |
| import lzma |
| FROM python:3.12-slim-bookworm | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | |
| RUN uv venv /v | |
| WORKDIR /v | |
| RUN env UV_TORCH_BACKEND=auto uv pip install torch numpy | |
| CMD /bin/bash |
| {'_PyEval_StartTheWorldAll', 'bio_sock_cleanup_int', 'AtForkPrepare', 'TclInitNamespaceSubsystem', 'ossl_comp_zlib_cleanup', 'ossl_trace_cleanup', '_PyEval_StopTheWorldAll', 'AtForkParent'} | |
| {'PyLzma_Free', 'BZ2_Free', 'PyZlib_Free'} | |
| {'mbstreamwriter_init', 'OSSL_trace_set_channel', 'mbidecoder_init', 'never_optimize', 'mbstreamreader_init', 'mbiencoder_init', 'ERR_func_error_string', 'PyExec_faulthandler'} | |
| {'EVPXOF_get_digest_size', 'long_get0'} | |
| {'EVP_KDF_free', 'evp_kdf_free'} | |
| {'EVP_KDF_up_ref', 'evp_kdf_up_ref'} | |
| {'evp_md_free', 'EVP_MD_free'} | |
| {'evp_md_free.cold', 'EVP_MD_free.cold'} | |
| {'bytearray_length', 'deque_len', 'array_length', 'mpd_getemin', 'list_length', 'dict_length', 'bytes_length', 'tuplelength', 'unicode_length', 'EVP_MD_get_flags'} | |
| {'EVP_MD_up_ref', 'evp_md_up_ref'} |
This is a combination of @dataclass and enum.Enum, inspired by https://blog.glyph.im/2025/01/active-enum.html . I didn't like that the syntax required making two classes, and naively combining @dataclass on an enum.Enum doesn't work (and is documented as such in the standard library docs).
The key insight is that all dataclass fields must be typed, and all enum members should not be typed, so we can unambiguously write something like this:
@dataenum
class SomeNumber:
result: int| *.so | |
| nixpkgs-* |
main.cc: A very abbreviated version of chapter 3 of the LLVM tutorial, hard-coding a single functionmain.py: A translation into Python using llvmlite, also hard-coding amainfunctionpycomp.py: A compiler for an extremely small subset of Python.
$ ../venv/bin/python3 pycomp.py < sourcecode.py
$ cc -o output output.o
$ ./output
24.000000
Quick setup instructions for building the code from Sy Brand's Building a Debugger on a machine with a working Nix installation. (There are many other perfectly good ways to get set up; if you don't already have Nix you might prefer to do something else.)
For Recursers, you can get to a machine with Nix by configuring your SSH key, waiting an hour or two, and doing ssh broome.cluster.recurse.com.
The author's worked source code is available on GitHub, so if you want to start partway through the book, do e.g.
git clone https://github.com/TartanLlama/sdb -b chapter-8
cd sdb| import operator | |
| class Bigger(type): | |
| def __new__(cls, op): | |
| self = super().__new__(cls, "spam", (), {}) | |
| self.op = op | |
| return self | |
| def __instancecheck__(self, instance): |