Archive for category Software

Imagemagick 6 vs. PDF

Come to find out Xubuntu 18.04 ratcheted the ImageMagick security settings up to a dangerous chattering whine:

convert p???.jpg "Machining D-bit Drills.pdf"
convert-im6.q16: not authorized `Machining D-bit Drills.pdf' @ error/constitute.c/WriteImage/1037.

Fortunately, someone who understands this stuff encountered the problem before I did and posted a great description of the solution.

To forestall link rot, the process looks like:

cd /etc/ImageMagick-6/
sudo cp policy.xml policy.xml.base
sudo nano policy.xml
… change one line …
 policy domain="coder" rights="read|write" pattern="PDF"

It is completely unclear to me whether ImageMagick (as of ImageMagick 6.9.7-4 Q16 x86_64 20170114 ) requires or merely tolerates the vertical bar in place of commas, nor whether it’s in my best interest to replace "coder" with "*".

In any event, I can once again stuff bitmap images into PDF files.



Sony NP-BX1 Battery Holder: SMT Pogo Pin Contacts

The original camera battery test fixtures used contact pins conjured from hulking gold-plated connector pins and coil springs:

Canon NB-6L holder - contact pin detail

Canon NB-6L holder – contact pin detail

The Sony HDR-AS30V camera chewed up and spat out a handful of batteries, all tested in the NP-BX1 test fixture:

NP-BX1 Holder - show layout

NP-BX1 Holder – show layout

Nowadays, SMT pogo pins produce a much more compact holder, so I figured I could put all those batteries to good use:

NP-BX1 Holder - SMT pogo pins

NP-BX1 Holder – SMT pogo pins

That’s the long-suffering astable multivibrator, still soldered to its CR123A holder.

Obviously, the battery holder should grow ears to anchor the 14 AWG copper posts and would look better in black PETG:

NP-BX1 Battery Holder - 1.5mm pins - solid model

NP-BX1 Battery Holder – 1.5mm pins – solid model

The battery lead wires get soldered to the ends of the pogo pins and are recessed into the slot in the end of the fixture. I used clear epoxy to anchor everything in place.

Fits perfectly and works fine!

The OpenSCAD source code as a GitHub Gist:


1 Comment

Kindle Fire Picture Frame: Copying the Pictures

Being a bear of unbearable consistency, I save edited picture files with a description following the original camera-assigned sequence number:

IMG_20181108_190041 - Kindle Fire Picture Frame - Another Test Image.jpg

Yup, spaces and all.

Kindle Fire Picture Frame - Another Test Image

Kindle Fire Picture Frame – Another Test Image

I store my general-interest pix chronologically by year, in subdirectories for interesting categories, so copying all the edited (a.k.a. “interesting”) pictures to the Kindle Fire becomes a one-liner:

cd /mnt/bulkdata/Cameras
find 20?? -iname \*\ \*jpg -print0 | xargs -0 cp --parents -t /mnt/part/Pictures

The --parents parameter tells cp to recreate the directory structure holding the picture in the target directory, thereby keeping the pix neatly sorted in their places, rather than creating one heap o’ pictures.

Come to find out I’ve edited slightly over 7 k general-interest pictures in the eighteen years I’ve been using digital cameras, of maybe 27 k total pictures. Call it a 25% hit ratio; obviously I’m not nearly fussy enough.

Then there’s another 16 k project-related pictures, of which 10 k were edited into something useful. With an emphasis on utility, rather than aesthetics, a 60% hit ratio seems OK.

Which works out to half a dozen pictures a day, every day, for eighteen years. I loves me some good digital camera action!

Leave a comment

LinuxCNC 2.7 vs. Logitech Joggy Thing

The old Atom running LinuxCNC for the Sherline finally stopped booting, so I popped the Optiplex 760 off the stack and did a live-USB trial run. The latency / jitter worked out around 25 µs, slightly worse than before, but still Good Enough, and the StepConf utility coerced the motors into working OK.

What didn’t work was the old Eagle-to-HAL code defining the Logitch Gamepad as a Joggy Thing to allow smooth joystick jog control. Well, stuff changes over the course of eight years, but, in this case, the fix turned out to be a one-liner: the probe_parport module isn’t needed nowadays.

With that out of the way, it runs fine:

LinuxCNC - Sherline Mill - Logitech Gamepad

LinuxCNC – Sherline Mill – Logitech Gamepad

The INI and HAL files defining the Sherline configuration as a GitHub Gist:

, ,

1 Comment

Icecast and Ezstream Configuration

Plugging a 64 GB USB stick with directories full of MP3 / OGG files into an always-on Raspberry Pi running Pi-Hole, one can use Icecast to stream them for clients on the LAN, so as to avoid over-the-Intertubes streaming issues.

The only changes in the /etc/icecast2/icecast.xml file cover passwords, the number of source streams, and the hostname. It’s that simple, really.

Given a directory of files, generate a file-per-line playlist:

find /mnt/music/goodmusic/ -name \*mp3 | sort > /mnt/music/goodmusic/playlist.m3u

Then set up a corresponding Ezstream XML file, perhaps imaginatively named goodmusic.xml:

    <svrinfoname>Good Music</svrinfoname>
    <svrinfogenre>Good Music Streaming 24x7</svrinfogenre>
    <svrinfodescription>Techno Dub</svrinfodescription>

Fire off the source stream in /etc/rc.local:

ezstream -c /home/pi/Icecast/goodmusic.xml &

The ampersand tells Bash to fire-and-forget the process, so it runs all the time. One could, I suppose, put it in crontab to start after each boot or puzzle out the corresponding systemd incantation, but …

Add the station to your streaming media player:

         'KEY_KP5'   : ['Good Music',False,['mplayer','-playlist','']],

And then It Just Works™.


Leave a comment

Xubuntu Startup Delay vs. xsetwacom

Over the years, various xsetwacom incantations have confined the tablet stylus to the left-hand landscape monitor on my desk. Updating to Xubuntu 18.04 once again changed the monitors names (from HEAD-0 back to DP-1), but xsetwacom stopped working.

My script runs from Xubuntu’s “Application Autostart” list, so X is already running and xsetwacom should do the right thing. Alas, even with $XAUTHORITY and $DISPLAY set correctly (automagically by X), xsetwacom still didn’t corral the cursor.

Some rummaging around the Intertubes suggested a delay would allow X to get up to speed and, indeed, sleeping for two seconds solved the problem:

logger " - copying Xauthority values"
whoami > /tmp/who
cp /home/ed/.Xauthority /tmp/Xauthority.txt
cp $XAUTHORITY /tmp/xauth.cp
echo $DISPLAY > /tmp/DISPLAY.txt
# xsetwacom needs an additional delay after $XAUTHORITY and $DISPLAY become correct
logger " - waiting aimlessly"
sleep 2s
logger " - doing wacom setup"
xsetwacom --verbose set "Wacom Graphire3 6x8 Pen stylus" MapToOutput "DP-1"
xsetwacom --verbose set "Wacom Graphire3 6x8 Pen eraser" MapToOutput "DP-1"

Sheesh & similar remarks.

The complete Bash script as a GitHub Gist:

The cruft in there reminds me of previous fixes / workarounds / haxx, so it’s not entirely wasted space.

Leave a comment

Kindle Fire Picture Frame: Side Block

A steel frame that Came With The House™ emerged from a hidden corner and, instants before tossing it in the recycle heap, I realized it had excellent upcycling potential:

Kindle Fire Picture Frame - Test Run

Kindle Fire Picture Frame – Test Run

Stipulated: I need better pictures for not-so-techie audiences.

Anyhow, my long-disused Kindle Fire fits perfectly into the welded-on clips, with just enough room for a right-angle USB cable, and Photo Frame Slideshow Premium does exactly what’s necessary to show pictures from internal storage with no network connection.

All I needed was a small block holding the Kindle against the far side of the frame:

Kindle Frame - side blocks

Kindle Frame – side blocks

A strip of double-stick carpet tape holds the block onto the frame. To extract the Kindle, should the need arise, slide it upward to clear the bottom clips, rotate it rearward, and out it comes.

Getting a good block required three tries, because the basement has cooled off enough to trigger Marlin’s Thermal Runaway protection for the M2’s platform heater. A test fit after the first failure showed the long leg was 1 mm too wide and, after the second failure, I reduced the fan threshold to 15 s and the minimum layer time to 5 s, producing the third block without incident.

The platform heater runs at 40 V and I considered bumping it to 43 V for a 15% power boost, but it has no trouble keeping up when the fan isn’t blowing chilly basement air across its surface.

The OpenSCAD source code, such as it is, doesn’t deserve its own GitHub Gist:

// Block to hold Kindle in a picture frame mount
// Ed Nisley - KE4ZNU
// November 2018

Protrusion = 0.1;

difference() {

    cube([18-4 + Protrusion,44-10 + Protrusion,10 + 2*Protrusion]);


, ,