Tooling

The commands, flags and editor settings that saved a minute more than once.

TIL

curl --json sets both headers for you

Since curl 7.82, --json sends the body as data and sets Content-Type and Accept to application/json in one go.

$ curl --json '{"url":"https://example.org/a/long/path"}' localhost:8080/api/links
{"code":"k3x9","url":"https://example.org/a/long/path"}

Before, I typed -H twice and forgot one of them every other time.

TIL

psql picks the layout with \x auto

\x auto switches psql to one column per row only when a row is wider than the terminal. Narrow results stay a table.

$ echo '\x auto' >> ~/.psqlrc

I used to toggle \x by hand and forget to toggle it back.

TIL

git worktree for a hotfix without stashing

git worktree add checks out a second branch in its own folder. The half-done work stays where it is.

$ git worktree add ../stummel-hotfix main
$ cd ../stummel-hotfix
$ git switch -c fix/query-string

git worktree remove ../stummel-hotfix cleans up once it is merged.

Buy Logbuch