Skip to content

Instantly share code, notes, and snippets.

View bcdonadio's full-sized avatar
💼
Hard at work

Bernardo Donadio bcdonadio

💼
Hard at work
View GitHub Profile
#!/usr/bin/env bash
set -euo pipefail
renice -n 19 $$ >/dev/null || true
export TMPDIR="${TMPDIR:-$(pwd)/tmp}"
mkdir -p "${TMPDIR}" || true
# ============================================================
# Native build of PyTorch + vLLM + FlashInfer + LMCache

LLM Symbol Dictionary

Use this dictionary whenever referring to LLM hyperparameters, shapes, and efficiency metrics across this project. It is a unified superset covering gpt‑oss, qwen3, qwen3‑moe, llama3, llama4, gemma3, and seed‑oss. When a feature is unused, assign the trivial setting (e.g., dense models: $E{=}e{=}1$, $N_{L,\text{moe}}{=}0$; MQA: $h_{kv}{=}1$; tied embeddings: $\mathbb{1}_{\text{tie}}{=}1$).

Unit key: “[-]” dimensionless; “[#]” count; “[features]” channel width; “[tokens]” token length; “[bytes]”, “[FLOP/s]”, “[bytes/s]”.

1) Core transformer topology

  • $N_L$ — [#] Transformer block (layer) count.
  • $d$ — [features] Model hidden size (residual width).
  • $h_q,,h_{kv}$ — [#] Query heads and KV heads (GQA/MQA).
@bcdonadio
bcdonadio / sanding_paper_paste_comparison.md
Created June 18, 2025 10:41
Rough comparison between the median particulate size of sandpaper grits and diamond paste polishing compounds.

Abrasive Progression Ladder (Coarse → Fine)

Rank Abrasive Approx. Particle Size
1 P60 ≈ 269 µm
2 P80 ≈ 201 µm
3 P100 ≈ 162 µm
4 Diamond paste 75 µm 75 µm
5 P240 ≈ 58 µm
6 Diamond paste 45 µm 45 µm
@bcdonadio
bcdonadio / wacom-map.sh
Created June 18, 2025 05:17
Properly map a Wacom tablet to a given screen, even on Fedora 42.
#!/usr/bin/env bash
# ---------- USER TWEAKABLE CONSTANTS ----------
PATTERN="Wacom Intuos Pro L Pen" # substring to search for (case-insensitive)
MON="DP-4" # xrandr output to map to
ANCHOR="BOTTOM" # FULL|LEFT|RIGHT|TOP|BOTTOM
# ---------------------------------------------
set -euo pipefail
# Function to get monitor information

Keybase proof

I hereby claim:

  • I am bcdonadio on github.
  • I am bcdonadio (https://keybase.io/bcdonadio) on keybase.
  • I have a public key whose fingerprint is D6F5 6A78 FF53 9A35 C425 35EA A016 0768 C300 5604

To claim this, I am signing this object:

@bcdonadio
bcdonadio / netbox-inventory_test-results.out
Last active June 14, 2023 19:22
Unit test results of netbox-3.5.3 + netbox-inventory-1.3.2
| Found 5797 test(s).
| Creating test database for alias 'default'...
| System check identified no issues (0 silenced).
| .....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................FF.................................................................................................................................................................FF......................................FF..........................................................FF........................................
@bcdonadio
bcdonadio / link_multiple_devices.yaml
Last active May 30, 2023 04:45 — forked from aderusha/link_multiple_devices.yaml
Select multiple entities to link their on/off state. If any selected entity is turned on or off, the other selected entities will be sent a matching on or off command.
@bcdonadio
bcdonadio / static_cgo.md
Last active January 27, 2023 13:50 — forked from zmb3/static_cgo.md
Compile static binaries for Go programs that leverage Cgo.

In order to compile a fully static binary when using Cgo you'll need to use another standard C library like musl instead of the GNU libc, because Canonical and others simply decided that most of the whole damn point of using Golang, which is having a multi-platform and almost universal build toolchain, is simply not to their tastes.

A solution then is to do this messy thingy:

apt update && apt build-dep -y musl
MUSL_VER=2.2.2 # Matches Ubuntu 22.04 "Jammy" as of 2023-01-06
DIR=$(mktemp -d)
pushd $DIR
wget https://www.musl-libc.org/releases/musl-${MUSL_VER}.tar.gz -O musl.tar.gz
@bcdonadio
bcdonadio / nhs_install.sh
Created August 26, 2019 02:18
Install the NHS (https://www.nhs.com.br) UPS server software on Raspbian using qemu-user to emulate i386 arch on armv7l
#!/bin/bash
# Install the NHS (https://www.nhs.com.br) UPS server software on Raspbian
# using qemu-user to emulate i386 arch on armv7l
debRelease="stretch"
targetArch="i386"
serviceUser="nhsups"
zipURL="https://nhs.com.br/wp-content/uploads/2018/05/nhsups_3.1.36_x86_eGLIBC_2.11.zip"
installDir="/usr/local/nhs"
"""Test a tsuru deploy"""
from subprocess import Popen, PIPE, run
from tempfile import NamedTemporaryFile
import os
import yaml
CONFIGFILE = "config.yml"
TARGETFILE = os.environ["HOME"] + "/.tsuru/target"
class Tsuru(object):