Skip to content

Instantly share code, notes, and snippets.

/*
* default obsidian color palette
*
* .theme-dark {
* color-scheme: dark;
* --highlight-mix-blend-mode: lighten;
* --mono-rgb-0: 0, 0, 0;
* --mono-rgb-100: 255, 255, 255;
* --color-red-rgb: 251, 70, 76;
* --color-red: #fb464c;
@sueszli
sueszli / bench_convert_type.py
Last active April 26, 2026 16:27
xdsl: benchmark convert_type with vs without @cache (context: xdslproject/xdsl#5909)
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.12"
# dependencies = ["xdsl @ git+https://github.com/xdslproject/xdsl@d099652fb82c1abb47ed1880e644e44a620d970d", "llvmlite>=0.47"]
# ///
# Benchmark: does @cache on convert_type help?
# Run: uv run bench_convert_type.py
# Context: https://github.com/xdslproject/xdsl/pull/5909
import time
#!/usr/bin/env bash
# Repro for PR #5878 review: three tools disagree on fastmath on int-returning calls
set -u
MLIR=/tmp/hello-sasha.mlir
LL_FROM_MLIR=/tmp/hello-sasha.ll
BAD_LL=/tmp/bad.ll
cat > "$MLIR" <<'EOF'
module {
#!/usr/bin/env bash
# Reproduce: on a case-insensitive filesystem (macOS APFS default), two remote
# branches whose names differ only by letter case make `git fetch --prune`
# race itself and fail with:
# Unable to create '.../refs/remotes/origin/<name>.lock': File exists
#
# Self-contained. Builds throwaway repos under /tmp, triggers the failure,
# prints a tight summary, and cleans up. Safe to run repeatedly.
#
# Exit codes:
@sueszli
sueszli / run.ts
Created April 7, 2026 16:28
look ma no package.json
// bun run --install=fallback run.ts
import cowsay from "cowsay@1.6.0";
console.log(cowsay.say({ text: "look mom! no package.json needed" }));
#!/bin/bash
set -eEuo pipefail
TEST_FILE=tests/filecheck/mlir-conversion/with-mlir/backend/llvm/convert_op.mlir
mkdir -p "$(dirname "$TEST_FILE")"
cat > "$TEST_FILE" <<'EOF'
// RUN: mlir-translate --mlir-to-llvmir ../../../../backend/llvm/convert_op.mlir | filecheck ../../../../backend/llvm/convert_op.mlir
EOF

Plugins

Prefer LSP over Grep/Glob/Read for code navigation:

  • goToDefinition / goToImplementation to jump to source
  • findReferences to see all usages across the codebase
  • workspaceSymbol to find where something is defined
  • documentSymbol to list all symbols in a file
  • hover for type info without reading the file
  • incomingCalls / outgoingCalls for call hierarchy
for f in /opt/homebrew/opt/toilet/share/figlet/*.[tf]lf; do f=${f##*/}; toilet -t -f $f ${f%.*}; done
================================================================================
memref explained through C
================================================================================
Docs: https://mlir.llvm.org/docs/Dialects/MemRef/
SUMMARY
-------
memref = fat pointer (data pointer + shape + strides)
memref.cast = erase/assert static size. Same pointer, same data.
# /// script
# dependencies = ["exo-lang", "numpy"]
# ///
from __future__ import annotations
import ctypes
import subprocess
import tempfile
from pathlib import Path