Guides

Not just "how to write the command", but "what to do when things break". Original long-form troubleshooting and best-practice articles from the LaoHand team, with copy-ready commands.

Git Accident Recovery: Fix Wrong Commits, Wrong Branches and Deleted Branches

The scariest moment in daily work is "oh no, I messed up a commit or branch". This guide gives copy-ready recovery commands for real accident scenarios, with clear safety boundaries for each.

8 min readUpdated 2026-08-24By LaoHand Team
Read →

Docker Image Slimming: 5 Steps from 1.2GB to 120MB

Bigger images mean slower pulls, larger attack surface and higher storage cost. This guide gives 5 immediately applicable slimming steps, each with a reusable Dockerfile snippet and a verification command.

7 min readUpdated 2026-08-24By LaoHand Team
Read →

Nginx 502 Bad Gateway? Locate It in 5 Steps

A 502 means Nginx itself is fine but got an invalid response from the upstream (backend/proxy). This guide gives the shortest path: process → config → timeout → resources → logs.

6 min readUpdated 2026-08-24By LaoHand Team
Read →

Linux Disk Full: Locate the Real Culprit with df, du and lsof

A "No space left on device" error does not mean you should delete files at random. This guide walks through the full path — filesystem water level, directory drill-down, and "deleted but still held" files — plus a safe cleanup order that will not destroy data.

8 min readUpdated 2026-08-30By LaoHand Team
Read →

Linux CPU at 100%: the Shortest Path from top to the Thread Stack

"Restart fixes everything" is the most expensive option when CPU is pegged. This guide gives a reusable path: classify the load, pin the thread, capture what it is executing, then act — with dedicated tools for Java, Python and Go.

8 min readUpdated 2026-08-30By LaoHand Team
Read →

MySQL Slow Query Tuning: Slow Log, EXPLAIN and Indexing

"The database is slow" usually means a handful of slow SQL statements. This guide offers a repeatable flow: use the slow log to circle the most expensive queries, read the plan with EXPLAIN, decide whether an index pays off, and spot the most common index-defeating patterns.

9 min readUpdated 2026-08-30By LaoHand Team
Read →

Redis Slowdown Playbook: Big Keys, Blocking Commands and Eviction

Redis processes commands on a single thread, so one blocking hotspot slows the whole instance. This guide follows the order "memory level → big keys → blocking commands → eviction and persistence", each step with copy-ready commands.

8 min readUpdated 2026-08-30By LaoHand Team
Read →

Kubernetes CrashLoopBackOff: Diagnose a Restart-Looping Pod in 5 Steps

CrashLoopBackOff is not one error but a state: the container dies on start, and Kubernetes retries with backoff. This guide gives the shortest path — exit code → previous logs → probes → resources → dependencies.

8 min readUpdated 2026-08-30By LaoHand Team
Read →

SSH Passwordless Login: from ssh-keygen to Permission denied

Passwordless SSH boils down to one sentence: put the public key into the remote authorized_keys. What blocks you is usually the three hidden gates — file permissions, the home directory, and SELinux. This guide covers the full setup and a step-by-step debugging path.

7 min readUpdated 2026-08-30By LaoHand Team
Read →

Python Virtual Environments in Practice: venv, Dependency Pinning and Cross-Platform Gotchas

"Works on my machine" usually means mixed environments. This guide builds a clean flow with the stdlib venv: create, activate, pin and reproduce — plus the three frequent pitfalls: Windows activation, version drift and cross-platform dependencies.

8 min readUpdated 2026-08-30By LaoHand Team
Read →

VSCode Remote Development: Remote-SSH Setup and Connection Debugging

A weak laptop, code on an intranet server, GPUs in the cluster — Remote-SSH keeps the UI local while code and terminal run remotely, feeling native. This guide covers setup, passwordless auth, common connection failures and experience tuning.

7 min readUpdated 2026-08-30By LaoHand Team
Read →

Bash Script Safety: set -euo pipefail and trap for Trustworthy Scripts

A Bash script that "finishes" is not a script that "worked": failed commands do not stop it, empty variables pass silently, and pipes hide upstream crashes. This guide fixes all of them with a copy-ready skeleton (set -euo pipefail + trap + quoting discipline).

7 min readUpdated 2026-08-31By LaoHand Team
Read →

YAML Gotchas: Type Coercion, Indentation and Multiline Strings

YAML files that "look right but run wrong" usually fail in three places: silently coerced scalars, misplaced indentation, and ambiguous multiline strings. This guide dissects each trap with detection methods and a toolchain.

8 min readUpdated 2026-08-31By LaoHand Team
Read →

HTTP Caching in Practice: Configuring Cache-Control and ETag Correctly

Misconfigured caching ends one of two ways: users never see updates, or origin traffic explodes. This guide covers the split between freshness and validation caching, the hashed-asset vs HTML strategy divide, plus ready-to-use Nginx config and verification commands.

8 min readUpdated 2026-08-31By LaoHand Team
Read →

Git Merge and Rebase Conflict Resolution in Practice

For developers branching daily, this guide reads merge conflict markers end to end with reproducible cases and shows how to handle merge, rebase, and rename conflicts.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

Bisecting: Pinpoint the Commit That Introduced a Bug

For anyone tired of hunting commits by gut feel, this is the binary-search way to find the commit that broke something, including making the check scriptable so bisect runs hands-free.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Git Submodule Management and Its Common Traps

A field guide to when a submodule actually makes sense, how to add, clone, and update it, and the standard escape hatches for empty dirs after clone, branch drift, and nesting.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Parallel Development with git worktree: Multiple Branches at Once

For devs juggling several branches who fear stash chaos while switching, here is how to keep one clean worktree per task and never stash-swap again.

6 min readUpdated 2026-09-06By LaoHand Team
Read →

docker compose Multi-Service Integration and Startup Troubleshooting

Getting to the bottom of ordering, environment variables, port collisions, and service-name DNS inside the compose network, with copyable yaml and debugging commands.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

Kubernetes HPA: Configuring and Verifying Autoscaling

For engineers comfortable with Deployments but new to autoscaling: from installing metrics-server, writing an HPA, to load-testing and actually watching replicas scale out.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

Dockerfile Security Hardening: Shrinking the Attack Surface

A landing checklist for image maintainers and service containerizers: non-root user, read-only root FS, dropping capabilities, layer hygiene, and image scanning.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

JavaScript Error Handling: From try/catch to Global Fallbacks and Retry

A practical catalog for backend and full-stack JS: catching sync and async errors, Promise unhandledrejection, global fallbacks, and exponential-backoff retries.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Python Packaging and Dependency Locking: From pyproject.toml to PyPI

For turning scripts into publishable packages: pyproject.toml for metadata, venv isolation, lock files for reproducible environments, and releasing to PyPI with twine.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

Linux Memory Exhaustion and OOM Hunting: From dmesg to the Process Likely Out of Control

When a server claims it is out of memory it rarely tells the whole truth; this guide shows how to use free, /proc/meminfo, cgroups, and dmesg to close in on the process actually eating memory, and how to configure against recurring OOM kills.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

Linux Network Troubleshooting Field Manual: Connectivity, Packet Loss, Latency, and DNS

From unreachable pings to crawling slowness and flaky domain resolution, this guide walks layer by layer—link, IP, transport, application—showing which command and which field to look at, with copy-run experiments along the way.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

Debugging systemd Service Startup Failures: From status and Dependencies to Ordering Deadlocks

systemctl is-failed is just the first step; this guide splits failures into four kinds—launcher error, process instantly exiting, dependency not ready, and port never listening—with the right log entry and fix for each.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Linux File Permissions and sudo in Practice: chmod/ACL/setuid and Privilege Boundaries

From bit permissions to ACLs to why setuid exists, this guide clarifies exactly how read/write/execute are computed, when the special bits backfire, and why sudo should not be a blanket ALL—plus a safer habit before you break something.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Nginx Reverse Proxy in Practice: location Priority, proxy_pass, and Upstream Balancing Done Right

Misconfigured proxies usually come down to location matching order and trailing-slash traps; this guide corrects the most commonly botched configs line by line and walks you through wiring a real Node backend into a load-balanced reverse proxy.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

HTTPS Certificates and Let's Encrypt Auto-Renewal: From Issuance to a cron Fallback

Manually requesting a cert is easy; the hard part is renewing it before expiry automatically. This guide walks certbot through webroot and HTTP-01 validation, configures renewal on port 80, and pairs it with two fallbacks so missing a renewal still does not take the site down.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Debugging REST APIs End-to-End with curl: Methods, Headers, Auth, Upload, and Diagnosis

curl is the first scene of most API debugging; this guide starts from "see exactly what a request sent", covering GET/POST, query vs body, Bearer/JWT auth, Multipart uploads, and reading status code plus timing from one response.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

MySQL Logical Backup and Restore: mysqldump, Faster Imports, and Recovering from Accidental Deletes

Exporting with mysqldump is easy; the hard parts are whether the dump restores cleanly, whether the restores fast enough, and whether an accidental delete comes back. This guide covers consistency flags, single-transaction isolation, import-acceleration knobs, and a binlog-based recovery flow.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

PostgreSQL Slow-Query Diagnosis and Tuning: From EXPLAIN to shared_buffers

Slow query tuning is a three-step ladder: find the query, read the plan, tune the config. This guide covers enabling the slow log, telling Seq Scan from Index Scan in EXPLAIN, and the core knobs that give the best bang for buck on buffers and concurrency.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

Cache Penetration, Breakdown and Avalanche: Identify and Protect Three Redis Faults

When your API suddenly slows down or your database collapses, three kinds of cache faults are usually to blame. This guide uses realistic log symptoms to help you tell apart penetration, breakdown and avalanche, then lays out practical defenses including mutex locks, null-caching and never-expiring hot keys.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

MySQL Index Design and EXPLAIN Analysis: From Wasteful to Zero Slow Queries

You keep adding indexes yet slow queries do not go away — that usually means the indexes themselves are misdesigned. Starting from real business SQL, this guide covers composite index column order, covering indexes and index-failure scenarios, then walks through EXPLAIN output section by section so you can actually read a plan.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

tmux Session Management and Reuse: Remote Dev That Survives SSH Drops

One dropped SSH and a half-run build, open files and a dozen panes are all gone. This guide shows how tmux named sessions, detach/attach reuse and window/pane layout let you reconnect after a network drop and pick up exactly where you left off.

6 min readUpdated 2026-09-06By LaoHand Team
Read →

VSCode Debugging Primer: From launch.json to Hovering Over a Variable

Compared with sprinkling console.log everywhere, debugging lets you pause and inspect the call stack and every variable at each step. Starting from editing launch.json, this guide gets Node and front-end projects debugging, then walks through the sidebar, watch expressions and conditional breakpoints.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Environment Variables and .env Management: Practical Details Beyond 12-Factor

Secrets in code, environment variables drifting across environments, and .env committed to git — almost every project trips on these. Following the 12-factor principle, this guide clarifies precedence, injection methods, and how to manage local and CI config safely.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Prettier and ESLint Together: Formatting and Linting That Do Not Fight

Prettier handles formatting and ESLint enforces quality, but when their rules overlap they fight each other and pre-commit runs get messy. This guide explains how to divide responsibilities, turn off conflicting rules, unify config, and enforce everything in CI.

7 min readUpdated 2026-09-06By LaoHand Team
Read →

Take Claude Code Through a Real Bug-Fix Flow

An AI coding assistant is not "let it auto-fix" but a disciplined workflow. Using a real project bug, this guide walks the full loop from reproduction, adding a test, surgical fixes, to regression verification, with the exact instructions to issue at each step.

8 min readUpdated 2026-09-06By LaoHand Team
Read →

Prompt Engineering for Coding Agents: Make Claude Code / Codex a Reliable Collaborator

Getting a coding agent right on the first try is not about the model but the instruction quality. This guide explains context constraints, minimal-change rules, test-first practice and review prompts, so you can craft reproducible prompts with fewer hallucinations.

8 min readUpdated 2026-09-06By LaoHand Team
Read →