Things I Have Written

File Name Parsing With Regular Expressions

I haven’t talked more about regular expressions like I promised I would, but I’ll partially rectify that today by writing about a regular expression I created last night for my Blog Post Publish shortcut. This one applies specifically to how I name my blog post files for WTF Weekly.

Since WTF Weekly post titles are just dated blurbs like WTF Weekly for Oct 12th, 2020, I decided to name the post markdown files as consecutive numbers, starting at 1. I also make the post slug match this number so that the URLs are very simple, such as https://wtfweekly.me/41/ in the case of the one for Oct 12th, 2020.

Originally when I wrote my Blog Post Publish shortcut, I was entering slugs and file names manually as user input. This was partly because I do this already for this site, because instead of numbering posts, I give the files and slugs names related to the topic. The …

(Read More)

Super Nova

Nova is here, and it’s every bit as super as you’d expect software from Panic to be.

What is it? It’s a Mac-native text editor for programmers that seems like has been under development forever, but in reality it’s only been something like 14 months since Panic first announced that Nova was the future of Panic text editors, replacing Code Editor, née Coda.

Nova’s got style and it’s got features with style. Local and remote servers, local and remote terminals, git support, hierarchical element support, multi-language syntax and highlighting support, tabs, built-in preview browser with inspector tools, and much, much more.

Nova editor and preview browser

Nova git tool pane

Nova document hierarchy view

I’ll be interested to see how Panic does with this in the face of competition from the likes of Visual Studio Code and Atom, which are both very full-featured, support …

(Read More)

AQI Tracking Over Time with Shortcuts, Data Jar, and Charty

I live in an area that was recently the most polluted city in the world, thanks to fires on all sides of us. Although I have the ability to glance at the AQI (Air Quality Index) widget on my Apple Watch and see the AQI instantly at any time, I also wanted to track AQI over time. To do so, I created a shortcut that uses Data Jar to store samples into periodically throughout the day, and to use the last 45 samples to generate a chart using Charty for Shortcuts actions which can then be displayed in an iOS widget stack using a Charty Widget.

The shortcut itself is quite simple. It gets the weather for the current location, and from that, the current AQI value. It then stores that value in Data Jar in a table called AQI with the current date and time (down to the second) as the key. …

(Read More)

Level Up Your Zsh Terminal Prompt in macOS

Scott Hanselman is one of the good people in tech, and his YouTube channel is full of great tech topics explained in his clear, instructive fashion. While watching one of his git videos, I noticed his nice Windows terminal prompts that even indicate git status for him when he’s in a repo directory. You can see his terminal setup in his blog post How to make a pretty prompt in Windows Terminal with Powerline, Nerd Fonts, Cascadia Code, WSL, and oh-my-posh.

Obviously the first thing I did upon seeing this was pause the video and go in search of a way to make my Mac terminal do that crazy prompt thing. As I discovered, it’s easy if you use Zsh, which I already do.

Note: All this below assumes you’re already using Zsh as your shell.

You can see for yourself whether you’re using Bash or Zsh with the echo $SHELL command. You’ll …

(Read More)

Homebridge Logs

You may know that Homebridge is an outstanding piece of software that lets you tie many smart home devices that don’t have native HomeKit support into your HomeKit ecosystem, but I submit to you that one of Homebridge’s biggest benefits besides that is its logging.

Most smart home devices are just kind of there and do their thing, but you have no insight into historical activity, aside from HomeKit secure video cameras which keep recordings around for some period of time depending on your available iCloud space. Homebridge changes that.

Homebridge logs the activity of any devices connected to it. If a light goes on, it gets logged. If someone connects to the smart doorbell camera and takes a peek, that gets logged. It’s wonderful. You can set up your Homebridge Config UI X web view to show the more recent entries in your log file, which is handy for quick understanding of recent activity if you’re restarting the service or adding or updating plugins. …

(Read More)

RSS to Text in Shortcuts

Sometimes Shortcuts makes me scratch my head in bewilderment at how convoluted dealing with different data types can be. If you ever pull in an RSS feed to parse, you’ll know what I mean.

I’m writing a shortcut for Ronnie Lutes to easily publish episodes of The Liner Project. Why he needs a shortcut to do this is another topic, but primarily it’s because we’re hosting his site in a static site generated by Hugo. In order for him to get an episode added, uploaded, and scheduled for publication without having to deal with an annoying checklist of tasks that all have to be done in exactly the right way each time, an automation is perfect.

In order to present as few information-gathering dialogs and text boxes to Ronnie as possible, the shortcut tries to figure out everything it needs to about the episode being published, including things like season and episode number. A lot …

(Read More)

Diffable

It’s amazing the caliber of people who just randomly pop into your Twitter life sometimes. I posted about the lack of text diff tools on iOS a couple days ago, and the very next day Jacob Sam-La Rose very kindly gave me a tip that took me in a direction I didn’t expect: JavaScript and web views.

It turns out that Jacob is the author of a very handy Diff action for Drafts that uses this very trick to let people compare a draft in current form to a previously saved version. It’s really cool use of a web preview and it’s something I would have used many times in Drafts had I realized it existed.

Drafts Diff action by Jacob Sam-La Rose

As Jacob mentioned to me, the JavaScript Diff Algorithm written by John Resig is easily applied to any JavaScript parser such as Scriptable, which also allows for easy file selection for choosing two …

(Read More)

The Brilliance of Ulysses for Blogging

When I started the Hugo-based incarnation of this website, I wrote all posts for the site in iA Writer. It’s a very clean and focused Markdown text editor suited well for blogging with Hugo or other platforms that take Markdown and convert it to HTML.

Then I accidentally discovered a secret about Ulysses.

When you export a sheet to Markdown text from Ulysses, you get a text file of plain text with all your Markdown formatting. But when you attach images to that same sheet and export it as Markdown, it gives you a zip file with your Markdown document and all attached images. Furthermore, if you put the images in the text of the document, Ulysses lets you add image metadata which it then puts into the Markdown image tags that it creates.

Ulysses image attachments and metadata

The above image shows what it looks like when I attach an image to the sheet (attachment seen in the right attachments pane) and drag it into the document and add …

(Read More)

What the Diff?

Based on my luck at finding a good text diff tool on iOS, doing text diff must be the most difficult task in the universe. Is that was diff stands for? Difficult?1

There once was an amazing iPad app called Kaleidoscope that was beautiful and did an outstanding job of comparing text files, but its makers stopped updating it long ago and now it isn’t even on the App Store anymore.

Kaleidoscope for iPad was both powerful and beautiful.

Clearly this means I’m finally going to have to learn how to write iOS apps like I’ve been saying I was going to since 2008 and make my own text diff app.

This could cost me a few years of life I don’t have.


  1. Sorry. That’s a very difficult joke. ↩︎

Breaking the Shortcuts

iOS 14 beta is remarkably stable and performant, but running betas always carries a risk that a subsequent beta version will break something important to you. iOS 14 dev beta 2 (and public beta 1) broke some fundamental actions in Shortcuts – Split Text, Combine Text, and Change Case.

Because I have several shortcuts that do a lot of text parsing, not least of which are my blog post and podcast episode publishing shortcuts and helper shortcuts, I noticed this immediately. It didn’t take much troubleshooting and testing to realize that these three actions now return nothing regardless of input. They’re just completely broken.

The good news is (also thanks to changes made to Shortcuts for iOS 14) it’s very easy to create a folder for iOS 14 beta specific versions of your shortcuts, make copies to that folder, and then fix them. Folder …

(Read More)