Here I am building up a list of things I sometimes need to do on a computer but not often enough that I remember how to do them. Now all I have to remember is to check here first when I want to, for example, extract audio from a video. And, if the solution isn’t here, to add it after I find it.
Convert dates and times across time zones
Specify a time zone to convert a time somewhere else to your local time (use tzselect to find time zone names; see this post for more):
$ date --date='TZ="Australia/Sydney" 2025-03-24 14:00'
Sun 23 Mar 2025 11:00:00 PM EDT
Or convert to a third time zone:
$ TZ='America/St_Johns' date --date='TZ="Australia/Sydney" 2025-03-24 14:00'
Mon 24 Mar 2025 12:30:00 AM NDT
Extract audio from a video
ffmpeg -i video.mp4 -q:a 0 -map a audio.mp3
(Source: Stack Overflow.)
Extract a clip from a video
This will take one minute, starting at 10 minutes in:
ffmpeg -i video.mp4 -ss 10:00 -t 1:00 -c copy output.mp4
Slice an image vertically
With Imagemagick’s crop, to cut an image into a stack of five slices:
convert -crop 100%x20% input.jpg cropped_%d.jpg
Make a favicon
Makes a favicon that contains different sizes.
convert -background transparent "favicon.png" -define icon:auto-resize=32,64,128,256 "favicon.ico"
Convert a PDF to PNG, and give it a white background
I’d generated a PDF of a graphic that I wanted to convert to a PNG, but the background became transparent.
convert -density 300 -background white -alpha remove input.pdf output.png
Add metadata to a PDF
exiftool -Title="Document title" -Author="William Denton" -Subject="The subject" file.pdf
Reduce the resolution of a PDF
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
That sets it (with /ebook) to 150 dpi. Use /screen to get it down to 72 dpi.
OpenStreetMap documentation I might look at
Ubuntu: Unable to update “Snap Store”: cannot refresh “snap-store”: snap “snap-store” has running apps (ubuntu-software)
Try this:
snap-store --quit && sudo snap refresh snap-store
Or this:
sudo killall snap-store && sudo snap refresh snap-store
(Source.)
Miskatonic University Press