[HowTo] Automation – Photo resizing script

  • Prerequisites:
    • Mac Portshttps://www.macports.org/
      • Apple’s Command Line Developer Tools
      • type in the following command to get Apple’s Command Line Developer Tools installed:
xcode-select --install
  • If you get the following message about xcode-select command requiring command line developer tools, go ahead and install
  • Apple’s Xcode Developer Tools
xcodebuild -license
sudo port -v selfupdate
  • Now Mac Ports has been installed on your Mac
  • Go ahead and close your terminals and open a new terminal window
  • ImageMagick:
sudo port install perl5.34
sudo port install imagemagick
sudo port install p5.34-perlmagick
% sudo port install perl5.34
---> Computing dependencies for perl5.34
The following dependencies will be installed:
db48
gdbm
gettext-runtime
libiconv
ncurses
readline
Continue? [Y/n]: Y
.....
% sudo port install imagemagick
---> Computing dependencies for ImageMagick
The following dependencies will be installed:
aom
bash
brotli
bzip2
cairo
coreutils
dav1d
djvulibre
expat
fftw-3
fontconfig
freetype
gdk-pixbuf2
ghostscript
giflib
glib2
gmp
gobject-introspection
icu
imath
jasper
jbig2dec
jbigkit
kvazaar
lcms2
lerc
libde265
libdeflate
libedit
libelf
libffi
libgcc
libgcc14
libheif
libidn
libjpeg-turbo
libpaper
libpixman
libpng
libraw
libtool
libxml2
lz4
m4
mpdecimal
openexr
openh264
openjpeg
openssl
openssl3
pcre2
perl5
pkgconfig
py313-mako
py313-markdown
py313-markupsafe
py313-setuptools
python313
python3_select
python3_select-313
python_select
python_select-313
shared-mime-info
sqlite3
svt-av1
tiff
urw-fonts
webp
x265
xorg-libX11
xorg-libXau
xorg-libXdmcp
xorg-libXext
xorg-libXt
xorg-libice
xorg-libsm
xorg-libxcb
xorg-xcb-proto
xorg-xcb-util
xorg-xorgproto
xrender
xz
zlib
zstd
Continue? [Y/n]: Y
....
---> Some of the ports you installed have notes:
coreutils has the following notes:
The tools provided by GNU coreutils are prefixed with the character 'g' by
default to distinguish them from the BSD commands.
For example, cp becomes gcp and ls becomes gls.

If you want to use the GNU tools by default, add this directory to the front
of your PATH environment variable:
/opt/local/libexec/gnubin/
libheif has the following notes:
Support for rav1e now disabled by default; enable via +rav1e
libidn has the following notes:
GNU libidn2 is the successor of GNU libidn. It comes with IDNA 2008 and TR46
implementations and also provides a compatibility layer for GNU libidn.
python313 has the following notes:
To make this the default Python or Python 3 (i.e., the version run by the
'python' or 'python3' commands), run one or both of:

sudo port select --set python python313
sudo port select --set python3 python313
shared-mime-info has the following notes:
A startup item has been generated that will start shared-mime-info with
launchd, and will be enabled automatically on activation. Execute the
following command to manually _disable_ it:

sudo port unload shared-mime-info
  • Depends on which version of Python 3 gets installed/available, you may want to set the default version of Python by running the ‘select -set’ commands at the bottom of the install
sudo port install p5.34-perlmagick
sudo port install p5.34-image-exiftool
% sudo port install p5.34-image-exiftool
---> Computing dependencies for p5.34-image-exiftool
---> Fetching archive for p5.34-image-exiftool
---> Attempting to fetch p5.34-image-exiftool-13.300.0_0.darwin_any.noarch.tbz2 from https://packages.macports.org/p5.34-image-exiftool
---> Attempting to fetch p5.34-image-exiftool-13.300.0_0.darwin_any.noarch.tbz2.rmd160 from https://packages.macports.org/p5.34-image-exiftool
---> Installing p5.34-image-exiftool @13.300.0_0
---> Activating p5.34-image-exiftool @13.300.0_0
---> Cleaning p5.34-image-exiftool
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
sudo port install wget
% sudo port install wget
---> Computing dependencies for wget
The following dependencies will be installed:
curl-ca-bundle
gnutls
gsettings-desktop-schemas
libidn2
libproxy
libpsl
libtasn1
libunistring
libxslt
nettle
p11-kit
Continue? [Y/n]: Y
% cd ~/Downloads
% wget https://www.sentex.ca/~mwandel/jhead/os-x/jhead
--2025-05-26 15:24:31-- https://www.sentex.ca/~mwandel/jhead/os-x/jhead
Resolving www.sentex.ca (www.sentex.ca)... 64.7.148.55
Connecting to www.sentex.ca (www.sentex.ca)|64.7.148.55|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 72696 (71K)
Saving to: ‘jhead’

jhead 100%[===================>] 70.99K 291KB/s in 0.2s

2025-05-26 15:24:32 (291 KB/s) - ‘jhead’ saved [72696/72696]
% sudo cp ~/Downloads/jhead /opt/local/bin/
% sudo chmod +x /opt/local/bin/jhead
  • close all Terminal windows and restart a new one to test:
% cd ~/Pictures
% % ./scripts/raw2jpeg.pl -h
Unknown option: h
-F- Unknown option encountered.
-F- Availabel options : tn, bw, op, cc, SV, AV, SSP, title, desc, src, desc, move & debug
-F- -src : Location for Source imgs(jpeg)
-F- -dest : Location for Destination
-F- -SV : Generate SimpleView Web contents.
-F- -AV : Generate ActiveView Web contents.
-F- -SSP : Generate SlideShowPro Web contents.
-F- -3W : Triple Width 1800x600
-F- -title : Web Title for SV/AV/SSP.
-F- -desc : Web Description for SV/AV/SSP.
-F- -tn : Generate Thumbnail size.
-F- -bw : Generate Grayscale images(800x).
-F- -pr : Generate Polaroid images(800x).
-F- -op : Generate OilPaint images(800x).
-F- -cc : Generate Charcoal images(800x).
-F- -bdr : Generate Bordered/framed images(800x).
  • Sample runs:
  • Let’s assume that the photos are arranged in ~/Pictures folder with <date>_<title> and scripts are also in ~/Pictures folder as above
% cd ~/Pictures
% % ./scripts/raw2jpeg.pl -SSP -AV -SV -bw -src 20250525_Friday-Party/uncompressed -dest 20250525_Friday-Party -title 20250525_Friday-Party
  • (Here, you can use auto-completion by pressing <tab> key after 20250525…)

[HowTo] APC Masterswitch AP9211 with AP9606 Firmware Upgrade

I have a few old APC Masterswitch Power Controller with AP9606 Web/SNMP Management Card stored away in my garage for years…

Finally I found some use for them and I wanted to update the firmwares before I install them for good.

What’s needed:
Tripp-Lite USB to DB9 Adapterhttps://www.tripplite.com/support/usa19hs
Plugable USB Serial Adapter – https://plugable.com/products/pl2303-db9
DB9 Null Modem Female to Female adapter – https://a.co/d/dl8Q76C

On MacOS(Monterey v12.5), I had to download and install the driver for Tripp-Lite USB to DB9 adapter and use the following command to connect to APC Masterswitch:

screen /dev/tty.usbserial-1410 2400,cs8,-ixon

I did some web searching and found the following firmwares:

  • aos309a.bin – APC OS for AP9606(download link below)
  • ms225a.bin – Masterswitch Application(download link below)

I followed the ftp instruction for firmware update – https://www.apc.com/us/en/faqs/FA156047/

First, once I get logged into the AP9606 via Serial connection, I figured out the MAC address then assigned IP via BOOTP with:

apc -s 192.168.?.? <MAC Address>

Then uploaded MasterSwitch APP, v2.2.5.a via ftp then Web/SNMP Management Card AOS v3.0.9.a then disabled BOOTP and configured static IP TCP/IP

[HowTo] NAS – How to flash HP Z840 to IT mode for XigmaNAS

After 10+ years of using custom build ZFS NAS Server hardware, I have decided to go with either Dell or HPe Workstation H/W for my home ZFS NAS server running XigmaNAS/FreeNAS

Making the long story short, I decided on HPe Z840 Workstation which has built-in SAS 9207-8i with LSI 2308 controller.

From the factory, it is configured with RAID Mode(RI) and in order to be used with ZFS NAS Server, it needs to be converted to Target Mode(TI)

I did some searching and found some good information and instructions but I had to do some deep-searching to get all the files that I need to create the bootable USB with all three(3) firmware/BIOS

YouTube link for the SAS 9207-8i IT mode Flashing – https://www.youtube.com/watch?v=boK6UcCFx2Q

P20 Broadcom Drivers download link – https://www.broadcom.com/support/download-search?pg=Legacy+Products&pf=Legacy+Host+Bus+Adapters&pn=SAS+9207-8i+Host+Bus+Adapter&pa=Firmware&po&dk&pl

Here are some packages that I download to create a bootable USB stick for the IT mode flash:
Installer_P20_for_UEFI.zip
sas2flash.efi
9207_8i_Package_P20_IR_IT_FW_BIOS_for_MSDOS_Windows.zip
9207-8.bin and mptsas2.rom

Knowledge base – https://www.broadcom.com/support/knowledgebase/1211161501344/flashing-firmware-and-bios-on-lsi-sas-hbas

Save SAS Address:
> SAS2FLASH.EXE -c 0 -list > Z840.TXT
-c 0 : first controller
Erasing Firmware:
> SAS2FLASH.EXE -c 0 -o -e 6
-e 6 : erase for firmware flash
Flashing:
> SAS2FLASH.EXE -c 0 -o -f 9207-8-IT.BIN -b MPTSAS2.ROM -b X64SAS2.ROM
-b 9207-8-IT.BIN: IT mode firmware
-b MPTSAS2.ROM: LSI BIOS ROM
-b X64SAS2.ROM: UEFI ROM
Updating SAS Address:
> SAS2FLASH.EXE -c 0 -o -sasadd <address_no_dashes>

Here is before and after of the SAS list of Z840 box, Before & After:

LSI Corporation SAS2 Flash Utility
Version 20.00.00.00 (2014.09.18)
Copyright (c) 2008-2014 LSI Corporation. All rights reserved

Adapter Selected is a LSI SAS: SAS2308_1(D1)

Controller Number : 0
Controller : SAS2308_1(D1)
PCI Address : 00:01:00:00
SAS Address : 5001438-0-36c5-6fb0
NVDATA Version (Default) : 11.00.00.10
NVDATA Version (Persistent) : 11.00.00.10
Firmware Product ID : 0x2714 (IR)
Firmware Version : 18.10.00.00
NVDATA Vendor : LSI
NVDATA Product ID : SAS2308
BIOS Version : 07.35.02.00
UEFI BSD Version : N/A
FCODE Version : N/A
Board Name : LSISAS2308
Board Assembly : N/A
Board Tracer Number : N/A

Finished Processing Commands Successfully.
Exiting SAS2Flash.
LSI Corporation SAS2 Flash Utility
Version 20.00.00.00 (2014.09.18)
Copyright (c) 2008-2014 LSI Corporation. All rights reserved

Adapter Selected is a LSI SAS: SAS2308_2(D1)

Controller Number : 0
Controller : SAS2308_2(D1)
PCI Address : 00:01:00:00
SAS Address : 5001438-0-36c5-6fb0
NVDATA Version (Default) : 14.01.00.06
NVDATA Version (Persistent) : 14.01.00.06
Firmware Product ID : 0x2214 (IT)
Firmware Version : 20.00.07.00
NVDATA Vendor : LSI
NVDATA Product ID : SAS9207-8i
BIOS Version : 07.39.02.00
UEFI BSD Version : 07.27.01.01
FCODE Version : N/A
Board Name : SAS9207-8i
Board Assembly : N/A
Board Tracer Number : N/A

Finished Processing Commands Successfully.
Exiting SAS2Flash.

Here is the zip file containing all of the files that I used to flash my card:

[Windows] How to transfer Windows license

How to see the current Windows License Key:
1. run ‘regedit’
2. capture Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\BackupProductKeyDefault

Deactivating Windows License:
1. run Command Prompt with ‘Run as administrator’
2. type ‘slmgr /upk’
3. type ‘slmgr /cpky’ (to clear registry)

Activating Windows from Command Prompt:
1. run Command Prompt with “Run as administrator’
2. type ‘slmgr /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx’
3. type ‘slmgr /dlv’ (to verify)

[macOS] Ripping CD and Converting to FLAC

It has been a long time since I rip a CD to FLAC files and I used to do this on Windows. Now my primary system is macOS, I want to find out how to do this on a Mac.

(https://xiph.org/flac/links.html#software)

I decided to use macOS Music/iTunes to extract tracks from CD to Apple Lossless Audio Codec(AAC):

A Better CD Encoder(ABCDE)
with Homebrew installed, “brew install abcde”

X Lossless Decoder(XLD) – just run it once and set the Output format and directory then open the AAC files with XLD and it will convert them to FLAC automatically

[macOS] Must-have Apps

Amphetamine – https://apps.apple.com/us/app/amphetamine/id937984704?mt=12

Appcleaner – https://freemacsoft.net/appcleaner/

Encrypto – https://apps.apple.com/us/app/encrypto-secure-your-files/id935235287?mt=12

Helium 3 – https://apps.apple.com/us/app/helium-3/id1294059664?mt=12

IINA – https://iina.io/

Itsycal – https://www.mowglii.com/itsycal/

VLC – https://www.videolan.org/vlc/

Keka – https://www.keka.io/en/

Weather Bug – https://apps.apple.com/us/app/weatherbug-weather-forecasts-and-alerts/id1059074180?mt=12

[rPi] Raspberry Pi – New Toy – Installation

JP gave me a Raspberry Pi Version B with 512MB RAM.

http://www.raspberrypi.org/

Quick Start Guide: http://www.raspberrypi.org/wp-content/uploads/2012/04/quick-start-guide-v2_1.pdf

Formatting Tool: https://www.sdcard.org/downloads/formatter_4/

Images: http://www.raspberrypi.org/downloads

I used “NOOBS (offline and network install)” iamge onto a 8GB SD Card for installation.

1. Download the SD Formatter 4.0(link above) and install
2. Insert a SD Card 4GB+
3. Run the Formatting Tool
3a. Make sure the correct drive is selected
3b. Click on the Options and select “FORMAT SIZE ADJUSTMENT”
3c. Click OK
4. Click the Format button
5. Unzip the downloaded NOOBS image(link above)
6. Copy unzipped files(all) onto the root of the SD Card
7. Insert the SD Card in the SD Card Slot on the Raspberry Pi
8. Power up the Raspberry Pi with at least HDMI, USB Keyboard connected

By default, NOOBS will output over HDMI at your display’s preferred resolution, even if no HDMI display is connected. If you do not see any output on your HDMI display or are using the composite output, press 1, 2, 3 or 4 on your keyboard to select HDMI preferred mode, HDMI safe mode, composite PAL mode or composite NTSC mode respectively.

1. HDMI mode ­ this is the default display mode.
2. HDMI safe mode ­ select this mode if you are using the HDMI connector and cannot see anything on screen when the Pi has booted.
3. Composite PAL mode ­ select either this mode or composite NTSC mode if you are using the composite RCA video connector
4. Composite NTSC mode