When a port is "already in use" — find the offending process and (carefully) kill it. `lsof` is the gold standard; `ss` is the lighter modern alternative.
`xargs -P N` is a Swiss-army knife for parallel map: feed it a list of inputs and a command, it runs N workers. Faster and simpler than bash for-loops with `&`.
Stack-allocated primitives implement `Copy` (auto-duplicated). Heap-owning types like `String` and `Vec` only implement `Clone` (you must explicitly call `.clone()` to opt into the deep copy cost).
`strconv.Atoi` / `Itoa` for the common int<->string case; `ParseFloat`, `ParseBool`, `Quote` for everything else. Always handle the error — strings can be anything.
Go Struct Embedding (Composition over Inheritance)
Go has no inheritance. Embed a type to "promote" its fields and methods as if they were on the outer type. Same effect as inheritance for most purposes, but explicit.
Classic shell one-liner: split text into words, sort, count uniques, sort by count. Useful for log analysis, content audits, and tag-cloud-style summaries.
Use `trap` to delete temp files / kill background workers when the script exits — even on Ctrl-C or an unhandled error. Single most-undervalued bash feature.
`<progress>` shows how much of a task is done (downloads, multi-step forms). `<meter>` shows a value within a known range (disk usage, password strength). Both render as native UI in every browser.
Building strings with `+` allocates O(n²) memory. `strings.Builder` writes to an internal buffer with a single final allocation — orders of magnitude faster in loops.
`timeout` (GNU coreutils) kills a command after N seconds. Returns exit code 124 on timeout — let the caller distinguish "timed out" from "failed for other reasons."
Tests live alongside the code they test. `cargo test` runs every `#[test]` function. Use `#[cfg(test)] mod tests` so the test code is compiled out of release builds.
Wrap any pure function with @cache (Python 3.9+) and get an unbounded memoization layer for free. Use @lru_cache(maxsize=N) when you need a bounded cache.
Encode "this might fail" in the type signature instead of throwing. Python 3.12+ generics syntax keeps it compact. Forces the caller to handle the failure branch.
`data class` auto-generates `equals`, `hashCode`, `toString`, `copy`, and `componentN` (destructuring). Replaces boilerplate POJOs / Records / classes-with-lombok in one line.
When TypeScript can't narrow a union for you, write a `x is T` predicate. Inside any block where the guard returns true, the compiler knows the narrower type.
Fan out N tasks but limit how many run at once via `tokio::sync::Semaphore`. Standard pattern for HTTP fan-out where you must respect a server's rate limit.