/til — Things I Learn
Things I have learned and want to remember, or that I think others might find useful. Some of these are links to articles from my postroll, while others are blog posts.
From the blog
Posted 2024-08-27
Configuring PHP.INI settings in a PHP-FPM pool
I consume PHP via Docker primarily, and to keep it manageable, I generally use a PHP-FPM container, with a web server sitting in front of it. I learned something new about PHP configuration recently that (a) made my day, and (b) kept me humble, as I should have known this all along.
/postroll
gron
github.com
gron
is a tool for working with JSON. It chunks things into key-value pairs where the key is a dot-separated hierarchy. This allows you then to use grep
or ack
to search for strings of interest.
It can also reassemble these back into JSON. This can be useful for adding or removing portions of a JSON structure. It becomes really interesting then when you pair it with jq
in order to retrieve data back out.
As an example, I can get the list of development requirements from a composer.json
with the following:
gron composer.json | ack "require-dev" | gron -u | jq '."require-dev" | keys[]'
(They'll still be in quotes, but that's easier to deal with than JSON keys!)
/postroll
Wezterm Quick Select Mode
wezfurlong.org
Quick select mode in Wezterm allows you to identify patterns in the current visible screen; Wezterm then highlights each and provides a key to each allowing you to copy and/or paste the associated value. Activate it with Ctrl-Shift-Space
.
As examples:
- It matches sha1 and md5 values. Use these to match a git ref in a log so you can then inspect it.
- It matches Docker container identifiers; use these to match a container identifier so you can run a command in it or copy a file from or to it.
- It matches URLs; use it to identify a URL to pass to HTTPie.
- It matches paths; use it to match a path to perform a file operation on.