About Brad

All-around tough guy.

pyHanko and macOS

I’m trying to be better about digitally signing .pdf documents that I author as a professional engineer. And without needing to pay Adobe to use Acrobat. Enter pyHanko, which does not have a user interface. With a little fussing it works well.

First, open Terminal.app and execute the following command to create a certificate and private key:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 3650

When prompted, I entered:

Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Minnesota
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Barr Engineering Co.
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:Bradford Schwie
Email Address []:bschwie@barr.com

Next combine the above generated cert.pem and key.pem into certif.p12 with this command:

openssl pkcs12 -export -out certif.p12 -in cert.pem -inkey key.pem

Verify the certificate.p12 contains a certificate and key with this command:

openssl pkcs12 -info -in certif.p12

Finally, create a .pdf with command:

pyhanko sign addsig –field Sig1 pkcs12 input.pdf output_signed.pdf certif.p12

pyhanko sign addsig –field 1/70,400,390,350/Sig1 –style-name default pkcs12 input.pdf output_signed.pdf certif.p12

BatteryOptimizer_for_Mac and Intel MacBook Pro

My iPhone 15 Pro Max caps charging at 80% thanks to Apple’s built-in iOS feature; however, the same built-in feature doesn’t appear for a macOS Intel MacBook Pro machine and we have a fleet of these. BatteryOptimizer_for_Mac to the rescue! I installed it on my macbookpro11,5 this afternoon and will let it run for a few weeks to see how it performs. Installation is simple with a single Terminal command (and some fussing in System Settings):

curl -s https://raw.githubusercontent.com/js4jiang5/BatteryOptimizer_for_Mac/main/setup.sh | bash

While there are many other open source options out there including some commercial options, they appear more focused on Apple-silicon based MacBooks.

** Update 7-4-2025 **

Using the command:

battery status

Produces:

07/03/25-15:11:01 - Battery at 78.8%, 12.083V, 27.3°C, no charging
07/03/25-15:11:01 - Battery health 109.3%, Cycle 103
07/03/25-15:11:01 - Your battery is currently being maintained at 80% with sailing to 75%
07/03/25-15:11:01 - You haven't scheduled calibration yet

As you can see, the battery is now hovering just below 80%. This utility appears to work and well at that.

Spotify Playlists

My kids love Spotify and I agree to keep a membership going for them. I could use it too Spotify and via its offline mode for RAGBRAI and other events where my devices don’t have wireless coverage, but I’m old school and prefer downloaded music files that I can see.

My kids offer me Playlists via weblinks so I can access the music via a web browser and many of these songs are also freely available on YouTube. Using a couple simple Terminal commands, these songs will get downloaded as lower quality formats (128 kbps) and my ears can’t tell the difference.

pip install spotdl
spotdl [insert Spotify playlist URL here]

Notes:

I had to use sudo before the first command, hopefully this is just my Mac and not applicable to yours.

For the Spotify playlist URL, just insert the link and don’t include the brackets as shown above. Get the URL through a web browser by logging into your account at spotify.com or use the URL to the playlist that your Spotify using friend gave to you.

You may need to install ffmpeg, consider brew for installing it. If additional ffmpeg errors persist, they may be originate from spotdl’s config file and its bitrate described here.

Within .spotdl and Terminal, I made a “music” folder with the command mkdir music, and then executed the spotdl command from there.

Sharing in OneDrive Without Recipient Notification

I always seem to fumble with sharing files in OneDrive and my recipients receive multiple notifications. This post is instructions for me to hopefully reduce that

1. Open barr.onedrive.com (this is my work, replace this address with a site/location where you typically access your own OneDrive files).

2. Click the name of the file you want to send, it will preview it in a window.

3. Tap “Share” in upper right corner.

4. Tap “Manage Access”.

5. Tap “Links”.

6. Tap “Share”.

7. In the “Add a name, group or email” field, type in the email address you wish to send a link to.

8. Click the three dots and choose “Send link in Outlook”.

These steps will likely change with future OneDrive revisions and before I next need to share a file, but at least these instructions might get me on a notification-free track.

EasyAccess and .ovpn file location

I wanted to find out where EasyAccess saved its OpenVPN files to on my iPad. Turns out they are here:

/AppDomain-com.weintek.EasyAccess/Documents/data/keys

I wanted to see if I could prompt my iPad (or Mac) to make EasyAccess connections outside the EasyAccess app, no luck yet, but I didn’t have time to pursue it further at the time. If I pick this up later, I’ll link to it from here.

Braun N2820 Type 3709 Toothbrush Repair

Tina said her toothbrush was having a hard time turning on. If she moved it around it would sometimes start, but not all the time. I found a guide on iFixit and decided to improve on it. While inside the toothbrush, I found a crappy solder lead that was the positive connection from the battery to the board. After heating the pad and flowing new solder to the board, it seems to be working well again.

Should the erratic button business continue, I will order a new button and pop it on, there’s easy access to the board for this repair. Also, I bathed the board in alcohol at the button, so that could be helping things too. Button replacement is also documented at iFixit.

For opening the toothbrush, I removed the head and then used a putty knife to pop the top off. It takes a little bit of muscle and the plastic will get dinged up, but it seems happy working again.

Rohloff 8201 Shifter and Lubrication

My replacement Rohloff 8201 grip shifter is still fully intact thanks to Liam and Hewitt from the University of Minnesota’s Mechanical Engineering 3D Printing Lab. Since building up my Surly Pugsley four years ago, I’ve noticed that the shifting seemed really stiff compared to my also Rohloff-equipped Surly Big Dummy. I’m embarrassed to report that it took until today to resolve the sticky shifting. It was a busy last several months, where I mostly neglected all but essential bike maintenance with Viola staying with us – we still miss her!

From the moment I completed the Pugsley build I noticed stiff shifting and assumed it was because of more complex cable routing that was required by the Pugsley’s horizontal drop outs and rear mounts, this was a false assumption. After left knee surgery in December, I was house-bound and corrected the cable routing, which only slightly improved the sticky shifting, but there was still room for significant gains. While correcting the cable routing, I figured out my previous assumption error when I tested the moment of the Pugsley’s Rohloff compared to the moment of the Big Dummy’s Rohloff – about the same force was required to shift each – testing was conducted using a wrench at the Rohloff’s gear box that precluded any shift cables.

I was relieved to know the problem wasn’t the Pugsley’s Rohloff, so I began to work upstream. When the Pugsley’s cable pulley was detached from the rear mech the grip shifter slid mostly smooth, but the minute the cable pulley was reattached to the Rohloff’s rear mech the shifter was difficult to turn on the handle bars. Only after I applied silicone compound (lubrication) to the inside of the Rohloff’s grip shifter housing did the shifting become as smooth as the Big Dummy’s Rohloff. I’m so relieved to have finally resolved this.

Last note… I used AGS Silicone Compound for the grip shifter’s lubrication, because chatter online indicates it will be compatible with PLA (what the 8201 grip shifter is now made of). I’ll post updates here. Should the Silicone Compound weather poorly, I will consider switching to a lithium grease.

Download Site Videos

On rare occasion I’ve wanted to download videos for instance that the University of Minnesota posts. Get the video playing, then inspect the code within Safari (press command-option-U). Next select the “Network” tab, search for “master.m3u8” and select it. The righthand pane will show a preview of the code, right-click and copy the video’s link. Download the video using VLC->File-Convert / Stream. I left the defaults and downloaded the video as a .ts file. Now to convert that into a format that is smaller…

Cycliq Fly6 CE Gen3 Repair

My bike light stopped charging this winter. I was hoping it was a battery issue and that I could replace it with one of the many batteries I’ve scrapped from street vapes, but the repair was easier than that. I published the repair on iFixit, enjoy, and make sure you have some dielectric silicone compound handy. I’m hoping my light continues working until the battery fails. Expect updates here.

** Update 4-7-2025 **
The repair is holding true. The light seems to be working as if it were brand new. Prior to its repair, the seemingly diminished capacity of the battery forced me to use it in camera-only mode and with the light’s LED extinguished. After this repair, I am happy to report I am once again using the light’s LED and camera simultaneously, functionality is fully restored!

Download Videos from Microsoft Teams/Stream

Sometimes it’s difficult to get a video owner’s permission to access a video in Microsoft Stream. To download the video to a computer, use a pre-built copy of “Sharedown” (or build Sharedown from scratch following its readme) and follow these instructions:

  1. Log into stream.microsoft.com and find your organization’s video that you want to download.
  2. On the righthand side of your browser window, click the red button titled “Share”, then tap “Copy link”, and tap “Copy”.
  3. Launch “sharedown” and paste the link you copied from Step 2 – view this to see screenshots of this step.
  4. The saved video should now be located in the output folder you selected – review “sharedown” wiki if you get stuck using it.
  5. I used Sharedown 5.3.6 running on macOS 14.7.2 and it worked well.