Skip to content

Instantly share code, notes, and snippets.

View lmmx's full-sized avatar
💡
lights, camera, action

Louis Maddox lmmx

💡
lights, camera, action
View GitHub Profile
@lmmx
lmmx / heisenberg_deuteron.toml
Last active May 31, 2025 17:16
Helix theme: Heisenberg deuteron
inherits = "heisenberg"
# "comment" = { fg = "teddy_bear_pink", modifiers = ["italic"] }
"comment" = { fg = "teddy_bear_pink_intense", modifiers = ["italic"] }
# "comment.line" = { fg = "teddy_bear_pink", modifiers = ["italic"] }
# "comment.block" = { fg = "hazmat_yellow" }
# "type.enum.variant" = { fg = "chili_powder_red" }
"type.enum.variant.builtin" = { fg = "chili_powder_red" }
"type.builtin" = { fg = "element_green" }
@lmmx
lmmx / README.md
Last active May 30, 2025 16:52
batcmd: Separate stdout and stderr with syntax highlighting

batcmd - Separate stdout and stderr with syntax highlighting

A bashrc shell function that runs any command and displays stdout and stderr as separate streams with bat syntax highlighting. Uses file descriptor swapping to cleanly separate the streams without temporary files or running the command twice.

Features:

  • Configurable syntax highlighting language
  • Clean separation with "STDOUT" and "STDERR" headers
  • Works with any command
  • No temporary files or command duplication
@lmmx
lmmx / fbb.rs
Last active May 26, 2025 15:36
Demo of the tracing crate to automatically trace function entry and exit (each function must have the `#[instrument]` attribute)
#!/usr/bin/env rust-script
//! Automatic function call tracing with parameters
//!
//! ```cargo
//! [dependencies]
//! tracing = "0.1"
//! tracing-subscriber = { version = "0.3", features = ["fmt"] }
//! ```
use tracing::instrument;
@lmmx
lmmx / guide.md
Last active May 23, 2025 11:49
DeepGEMM uv installation issue repro guide

Requires NVIDIA Hopper architecture GPU (sm_90a must be supported)

i.e. sm_86 (RTX 30x0 series) won't work, need RTX 40x0 series

Installation:

  • make two copies of the repo, call uv venv in one and use conda create in the other (use Python 3.11.11 for both)
mkdir deepgemm && cd deepgemm
@lmmx
lmmx / uninstall-old-rust-nightly.sh
Last active May 19, 2025 13:22
Uninstall old Rust nightly versions
# Keep the latest nightly and remove older dated nightlies
LATEST_DATE=$(rustup toolchain list | grep 'nightly-[0-9]' | sed 's/nightly-\([0-9-]*\).*/\1/' | sort -r | head -n 1)
# If we found dated nightlies, remove all except the most recent one
if [ -n "$LATEST_DATE" ]; then
for toolchain in $(rustup toolchain list | grep 'nightly-[0-9]' | grep -v "$LATEST_DATE"); do
echo "Removing old nightly: $toolchain"
rustup toolchain uninstall "$toolchain"
done
fi
@lmmx
lmmx / main.rs
Last active May 16, 2025 20:32
spez! macro monomorphisation to detect type parameterised Spans
//! ```cargo
//! [dependencies]
//! spez = "0.1.2"
//! ```
use spez::spez;
use core::marker::PhantomData;
#[derive(Debug)] pub enum Cooked {}
#[derive(Debug)] pub enum Raw {}
@lmmx
lmmx / helper.sh
Created May 10, 2025 15:29
Loop through workspace crates running tests one by one to review outputs
for x in *-*; do pushd $x >/dev/null; echo $x; cargo test -q --no-run; just -f ../Justfile -d . test; read dummyvar; popd; clear; done
@lmmx
lmmx / find-distinct-dup-versions.sh
Created May 8, 2025 16:59
Find Rust dependencies with distinctly versioned duplicates
cargo tree -e no-dev --duplicates --depth 0 | sed '/^$/d' | grep -v 'dependencies]' | uniq | cut -d ' ' -f 1 | uniq -d
@lmmx
lmmx / gh-set-upstream.sh
Created May 8, 2025 16:51
Set upstream on a repo you forked with gh after cloning
gh repo set-default $(git remote get-url upstream | sed 's/.*github.com[:/]\(.*\).git/\1/')
@lmmx
lmmx / sync_fork.sh
Created April 25, 2025 12:54
Sync your remote git repo with its upstream (default branch), so you can then pull the changes to your local repo
function sync-fork() {
local origin_url=$(git config --get remote.origin.url)
local fork_repo=""
if [[ $origin_url =~ github\.com[:/]([^/]+/[^/.]+) ]]; then
fork_repo="${BASH_REMATCH[1]}"
else
echo "Error: Could not parse origin remote URL"
return 1
fi
local upstream_url=$(git config --get remote.upstream.url)