How To REALLY Use Cron To Run Scheduled Jobs
Sunday, June 8, 2025
Some techniques for using cron in the modern era.
Sunday, June 8, 2025
Some techniques for using cron in the modern era.
Friday, May 23, 2025
The sort command allows one to specify which field to sort by. These fields need to be separated by a character, such as a colon or comma, which is specified using the -t option. To select the actual field to sort, specify the field position using the -k option, which is one based: $ cat eg.csv 111, plank, hello 222, apple, world 333, kilo, example 444, delta, values $ sort -t, -k2 eg.
Friday, May 23, 2025
One other JQ thing: there’s an operator which returns the filename of the file currently being processed by JQ, called input_filename. This can be used alongside the concat operator to reproduce something similar to grep -H: $ jq -r 'input_filename + ": " + .payload.data' *.json message-0000.json: id_111 message-0001.json: id_234 message-0002.json: id_512
Friday, May 23, 2025
Yesterday, I discovered that JQ has a recursive descent operator — .. — which allows one to go through each field of a JSON structure. When used, it will emit every value of a JSON structure, doing so in pre-order (i.e. any nested objects or arrays will be written to the output before they’re visited). $ cat eg.json { "name": "hello", "age": 123, "phone": {"home": 1, "mobile": 2} } $ jq '.
Friday, November 24, 2023
Even though I’ve been using MacOS for a while, there are certain things that I just still remember doing in Linux. Probably it got burned into my mind when I was under pressure to debug something in work. Whatever the reason, I can never remember how to do similar in MacOS. So I’m noting them down here. Listing Open TCP Ports Equivalent to netstat -nap: lsof -nP -i4TCP:$PORT | grep LISTEN Managing Daemons The tool to manage running services and daemons is launchctl.
Saturday, October 28, 2023
To get the current colour scheme from the CLI, use the following command: defaults read -g AppleInterfaceStyle If MacOS is in dark mode, this will print Dark. But if MacOS is in light mode, this key won’t be set at all, and the command will print return an error of the form: 2022-10-04 09:15:18.058 defaults[35844:466643] The domain/default pair of (kCFPreferencesAnyApplication, AppleInterfaceStyle) does not exist As such, in order to confirm that the colour scheme is light, you’ll need to parse for this error.
Saturday, October 28, 2023
To turn off shared history in Zhs, simply by adding the following to your .zshrc file. unsetopt share_history
Friday, October 27, 2023
Here are various ways to start a HTTP dev server on the terminal. Python 2 $ python -m SimpleHTTPServer Python 3 $ python -m http.server