When resizing, the '-resize 200x200' parameter is a bounding box, but it does not force the dimensions: a 900x220 image comes out 200x49, proportions kept:
magick screenshot.png -resize 200x200 small.png
A trailing '!' forces exact 200x200 โ and distorts the image:
magick screenshot.png -resize 200x200! distorted.png
1
10
On macOS, sips does the crop (on Linux, check ImageMagick):
sips -c 300 800 --cropOffset 0 0 title.png --out crop.png
tesseract crop.png stdout
The other trap is wrong output that looks right. In some cases, you can get plausible strings and wrong characters. So check the output, when a wrong character matters.
1
15
Example: Reading a file containing players names and keeping the last name across the loop, in the parent shell.
The redirect is the canonical form; it works in any shell. Process substitution does the same thing when the producer is a command rather than a file.
1
12
You have a text file and you want to read every line and remember the last one. The natural form looks correct, prints nothing wrong, but the result is empty.
The result of the "echo" is empty because the loop ran in a subshell, and the variable "last" lived in that subshell's memory.
1
12
To do the switch from Docker Desktop to colima:
brew install colima
colima start
docker context use colima
That's all you need on a machine that already has the docker CLI. The CLI is unchanged; only the endpoint behind it moves.
1
41
From a script โ or the prompt โ pipe data straight into the body:
jq -n '{"page": 1, "per_page": 100}' | http POST jsonplaceholder.typicode.comโฆ
The producer is the pipe. The consumer is the request. JSONPlaceholder echoes your POST back, so you can run it as written and watch the body arrive.
1
11
The tools to combine: zoxide, mise, starship, and fzf.
Once installed and wired into your shell.
You have a Node project (at ~/work/some/path/to/myproj) that you frequently visit, and that has the right mise.toml file (to configure the Node version and the tasks you need).
You can have these benefits when starting your session:
- do "z myproj" to jump to the project (thanks to zoxide),
- do "mise run dev" to run the project (the task 'dev' being configured in the mise.toml),
- while you work, the prompt shows the git branch and the Node version (starship),
- do Ctrl-T, type "app" for example to do a fuzzy search over the project's files, pick the file you need and press Enter to have its path pasted for your next command.
1
16
Example:
duckdb -c "SELECT country, count(*) AS n FROM 'users.csv' GROUP BY country ORDER BY n DESC"
Using the FROM 'users.csv' clause, DuckDB reads the file and treats it as a table for the duration of the query.
1
27
broot's staging feature allows collecting files with Ctrl-G or its fallback typed-verbs such as :toggle_stage and running the next verb on the whole set.
1
23
The lazygit tool's M key is one keystroke for one operation, but it has four parameter choices hidden inside it.
- Regular merge (with merge commit): use this when the team needs to see merge commits in the git history,
- Regular merge (fast-forward): use this when the team treats branch history as a single line,
- Squash merge and leave uncommitted: the source branch's commits become a single commit in the target branch ("squash"); the source's working tree is preserved untouched,
- Squash merge and commit: squash as with the previous option, but uncommitted edits on the source branch are included in the squash.
1
15
The Python for Teams - Onboarding Handbook introduces this guard with the print-at-import case example, illustrating top-level code refactored behind a main().
In addition, The Python for Teams - Onboarding Workbook (the companion resource) has an exercise to practice it: when you have a script that imports a service (entry point kept off-import).
As someone learning Python, once you see this pattern in those two contexts, you own it; modules with side effects, testability, scripts-that-double-as-libraries all get easier downstream.
The rule of thumb: "top-level code is for definitions; the guard is for execution."
Get the Python for Teams resources: kamonayeva.gumroad.com/
41
Here is the lazygit TUI's way for this workflow:
1. Press `enter` on each file where you have changes, in the Files panel, to open the staging view.
2. Press `space` to toggle each line (diff) you want staged; those changes lines move to the right pane.
3. When done, press `<esc>` to return to the files panel; the selection is saved and applied to your staged changes.
4. The files are now staged with exactly the changes you selected. You can then press `c` and you will be able to commit, providing your commit message in the confirmation prompt.
1
17














