Recipes

Step-by-step solutions for real development tasks.

699 published

Page 12 of 20

Find the Hot Path in Node with a CPU Flame Graph

Capture a sampling profile under load, read the flame graph width-first to find the widest frames, and verify the fix with a second capture.

~40 min
performance · nodejs · profiling

Flatten Nested JSON Arrays into Queryable Rows

Unwind arbitrary-depth arrays into flat rows with jq or Node streaming, keeping parent context and path provenance on every record.

~25 min
data · json · etl

Fuzz a JSON Parser with Property Tests

Generate random and adversarial inputs to assert your JSON handling never crashes and always round-trips valid documents.

~35 min
testing · fuzzing · javascript

Deduplicate Fuzzy-Matched Records Without Losing Real Rows

Generate similarity-scored candidate pairs, review the match threshold with humans, and merge duplicates through an auditable, reversible process.

~45 min
data · data-quality · deduplication

Gate Deployment on a Smoke Test Suite

Run a fast post-deploy smoke suite that exercises critical paths and blocks promotion when any check fails.

~35 min
testing · deployment · ops

Generate Realistic Test Data with Faker

Produce a million-row dataset with believable distributions, seeded reproducibility, and referential integrity, then load it with COPY.

~30 min
database · testing · tooling

Handle SIGINT Cleanup in a CLI

Trap interrupt signals to remove temporary files and flush progress so Ctrl-C does not leave a broken state.

~25 min
cli · nodejs · reliability

Audit and Harden sshd Configuration

Disable password and root login, restrict algorithms to current best practice, verify with ssh -Q and a controlled restart, and keep an escape session open.

~20 min
security · ssh · operations

Harden TLS Cipher Suites

Restrict a server to modern TLS versions and strong ciphers, then verify with a scanner and client handshake tests.

~30 min
tls · security · hardening

Harden a Base Image with Non-Root User and Read-Only Rootfs

Run containers as a dedicated UID with a read-only root filesystem, writable tmpfs mounts, and dropped capabilities verified by a breakout attempt.

~25 min
deploy · docker · security

Hunt Down idle in transaction Sessions in PostgreSQL

Find sessions holding a transaction open while doing nothing, measure their age and lock footprint, and close the leak at the application layer.

~30 min
database · postgresql · debugging

Hydrate Islands Progressively

Hydrate interactive components on idle or on visibility so static content is interactive without blocking the main thread.

~30 min
frontend · performance · hydration

Implement CLI Config Precedence

Define a clear precedence of flags over environment over config file over defaults so behaviour is predictable.

~30 min
cli · configuration · javascript

Implement Progressive Delivery Steps

Roll out a change in controlled increments with automated analysis between steps so a bad release is caught early.

~40 min
deployment · ops · reliability

Implement Webhook Signature Verification That Handles Time

Verify HMAC signatures with constant-time comparison, reject timestamps outside a tolerance window, and block replayed delivery ids.

~30 min
security · webhooks · api

Build an Incremental ETL Load with a Watermark Column

Track a monotonically increasing watermark, copy only rows past it, and make the job restartable by advancing the mark transactionally.

~40 min
data · etl · incremental

Inspect and Defragment etcd Safely

Check etcd database size and fragmentation, then defragment one member at a time with a backup first.

~40 min
etcd · kubernetes · maintenance

Inspect HTTP Cache Vary Header Mismatch

Detect a missing or wrong Vary header that serves one user language or encoding to another through a shared cache.

~30 min
http · caching · debugging

Inspect HTTP Keep-Alive Timeout Resets

Use packet capture to prove whether intermittent connection resets come from idle keep-alive timeouts on a proxy or the origin server.

~35 min
http · networking · debugging

Inspect WebSocket Frames with websocat

Connect to a live WebSocket endpoint with websocat, send handcrafted frames, watch server pushes arrive, and diagnose protocol issues the browser hides.

~20 min
api · websocket · debugging

Instrument Unit Tests with a Coverage Threshold

Enable coverage instrumentation and set an enforceable threshold so new code cannot merge below the agreed bar.

~25 min
testing · ci · coverage

Isolate HTTP 502 Upstream Reset

Correlate gateway access logs with upstream connection resets to prove which backend instance is closing connections early.

~30 min
http · debugging · reliability

Lazy-Load Route Chunks in Vite

Split routes into dynamic imports so the initial bundle stays small and heavy views load on demand.

~30 min
frontend · performance · vite

Diagnose Container CPU Throttling

Read cgroup throttling counters to prove whether a container's latency comes from CPU limits rather than slow code.

~30 min
container · performance · kubernetes

Manage Focus After SPA Navigation

Move focus to the new view heading on client-side navigation so keyboard and screen-reader users are not stranded.

~25 min
frontend · accessibility · spa

Measure PostgreSQL Index Bloat

Use pgstattuple and statistics to estimate index bloat and decide whether a REINDEX is worth the lock cost.

~30 min
postgresql · database · maintenance

Measure TLS Handshake Overhead and Session Reuse

Time full versus resumed TLS handshakes with curl and openssl, quantify the certificate chain cost, and decide where connection reuse pays off.

~20 min
api · performance · tls

Merge Multiple Parquet Files Safely

Consolidate many small Parquet files into fewer larger ones to cut metadata overhead and improve scan efficiency.

~30 min
data · parquet · storage

Migrate a Runtime Image to Distroless Safely

Shrink the attack surface by moving from a full base image to distroless, keeping debug shells reachable via a separate debug tag, and verify in CI.

~30 min
deploy · docker · security

Mine Access Logs for Status and Latency Anomalies

Turn nginx or app access logs into ranked tables of error rates, slow paths, and suspicious clients using only jq, awk, and sort.

~20 min
api · observability · shell

Mock Time with Sinon Fake Timers

Control time in tests with fake timers so debounce, retry, and timeout logic is deterministic instead of flaky.

~25 min
testing · javascript · timers

Measure Node Event Loop Delay Before Blaming the CPU

Track lag between scheduled and actual timer execution, correlate spikes with request logs, and find the synchronous code responsible.

~30 min
performance · nodejs · observability

Build Multi-Architecture Images with buildx

Build and push amd64 and arm64 variants in one command so the same tag runs on mixed clusters.

~35 min
container · docker · ops

Turn a Full Table Scan into a Covered Query in MySQL

Confirm the scan with EXPLAIN, design a composite covering index, and verify Extra shows Using index so the query never touches the row.

~30 min
database · mysql · performance

Reload nginx Without Dropping Connections

Use nginx -s reload with correct worker shutdown settings, verify old workers drain, and confirm zero 502s during configuration changes.

~20 min
deploy · nginx · operations

Optimize Array Deduplication with a Set

Replace O(n squared) deduplication loops with a hash set so large arrays dedupe in linear time.

~20 min
performance · algorithms · javascript