TIL

Friday, September 4, 2026

The Indigo SQL Logger plugin can save device states to a local SQLite database that is stored in Indigo’s current version support directory. But where is that directory and how can our scripts access it agnostic of the current version of Indigo?

It turns out that the server exposes its log directory path:

indigo.server.getLogsFolderPath()

Then to get the path to the device state database:

import os

db_path = os.path.join(indigo.server.getLogsFolderPath(), 
    "indigo_history.sqlite")

And as an example:

Tuesday, May 19, 2026

This pertains to macOS. Other OS’s may differ.

To export a high resolution image of the entire PDF:

# Note: pdftoppm is provided by Poppler
# If Poppler is not installed then first:
# brew install poppler
pdftoppm -png -r 600 input.pdf output

To export the images that are contained in the PDF:

pdfimages -all input.pdf output

Friday, January 29, 2021

Custom aliases in oh-my-zsh

With oh-my-zsh, you can store custom aliases in multiple (?per application) file under .oh-my-zsh/custom giving them .zsh file extensions.1

¶For example, in my hugo.zsh file, I have:

alias hnewtil="/Users/alan/Documents/blog/ojisan/scripts/newtil.sh"
alias gtojisan="cd /Users/alan/Documents/blog/ojisan; ls -l;"

Executing inline Python in a shell script

It’s possible using the -c command.2

python -c 'import foo; foo.bar()'

Thursday, January 28, 2021

TIL

A bunch of Unix date scripting things

Unix shell scripting is not one of my better-know areas of programming, but it’s on my list of things to learn. Some interesting bits about the date function.1

  1. Want the long date, like Thursday, January 28, 2021? → date +"%A, %B %d, %Y"
  2. Want something like the above but with abbreviated month Thursday, Jan 28, 2021? → date +"%A, %b %d, %Y"
  3. Time zone in the format of "-05:00" on macOS is:
#!/bin/bash

tz=$(date +"%z" | sd '(\d{2})(\d{2})' '$1:$2')
echo $tz
  1. Long date in the format of 2021-01-28T05:30:48-05:00 that is use by Hugo2:
tz=$(date +"%z" | sd '(\d{2})(\d{2})' '$1:$2')
md_date=`date +"%Y-%m-%dT%H:%M:%S"`
  1. Speaking of dates, this reference has very detailed information on date and time in the Unix shell.
  2. Date in the format of 2021-01-28 is date +"%Y-%m-%d"

Unix slurp command output into a variable

In the UNIX shell, slurping the output of the command into a variable is done this way:3