Skip to content

Instantly share code, notes, and snippets.

View MatrixManAtYrService's full-sized avatar

Matt Rixman MatrixManAtYrService

View GitHub Profile
@MatrixManAtYrService
MatrixManAtYrService / 0_introduction.md
Last active December 3, 2025 00:26
Nix Subflakes as a Substrate for Integration Testing

There's noting special about sub flakes here. You can build dependency graphs out of nix flakes whether or not they share a git repo. Using those graphs you can control which versions of which flakes come in contact with each other, and using that you can reason inductively about which version contains problematic code.

That's all I'm doing here.

But for the last year (since this was merged) it has been possible to have more than one flake in a repo. Since then I've been wanting to try structuring a project specifically with this kind of reasoning in mind.

Previously, the place for new tests was typically inside the same repo as what is being tested, so when you walked your repo back in time, you also ended up walking your tests back in time.

@MatrixManAtYrService
MatrixManAtYrService / claude.nix
Created March 16, 2025 04:54
claude code in a nix devshell
{ pkgs, claude-code-tarball, claude-code-version }:
pkgs.stdenv.mkDerivation {
name = "claude-code";
version = claude-code-version;
src = claude-code-tarball;
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/lib/node_modules/@anthropic-ai/claude-code

This gist contains notes that I took while installing NixOS onto a nanopi r5s. Many thanks to the kind folks in this issue who helped me along the way.

@MatrixManAtYrService
MatrixManAtYrService / deployment2csv.py
Last active December 26, 2024 20:03
Dumping Dag Runs from Astronomer to CSV
import airflow_client
from airflow_client.client.api import dag_api, dag_run_api
from datetime import datetime
import csv
import sys
from time import sleep
# you will need a different token than this one, see Workspace Settings -> Access Management to create one
token = "eyJhbGcREDACTED-Jjw6GJAp5A"
@MatrixManAtYrService
MatrixManAtYrService / fancydict.py
Last active June 5, 2024 22:14
Using generics and abstract base classes to create something like a dict which maps between two custom types
from abc import ABC, abstractmethod
from collections.abc import Iterator, MutableMapping
from pathlib import Path
from typing import Generic, TypeVar, cast, Type, Dict
from pydantic import BaseModel, Field
K = TypeVar('K', bound='Key')
V = TypeVar('V', bound='Value')

Some more of the standard library

You already know something about sys and pathlib. Now it's time to learn about venv.

venv creates virtual environments (which are a more lightweight than a virtual machine, but they're similar in how they isolate their contents from the rest of your system. This lets us install third-party libraries in a sane way. If you don't use them, things get cluttered quickly.

Please read/watch the following:

@MatrixManAtYrService
MatrixManAtYrService / flake.nix
Last active March 5, 2024 21:59
radicle in a nix devshell
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs?ref=23.11";
radicle.url = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5?ref=master";
};
outputs = { self, nixpkgs, flake-utils, radicle }:
flake-utils.lib.eachDefaultSystem (system:
let
@MatrixManAtYrService
MatrixManAtYrService / 1_intro.md
Last active March 1, 2024 20:44
libcst vs refactor, an unfair trial

This analysis of libcst vs refactor is incomplete. I probably won't come back and complete it (maybe your case warrants more analysis than my case did).

I had a difficult time with refactor a while back, so I recently tried libcst. I couldn't remember exactly why I had a difficult time, maybe I just didn't sleep well the night before or some kind of non-reason like that. Rather than justify this to myself, I just went with libcst.

I ended up with this:

from time import sleep
def main() -> None:
foo(
json={"code": 200, "response": data.dict(), # <-- missing '}'
headers={"Content-Type": "application/json"}
)
sleep(1) #<-- green
sleep(1)
sleep(1) #<-- white
@MatrixManAtYrService
MatrixManAtYrService / git.nix
Created February 6, 2024 03:54
home manager git config to use ssh instead of http for github
git = {
enable = true;
extraConfig = {
"url \"[email protected]:\"".insteadOf = "https://github.com/";
};
};