Collection 02
Tools
Start from a sample input and a command whose output can be checked.
Tool entries keep the input, the exact invocation, and the observable output next to each other. They are written for the moment when a command almost does what you need.
4 entries
Download the collection index (JSON)Index
On this shelf
| Task | Tool | What to check |
|---|---|---|
| Validate an ETag with curl Guide | curl | How do I send a conditional request and see whether the file is still fresh? |
| Compare Staged and Unstaged Changes in Git Guide | Git | Which diff shows what will be committed? |
| Missing Fields and null in jq Reference | jq | Why does jq print null for a missing key, and how do I distinguish missing from null? |
| How ripgrep Handles Ignored Files Reference | ripgrep | Why does rg skip a file that grep finds? |
Reading path
A way in
Start with the curl validator if you need to observe a conditional HTTP exchange. Then read the cache-control entry in Protocols to interpret the result.
- 01 Validate an ETag with curlAn ETag check is a conditional GET: store the ETag from the first response, send it in If-None-Match with curl's --etag-compare or -H, and treat a 304 status as proof that the cached copy is still fresh. A 200 status means the validator no longer matches, so the body must be fetched again.
- 02 Freshness and Validation in Cache-ControlA cache can reuse a stored response without contacting the origin while that response is fresh; once it is stale, the cache must validate it conditionally unless a directive explicitly allows stale reuse.
All entries
Full catalog
- Compare Staged and Unstaged Changes in Git git diff compares the working tree with the index and shows unstaged changes, while git diff --staged compares the index with HEAD and shows exactly what the next commit will contain. Run both, or git diff HEAD for the combined view, when you need the full picture.
- How ripgrep Handles Ignored Files ripgrep skips paths matched by .gitignore, .ignore, or .rgignore, skips hidden dotfiles, and stops at binary files by default, while grep -r searches all of them. Use rg --files -uu, --no-ignore, --hidden, or -a to find out which filter is hiding the file.
- Missing Fields and null in jq jq prints null for an absent key and for a key whose value is JSON null because both serialize the same way, so a plain path lookup cannot tell them apart. Use has(key) or keys to test presence, and remember that the // operator replaces null and false rather than testing whether a key exists.
- Validate an ETag with curl An ETag check is a conditional GET: store the ETag from the first response, send it in If-None-Match with curl's --etag-compare or -H, and treat a 304 status as proof that the cached copy is still fresh. A 200 status means the validator no longer matches, so the body must be fetched again.