Recipes

Step-by-step solutions for real development tasks.

699 published

Page 14 of 20

Review sudoers for Privilege Escalation Paths

Dump effective sudo rules per user, hunt wildcard and NOPASSWD grants that escape their intent, and tighten them with command argument pinning.

~30 min
security · linux · hardening

Roll Forward a Failed DB Migration

Prefer a corrective forward migration over a rollback when a schema change has already run, to avoid data-loss surprises.

~35 min
database · migration · ops

Roll Back a Bad Deployment with kubectl rollout undo

Inspect revision history, undo to the last good revision by number, and verify the rollback actually landed by comparing live pod specs.

~15 min
deploy · kubernetes · rollback

Roll Out a Content Security Policy via Report-Only

Deploy a strict CSP in report-only mode first, collect violation reports from real users, fix the causes, then enforce once reports fall silent.

~30 min
security · web · headers

Rotate a Live API Key Without Downtime

Issue a second key, deploy dual-key acceptance, shift traffic to the new key, then revoke the old one after a quiet observation window.

~30 min
security · secrets · operations

Rotate SSH Authorized Keys Safely

Roll SSH authorized keys with an overlap window so each operator can verify their new key before the old one is removed.

~30 min
ssh · security · operations

Run E2E Tests Against docker compose

Spin up the full stack with docker compose in CI, wait for readiness, run E2E tests, and tear everything down deterministically.

~40 min
testing · docker · e2e

Run a Bulk Delete with a Checkpoint Table and Dry Run

Stage the doomed rows into a checkpoint table, review the dry-run count, delete in bounded batches, and keep an instant restore path.

~45 min
database · postgres · operations

Sanitize User-Submitted HTML with DOMPurify

Clean rich-text input on the server with a strict allow-list, keep hooks for URL schemes, and prove the result with XSS payload tests.

~30 min
security · web · xss

Scaffold Projects from Templates with Variable Substitution

Build a template directory with delimited placeholders, substitute values safely without regex injection, and verify the result compiles.

~35 min
cli · developer-experience · templates

Scan Dependencies with OSV-Scanner

Scan lockfiles and container images for known vulnerabilities with OSV-Scanner and fail CI only on actionable findings.

~30 min
security · supply-chain · testing

Schedule an ECS Task with EventBridge

Run a periodic containerised job on a schedule with EventBridge rules and verify retries and logging.

~40 min
aws · ops · scheduling

Scrub PII from a Dataset with pandas

Detect and pseudonymise direct identifiers in a dataframe before sharing it with analysts.

~35 min
data · privacy · pandas

Make Randomized Tests Reproducible with Seeds

Route all randomness through one seeded generator, print the seed on failure, and replay the exact failing sequence with one flag.

~30 min
testing · determinism · ci

Set Statement Timeout per Role

Apply a default statement_timeout to reporting roles so a runaway query cannot monopolise connections and starve the pool.

~25 min
postgresql · database · operations

Deploy from GitHub Actions Without Long-Lived Keys

Replace stored cloud credentials with OIDC federation, scope the trust policy to your repo and environment, and verify no secrets remain.

~30 min
deploy · ci · security

Shard Tests Across Parallel Databases for Speed

Give each test shard its own schema or database, run shards concurrently, and eliminate cross-test interference that serial runners hid.

~30 min
testing · ci · databases

Detect and Shrink a Bloated Postgres Table

Estimate dead tuple bloat with pgstattuple, reclaim space without exclusive locks using pg_repack, and verify the size actually dropped.

~50 min
database · postgres · operations

Shrink SQLite with Page Reclaim

Lower the page size and auto_vacuum settings to reclaim free pages and keep a local SQLite file compact between maintenance runs.

~25 min
sqlite · database · maintenance

Sign and Verify Release Artifacts

Sign release binaries and container images with a keyless signature and verify them at deploy time to block tampered artifacts.

~35 min
supply-chain · security · ops

Design Skeleton Loading That Tells the Truth

Match skeleton geometry to the real content layout, avoid fake progress bars, and measure perceived completion against actual readiness.

~30 min
frontend · ux · performance

Snapshot REST API Contracts

Capture normalised response snapshots for REST endpoints so unintended contract changes fail review instead of reaching clients.

~30 min
testing · api · contract

Speed Up Bulk Inserts with COPY Instead of Row-by-Row

Replace thousands of single INSERT round trips with one COPY stream, measure the difference, and keep the loader resumable and idempotent.

~30 min
database · postgres · performance

Tune SQLite WAL Mode for Concurrent Readers and a Writer

Enable WAL journaling, set busy_timeout and synchronous pragmas, and prove readers keep working while a write transaction commits.

~20 min
database · sqlite · concurrency

Standardize Timestamps and Timezones in a Dirty Dataset

Detect mixed formats and zone-less entries, normalize everything to UTC instants, and keep the original string alongside for audit.

~40 min
data · timestamps · data-quality

Transform Gigabyte Files with Constant Memory Streams

Replace readFileSync loops with pipeline streams, apply backpressure-aware transforms, and verify output equivalence on a sample.

~35 min
data · nodejs · streaming

Stub Third-Party API Failures to Prove Client Resilience

Spin up WireMock with fault scenarios for latency, 500s, and 429 throttling, point the client at it, and prove retries, timeouts, and fallbacks actually work.

~40 min
api · resilience · testing

Template an Idempotent Ansible Role

Write an Ansible role that converges to the same state on repeated runs, using declarative modules instead of shell tasks.

~35 min
ansible · ops · automation

Test Error Branches with Injected Failures

Inject dependency failures at call boundaries to exercise catch and fallback paths that normal runs never reach.

~30 min
testing · reliability · error-handling

Test Graceful Shutdown Signal Handling

Assert that a service stops accepting new work, drains in-flight requests, and exits within the shutdown deadline on SIGTERM.

~30 min
testing · reliability · nodejs

Trace API 429 Throttling Windows

Align 429 responses with rate-limit headers to reconstruct the client quota window and stop retries from extending the lockout.

~30 min
api · rate-limit · debugging

Trace One Request Across Services with a Correlation ID

Propagate a single x-request-id through gateway, service, and job tiers, then stitch per-service logs into one timeline to find the slow hop.

~25 min
api · observability · logging

Break a Slow HTTP Response into DNS, TLS, and Server Time

Use the curl write-out timer to split one slow request into name lookup, connect, TLS, time-to-first-byte, and transfer phases, then aim the fix at the right layer.

~15 min
api · performance · debugging

Track Deployments in Sentry to Correlate Errors with Releases

Send release events from CI, tag each deploy with git SHA and environment, and use release stats to catch error-rate regressions within minutes.

~25 min
deploy · observability · ci

Track GraphQL Operation Usage to Find Abusive Queries

Fingerprint every GraphQL operation by name and hash, aggregate call counts and depth, and spot the one client sending giant or unbounded queries.

~35 min
api · graphql · observability

Transform CSV to NDJSON in a Stream

Convert a large CSV to newline-delimited JSON with a streaming reader and writer so memory stays flat regardless of file size.

~25 min
data · python · etl