Skip to content

Instantly share code, notes, and snippets.

{ lib, pkgs, ... }:
let
mkFallback = binaryName: pkg: pkgs.writeShellScriptBin binaryName ''
set -e
self="$0"
self_path=''${self%/${binaryName}}
stripped_path=$(echo "$PATH" | ${pkgs.gnused}/bin/sed -e "s;$self_path:*;;g")
PATH="$stripped_path" ${pkgs.which}/bin/which ${binaryName} > /dev/null 2>&1 && PATH=$stripped_path exec ${binaryName} "$@"
export PATH="$PATH:${lib.getBin pkg}/bin/"
{
pkgs ? import <nixpkgs> { },
lib ? pkgs.lib,
}:
with (import <nixpkgs/nixos/lib/qemu-flags.nix> { inherit pkgs; });
{
mkVM =
{
name,
config ? { },
@andir
andir / foo.el
Last active March 23, 2026 12:42
;;
;; * Corfu, Embark, Consult, Cape
;; Corfu enhances in-buffer completion by displaying a compact popup with current
;; candidates, positioned either below or above the point. Candidates can be
;; selected by navigating up or down.
#+begin_src emacs-lisp :tangle "post-init.el"
(use-package corfu
:ensure t
import sys
import os
from PIL import Image
import numpy as np
def recolor_blue_to_red(image_path):
img = Image.open(image_path)
# Preserve original format
@andir
andir / sm.md
Last active February 18, 2026 20:13

🧾 The Simple Sabotage Guide for Cloud-Native Organizations

(A Satirical Field Manual for Maximum Bureaucratic Drag)

General Principles

  1. Prefer Meetings Over Progress When a decision can be made in Slack, schedule a 60-minute Zoom. When a 60-minute Zoom will suffice, create a recurring weekly sync. Always conclude with: “Let’s take this offline.”
{ pkgs, lib, config, ... }:
let
inherit (lib) types;
sandboxOptions = types.submodule ({ name, ... }: {
options = {
packages = lib.mkOption {
type = types.listOf types.package;
default = [ ];
};
entryPoint = lib.mkOption {
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.h4ck.authorative-dns;
asBool = x: if x then "true" else "false";
# indent = n:
# let
# prefix = lib.concatStrings (map (_: " ") (lib.genList 0 n));
{ pkgs, system, inputs, lib, ... }:
let
targetPkgs = import inputs.unstable { inherit system; crossSystem = "aarch64-linux"; config.allowUnfree = true; };
in
lib.makeScope targetPkgs.newScope (self: with self; {
armTrustedFirmware = (targetPkgs.buildArmTrustedFirmware rec {
extraMakeFlags = [ "bl31" ];
platform = "rk3568";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf" ];
@andir
andir / spec.md
Last active December 9, 2025 00:30
{ config, lib, pkgs, ... }:
let
birdConfigVersion = lib.trace (lib.splitVersion lib.version) (let v = lib.splitVersion lib.version; f = lib.head v; s = lib.head (lib.tail v); in if f == "24" && (s == "11" || s == "05") then "2" else "");
inherit (lib)
attrValues
concatMapStringsSep
concatStrings
concatStringsSep
filterAttrs
flatten