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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Debug DNS with dig
Compare recursive and authoritative answers, inspect status and TTLs, and distinguish DNSSEC signals from local validation.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.