Skip to content

Instantly share code, notes, and snippets.

@illustris
illustris / nix_cheat_sheet.md
Last active April 29, 2022 18:36
because I forget things

Nix

Get .drv for /etc/nixos/configuration.nix

nix-instantiate '<nixos>' -A system

Pretty print derivation

@illustris
illustris / easy_nixpkgs_testing.md
Created June 5, 2021 18:12
An easy way to test nixpkgs changes locally using nixos-container
[illustris@illustris-thinkpad:~/src/nixpkgs]$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

[illustris@illustris-thinkpad:~/src/nixpkgs]$ git remote -v
origin  git@github.com:illustris/nixpkgs.git (fetch)
origin  git@github.com:illustris/nixpkgs.git (push)
@illustris
illustris / join_prom_metrics.md
Created August 25, 2022 14:52
Join prom metrics

Example metrics:

# HELP node_hwmon_sensor_label Label for given chip and sensor
# TYPE node_hwmon_sensor_label gauge
node_hwmon_sensor_label{chip="pci0000:00_0000:00:18_3",label="tccd1",sensor="temp3"} 1
node_hwmon_sensor_label{chip="pci0000:00_0000:00:18_3",label="tccd2",sensor="temp4"} 1
node_hwmon_sensor_label{chip="pci0000:00_0000:00:18_3",label="tccd3",sensor="temp5"} 1
node_hwmon_sensor_label{chip="pci0000:00_0000:00:18_3",label="tccd4",sensor="temp6"} 1
node_hwmon_sensor_label{chip="pci0000:00_0000:00:18_3",label="tccd5",sensor="temp7"} 1
node_hwmon_sensor_label{chip="pci0000:00_0000:00:18_3",label="tccd6",sensor="temp8"} 1
import sys
import functools
callstack = []
@functools.cache
def lookup(func):
try:
parts = func.split(":")
with open(parts[0]) as f:
@illustris
illustris / biosnoop.bt
Created February 11, 2024 06:38
biosnoop with more details
#!/usr/bin/env bpftrace
/*
* biosnoop.bt Block I/O tracing tool, showing per I/O latency.
* For Linux, uses bpftrace, eBPF.
*
* TODO: switch to block tracepoints. Add offset and size columns.
*
* This is a bpftrace version of the bcc tool of the same name.
*
* 15-Nov-2017 Brendan Gregg Created this.