The practical details

Notes

One question, a working example, and the reason it works. Shorter reads for the task in front of you.

36 notes, newest first

  1. Note3 min read

    Find what makes a page interaction slow

    Use Event Timing to separate input delay, handler work and presentation delay, then correlate slow interactions with long animation frames and a DevTools trace.

  2. Note4 min read

    Set up passkeys: the minimum server checks

    Generate fresh challenges, bind them to the ceremony, and verify origin, RP ID, flags and signatures before creating a session or storing a credential.

  3. Note3 min read

    Find why Node and V8 deoptimize a function

    Use V8 optimization traces to identify the invalidated assumption, then reproduce it with a controlled input change before changing application code.

  4. Note4 min read

    Send a Web Push notification from Node

    Generate a VAPID identity, save a browser subscription, and build an encrypted push request with Node crypto before sending it to the subscription endpoint.

  5. Note3 min read

    Write a minimal MCP server with the TypeScript v2 SDK

    Register a schema-validated tool with @modelcontextprotocol/server and connect it over stdio. Use MCP Inspector to list and call the tool.

  6. Note3 min read

    Transcribe audio locally with word timestamps

    Use faster-whisper with word_timestamps and VAD, consume its segment generator, and preserve source-time offsets. Choose model size and compute type for your machine.

  7. Note3 min read

    Measure LLM tokens per second without mixing workloads

    Report prefill throughput, decode throughput and time to first token separately. A bandwidth estimate gives an optimistic bound for small-batch dense decoding.

  8. Note3 min read

    Tune pgvector HNSW for recall and filtered queries

    Start with default graph settings, tune ef_search against exact results, and enable iterative scans for filtered queries. Build memory and graph construction settings solve different problems.

  9. Note3 min read

    Choose cosine, dot product or L2 for embeddings

    For unit-normalized embeddings, cosine similarity, dot product and squared L2 produce the same ranking. Match your index operator and ordering to the embedding model.

  10. Note3 min read

    Choose Q4_K_M, Q5_K_M or Q8_0 with a same-model test

    Compare exact GGUF file sizes, benchmark all three with fixed settings, and reject candidates that fail a quality threshold. A Llama 3 8B example favors Q5_K_M under a six-GiB weight budget.

  11. Note3 min read

    Estimate KV-cache memory before loading a model

    Compute GQA cache bytes from layer count, KV heads, head dimension and retained tokens. Use a separate latent-cache calculation for MLA models.

  12. Note3 min read

    Count prompt tokens with the model’s tokenizer

    Use tiktoken for a known OpenAI encoding or a Hugging Face checkpoint’s tokenizer files. Reserve output space and account for chat templates before checking context and cost.

  13. Note4 min read

    Cache-Control recipes that actually work

    Choose response directives by whether data is public, how long staleness is acceptable, and whether a stored response may be reused without validation.

  14. Note3 min read

    SSE vs WebSockets vs long polling

    Use SSE for server-to-page text updates, WebSockets for bidirectional streams, and long polling when ordinary request handling is the simplest fit.

  15. Note3 min read

    Check whether a site uses HTTP/3

    Check client support, inspect HTTP/3 advertisements, then confirm the actual connection protocol with curl or browser DevTools.

  16. Note3 min read

    Read a TLS handshake from the command line

    Use OpenSSL to check the certificate chain, hostname and negotiated parameters; use curl to see the HTTP request on the same connection.

  17. Note3 min read

    Debug DNS with dig

    Compare recursive and authoritative answers, inspect status and TTLs, and distinguish DNSSEC signals from local validation.

  18. Note3 min read

    Cross-compile C and Zig with Zig 0.17.1

    Select the target explicitly with zig cc -target or a build script using standardTargetOptions. Verify the file format separately from whether the artifact runs on the target.

  19. Note4 min read

    Fix “borrowed value does not live long enough” in Rust

    Keep the owner alive through the last borrow use, or return owned data. Five examples cover locals, borrowed structs, closures, temporaries and iterators.

  20. Note3 min read

    Tune Go GC with GOGC and GOMEMLIMIT

    Use GOGC to trade heap growth for collection frequency and GOMEMLIMIT to constrain Go-managed memory. Set container headroom explicitly: Go 1.27.3 does not derive this limit from cgroups.

  21. Note3 min read

    Find and fix a goroutine leak in Go

    Compare goroutine stacks after work has drained, identify the missing exit path, and cancel and join workers before returning.

  22. Note3 min read

    Detect false sharing with a runnable C benchmark

    Compare adjacent atomic counters with cache-line-separated counters, then use perf c2c to locate contended lines when PMU access is available.

  23. Note3 min read

    Why ldd is unsafe on untrusted binaries

    Inspect ELF dependency metadata with readelf or objdump instead of invoking the loader. Use LD_DEBUG only when you intentionally execute a trusted program.

  24. Note3 min read

    Find what a process is waiting on with strace

    Trace the blocked syscall, follow its file descriptor and identify the thread or peer that must wake it. Use syscall duration rather than summary CPU time to measure waiting.

  25. Note3 min read

    Check an Ansible inventory before changing hosts

    Use a project-local inventory, test SSH and Python connectivity, then preview a small privileged playbook. Keep package refreshes separate from upgrades.

  26. Note2 min read

    Turn a small CSV into a reliable pandas summary

    Read, clean, filter and aggregate one complete dataset. Use explicit types, safe assignment and month-end resampling without disconnected snippets.

  27. Note3 min read

    Put card buttons beside links, not inside them

    Give navigation and actions separate HTML controls. A sibling link and button work with the mouse, keyboard and assistive technology without event-cancellation patches.

  28. Note3 min read

    CORS: a practical response-header checklist

    Diagnose a blocked browser fetch by checking the origin, preflight response and credential policy. CORS controls what scripts can read; it does not authenticate a request.

  29. Note3 min read

    Run a Kubernetes CronJob once, on demand

    Create a separate Job from a CronJob template, follow its logs and distinguish a successful run from a failed one. The schedule stays unchanged.

  30. Note2 min read

    Share Django timestamps and UUIDs with abstract models

    Use small abstract models for repeated fields, then account for the save paths that do not update timestamps. UUIDs change identifiers, not authorization.

  31. Note3 min read

    Replace Wagtail ModelAdmin with a ModelViewSet

    Expose a small Django model in the Wagtail admin using the built-in ModelViewSet. Choose list columns, search fields and form fields explicitly.

  32. Note3 min read

    Build a small MicroK8s cluster on Raspberry Pi

    Prepare 64-bit Pi nodes, join them deliberately and verify cluster health. Worker count, control-plane availability and durable storage are separate decisions.

  33. Note3 min read

    Boot a Raspberry Pi 4 or 5 from USB storage

    Check boot order before reflashing anything, prepare a separate USB system disk and diagnose power or adapter problems independently of the bootloader.

  34. Note3 min read

    Validate an Ory Kratos username with an identity schema

    Constrain a username to 4–20 ASCII letters, digits or underscores. Put the rule in the identity schema and distinguish validation from identifier uniqueness.

  35. Note3 min read

    Use Recreate when a Deployment cannot overlap its Pods

    Fix a rollout that needs the old Pods gone before new ones start. Configure the Deployment strategy, then check what your Helm chart actually renders.

  36. Note3 min read

    Revalidate Next.js pages after Wagtail publishes

    Send an authenticated POST after the CMS transaction commits. Revalidate the public path and register receivers for concrete Wagtail page models.