More in Shell
Run a command on every file changed in a commit
Shell
Lints only what a commit touched, which is usually all you need in a pre-commit hook.
Serve the current directory over HTTP
Shell
Three ways to put a folder on localhost when you need to test something quickly.
Watch a command until it succeeds
Shell
Retries every two seconds and stops the moment the command exits zero. Useful while waiting for a service to come up.
Count lines of code by extension
Shell
A quick census of a repository without installing a tool for it.
Find the largest files with PowerShell
Shell
The Windows counterpart to du | sort | head.
Make a shell script fail loudly
Shell
The four lines that turn a script from 'carries on after an error' into 'stops at the first problem'.
Tail a log and colour only what matters
Shell
Follows a growing file and highlights errors and warnings, leaving the rest readable but quiet.
Show which process is holding a port
Shell
Answers 'address already in use' without guessing.
Random picks
Find the commit that introduced a bug
Git
Binary search across history. Mark a known good and a known bad commit and git narrows it down for you.
YAML anchors to avoid repeating yourself
Data Formats
Define a block once, merge it into each service. Changing the base changes all of them.
Shell into a running container
Containers
Falls back to sh, since slim images often have no bash.
Responsive grid without media queries
Web & CSS
auto-fill with minmax reflows on its own, so the column count follows the container rather than a breakpoint list.
Pin a dependency to an exact version
Build & CI
Caret ranges are how a build that passed last week fails today. Exact versions plus a lockfile remove the surprise.
Walk a directory tree lazily
Python
pathlib keeps the paths as objects rather than strings, so joining and suffix checks stay readable.
Nullable reference types in C#
Systems
Turning the feature on makes the compiler point at every place a null could slip through.
Compose file with a healthcheck and dependency order
Containers
Makes the app wait until Postgres actually answers, not merely until its container has started.