sc
Scott avatar
ttwillsey

All the GPTs

Mac

Part of the Mac series

GPT - What is it good for?

Human communication is weird. It’s so nebulous and imprecise and dependent on visual cues like eye-to-eye contact and physical observation of the party we’re communicating with. I often used to imagine how much life would be easier if we could do direct data dumps into each other’s brains, like computers sending information to each other.

How funny it is to me then that machine learning is making advances by using large language models to let computers parse incoming information through the context of human language in order to let systems with different APIs and data formats communicate with each other. It turns out that the future of computer communication may well be based on the less precise and more misunderstanding-prone human forms of verbal communication.

All philosophical musing aside, the point is that I’ve been using ChatGPT to do computer related tasks for me like write AppleScripts, bash scripts, and detail nuances of Swift code. These are the types of things I believe the GPT LLMs are best at. I don’t like arguing with it to make it do things it’s not good at or isn’t supposed to do, and I understand and share the social and ethical concerns voiced by people like Timnit Gebru and Emily M. Bender. In addition, there’s the question of resource usage, and LLM training requires tons of it.

That’s a lot of off-topic information to prepend onto what is basically a post about what ChatGPT tools and applications I use, but I think it’s important to think about these things and not just blindly fall into the AI craze and believe everything people like Sam Altman want us to believe.

GPT apps

“Blah, blah, blah,” you say, “what about the apps?” Fine. Let’s talk about some ChatGPT apps I like.

MacGPT

By far the GPT app I use the most is MacGPT by Jordi Bruin. MacGPT primarily runs as a menubar app, but it also features global mode (a pop up query field that looks like Spotlight) and inline mode (letting you get responses from ChatGPT right inside your text documents and text fields).

As an example of inline mode, I’m going to trigger MacGPT to have ChatGPT tell me if Python 3 supports async/await right here inside this post.

Does Python 3 have async/await functionality?+gpt

Yes, starting from Python 3.5, async/await functionality is available in Python. It allows for asynchronous programming, which can greatly improve the performance of certain types of applications. The async/await keywords are used to define asynchronous functions and to wait for the results of asynchronous operations.

Here’s what that looks like in action:

MacGPT allows you to use either a native Mac UI for interacting with ChatGPT or the OpenAI web view for ChatGPT. Both have pros and cons - the OpenAI web view allows you to keep your history available there for access across all platforms, while the native UI looks nicer and (hopefully) in the future will have greater customization. I’d like to see an even wider menubar view, and complete font customization including font, font size, and bubble colors.

MacGPT native view

MacGPT web view

Both views allow for copying of conversations, but the native UI copy function copies the entire conversation in the window including both your prompts and ChatGPT’s replies, while the web view only allows you to copy a ChatGPT response and doesn’t include the preceding prompt that you entered.

MacGPT isn’t perfect, but given the low cost of entry (it’s basically donation-ware) and the pace at which Jordi has added updates, I have high hopes for its future.

Machato

I recently stumbled across another Mac ChatGPT app called Machato. Machato takes a different approach than MacGPT in that it just runs as a normal Mac app and doesn’t have menubar, inline, or global (floating textbox) functionality. I miss MacGPT’s menubar aspect when using Machato, but it has some compelling features of its own.

Machato

Machato lets you create multiple conversations so you can categorize by topic, and it also allows you to create folders to further organize them. It also has a very handy ability to branch a conversation so that you can pick a point to split off into a new conversation. All you have to do is hover over a prompt or response and click the “Branch from here” icon. It’s super handy.

Machato also lets you pick the output type for copied conversations – Markdown, LaTeX, or plain text.

And finally, Machato keeps track of your usage costs per day, week, month, or all time. I would love to see MacGPT steal this feature.

I’m kind of torn between MacGPT and Machato, because Machato has the superior UI and functionality for serious “help me with my programming” use, for example, but MacGPT has the nice always-there presence with its menubar component and the ability to pop that open and closed with a keyboard shortcut.

Petey

Another interesting entry into the ChatGPT space is Petey. Petey is for iOS and (get this) Apple Watch. Yep, you can ask ChatGPT things from your watch. You can share the results to messages or mail on the watch, or copy and paste them by sending the answer to your iPhone with one tap, and copying the answer from there.

Petey for watchOS

On iOS, it’s not quite as interesting to me as the next app in my list, because it doesn’t let you do multiple conversations or look at the history as easily. You can ask questions, get answers (and have them read back to you), and copy and paste them, but that’s about it.

Petey is well-designed, playful, and fun. For more background and information about Petey, you can hear it directly from app developer Hidde van der Ploeg1 on episode 60 of the Launched podcast.

Petey is $4.99 and has an in-app subscription, but if you have your own OpenAI API key, you don’t need to pay for the subscription.

GeePeeTee

GeePeeTee is Jordi Bruin’s iOS companion app to MacGPT, but it has some interesting features that MacGPT doesn’t. The most interesting feature to me is Conversations, similar to the same feature in Machato. My assumption is he plans to bring that to MacGPT at some point, but I haven’t bothered him to ask yet.

GeePeeTee doesn’t have a watchOS app, but it is better for iPhone use than Petey. Either way, you can’t go wrong. GeePeeTee is free on the App Store, but you need an API key.

Summarium

ChatGPT can be an effective tool to learn things and shorten writing or programming time if used wisely. It’s also wildly overhyped and has replaced crypto as the buzzword de jour, but the result is that lots of developers are writing apps against its API. You can probably guess by the fact I own and am talking about them that I like all the above apps (I do). I recommend you give them a try if you’re a Mac and iOS user who has room for ChatGPT in your workflow.

Footnotes

  1. No, I have no clue how to say that, but Clay Daly certainly must.

One More One More Thing: LaunchControl

Mac

Part of the Mac series

I inadvertently lied to you. I bragged about using a bash script to get my current external IP address and putting it in my menu bar with One Thing, and about scheduling that to happen on a predetermined frequency by creating a LaunchDaemon plist and registering it with launchctl. But there’s just one problem.

It didn’t actually work.

After a bunch of digging around, I figured out the reason was I was making some extremely basic scripting errors, but I’m glad it happened because along the way I also learned about some changes to how launchctl works in current macOS versions, and also about a program called LaunchControl.

My primary error was that I forgot about how the Unix PATH and execution environment interaction works. Basically in Unix, your PATH variable dictates what directories the shell will look in to find the application or script you are telling it to execute, whether in a script or at the command prompt. I forgot that just because I could run my script at the command prompt and have it work, that didn’t meant that it would execute in the same environment with the same PATH as mine when executed as a LaunchAgent entry, even though the LaunchAgent is in my user directory’s Library/LaunchAgents directory. Therefore it could neither find one-thing (located in /usr/local/bin) in order to run that, nor could it find node.js which one-thing relies on (also in /usr/local/bin).

The solution was to add /usr/local/bin to the PATH variable for the environment that launchd runs my script in.

#!/bin/bash
export PATH="$PATH:/usr/local/bin"
# Show Update in Progress
one-thing "getting IP..."
# Execute the dig command and store the output in a variable
IP_ADDRESS=$(dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com)
IP_ADDRESS=${IP_ADDRESS//\"/}
# Pass the IP address to the one-thing command
one-thing $IP_ADDRESS

Very simple.

Along the way though, before I realized my remedial error, I was worried that Ventura was causing permission errors or blocking executing of the script by launchd. As I researched this possible angle, I discovered a program called LaunchControl. LaunchControl describes itself this way:

LaunchControl is a fully-featured launchd GUI allowing you to create, manage and debug system- and user services on your Mac.

As you may remember, launchd handles User Agents (~/Library/LaunchAgents), Global Agents (/Library/LaunchAgents), Global Daemons (/Library/LaunchDaemons). LaunchControl allows easy viewing, execution, and modification of all of these in one location.

LaunchControl

It also allows for easy editing of the file being run by the Agent or Daemon, which makes trying things simple.

Edit Script in LaunchControl

You don’t need LaunchControl to create and edit Agents and Daemons. You can create and edit plist files manually and many (most?) people do. But LaunchControl makes it easy in the same way that most people would much rather use VSCode or some other context-aware IDE to work on projects than to do it in TextEdit. It’s a powerful tool that makes something that is a chore easier and less error prone, and that seems like a good thing to me.

One (More?) Thing

Mac

Part of the Mac series

Just about one year ago, Joe Rosensteel wrote on SixColors about putting local weather data in his menu bar. Aside from the entire system that gets the weather and gets it to his computer, the way he displays it in the menu bar is with a little utility app called One Thing. I thought it was a cool app, and I downloaded it, but never really made use of it. Until today.

Today I was digging through web server logs to solve a non-pressing but quite interesting problem, and I realized I was tired of using What’s My IP type web services to see who I am so I would know which log entries on my server are me. I put the IP in Tot so I could easily refer to it, and then I thought, “that’s great, but what about when it eventually changes?” Even though it almost never happens, it does happen very occasionally. Also, when I’m working with my terminal app in fullscreen mode, I don’t want to have to dig around for a note.

Enter One Thing.

I figured the easiest way to get a value into One Thing for this purpose would be from the command line, so I installed the One Thing command line tool. Then I googled for a nice command to get my external ip address from the command line and found

dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com

I decided to make Peter happy by making ChatGPT do my scripting for me and asked MacGPT to write a bash script that runs the dig command, removes the quotes the dig command places around the IP address, and then passes the output to the one-thing command line tool. That script looks like this:

#!/bin/bash
# Execute the dig command and store the output in a variable
IP_ADDRESS=$(dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com)
IP_ADDRESS=${IP_ADDRESS//\"/}
# Pass the IP address to the one-thing command
one-thing $IP_ADDRESS

The comments in the script are MacGPT’s, by the way.

Although I’ve done tons of cron jobs on linux servers, I don’t think I’ve ever actually scheduled any tasks on a Mac in recent history. I knew I was going to want to use launchd but I was fuzzy on the details. I asked MacGPT what to do, and it told me to make a plist file that references my bash script, shove it in /Library/LaunchDaemons, and set some file permissions and file ownership settings, and register it with launchd using the launchctl command.

I replied, “that’s cool, but maybe you should write the plist file for me”, and it did.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.scottwillsey.my-ip-address</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Users/scott/Scripts/bash-scripts/my-ip-address.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>12</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>

I moved this file to /Library/LaunchDaemons, set owner and permissions with sudo chown root:wheel com.scottwillsey.my-ip-address.plist and sudo chmod 644 com.scottwillsey.my-ip-address.plist.

Now /Library/LaunchDaemons looks like this:

scott@Songoku:bash-scripts ll /Library/LaunchDaemons
total 72
drwxr-xr-x 11 root wheel 352 Apr 8 17:12 .
drwxr-xr-x 70 root wheel 2240 Apr 7 13:30 ..
-rw-r--r--@ 1 root wheel 569 Mar 16 14:12 com.backblaze.bzserv.plist
-rw-r--r-- 1 root wheel 428 Mar 14 19:02 com.microsoft.autoupdate.helper.plist
-rw-r--r--@ 1 root wheel 594 Nov 16 23:23 com.objective-see.blockblock.plist
-rw-r--r--@ 1 root wheel 399 Jun 11 2018 com.objective-see.ransomwhere.plist
-rw-r--r--@ 1 root wheel 781 Nov 11 09:20 com.rogueamoeba.aceagent.plist
-rw-r--r--@ 1 root wheel 777 Nov 11 09:20 com.rogueamoeba.acetool.plist
-rw-r--r-- 1 root wheel 598 Apr 8 17:10 com.scottwillsey.my-ip-address.plist
-rw-r--r-- 1 root wheel 580 Nov 26 09:26 net.telestream.LicensingHelper.plist
-rw-r--r-- 1 root wheel 532 Jan 13 12:26 us.zoom.ZoomDaemon.plist
scott@Songoku:bash-scripts

As usual, the script itself needs execute permissions.

chmod +x my-ip-address.sh

And now I have my IP address in my menu bar!

The IP address in my menu bar

By the way, the IP address shown isn’t really mine. It’s Microsoft’s. Don’t try to DDOS them, but if you do I can only assume they have better DDOS protection than I do.

AppleScript GPT

Mac

Part of the Mac series

I’ve been playing with using ChatGPT (via MacGPT) with the gpt-3.5-turbo model to help script things. Today I wanted an AppleScript to rename some files by sticking a UUID in between the base file name and the file extension (e.g., rename MyImage.png to MyImage-FFE9D8C8-8AEE-42E2-8A48-F0C328A9E5F2.png). I asked MacGPT to write the script and this is what it came up with:

-- Prompt user to select input directory
set inputFolder to (choose folder with prompt "Please select the input directory")
-- Prompt user to select output directory
set outputFolderAlias to (choose folder with prompt "Please select the output directory")
set outputFolder to (outputFolderAlias as string)
-- Generate a UUID
set uuid to (do shell script "uuidgen")
tell application "Finder"
-- Get a list of all files in the input directory
set fileList to every file of folder inputFolder
-- Loop through each file and copy it to the output directory with a new name
repeat with aFile in fileList
set fileName to name of aFile
set fileExtension to name extension of aFile
set baseName to text 1 thru ((length of fileName) - (length of fileExtension) - 1) of fileName
set newName to baseName & "-" & uuid & "." & fileExtension
set newFile to outputFolder & newName
duplicate aFile to folder outputFolder with replacing
delay 3
set name of (file newFile) to newName
end repeat
end tell

It actually had delay 1 but I set it to 3.

But this script is wrong. Running this script generates an error about not being able to rename the apparently already renamed file, complete with UUID, to the desired (same) name, complete with UUID.

Finder got an error: Can’t set file "Macintosh HD:Users:scott:Documents:Podcasts:FwB:BrewsImages:OUT:Cup_Shots_Kagoshima_800x-559DCE44-3B60-4CE9-8AEE-1A862C6498FA-CBC0F756-F7E3-4368-ACFB-98F4DC50E1BB.png" to "Cup_Shots_Kagoshima_800x-559DCE44-3B60-4CE9-8AEE-1A862C6498FA-CBC0F756-F7E3-4368-ACFB-98F4DC50E1BB.png".

The reason is simple: ChatGPT set the newFile variable to outputFolder & newName and then tries to set the name of file newFile to newName later.

The correct code for the repeat loop section is:

repeat with aFile in fileList
set fileName to name of aFile
set fileExtension to name extension of aFile
set baseName to text 1 thru ((length of fileName) - (length of fileExtension) - 1) of fileName
set newName to baseName & "-" & uuid & "." & fileExtension
set newFile to outputFolder & fileName
duplicate aFile to folder outputFolder with replacing
delay 3
set name of (file newFile) to newName
end repeat

The only difference here is that now when the newFile variable is created, it’s set to outputFolder & fileName (the original filename) so that when it looks for the file to rename, it correctly looks for the original file name.

I told MacGPT about its mistake and it claims to be glad that I did, but I wonder if it learns that way. I don’t think its model changes based on user feedback, but I don’t really know what all goes into improving its learning.

By the way, in case you’re wondering why I’m using AppleScript in 2023 for a new task, it’s because I can use AppleScript very simply to tell Retrobatch to run a saved workflow that crops images to a square ratio and save them as png. Since I’m already running the AppleScript, I’m also using it to stick the UUID into the file names, something I was using a shell script for. I would have just had my Retrobatch workflow run the script, but I couldn’t get it to work correctly and I’m not sure why. The documentation on how the shell script action in Retrobatch works isn’t super comprehensive, and I didn’t find anything in the Flying Meat forum that helped either.

And to answer what might now be another question of yours, in general I stick a UUID in image file names because I don’t ever want to have to worry about image file name collisions when I shove them in the site images folder. I just want to upload them and be done with it. If I have the UUID in the file name when I start writing my post, all I have to do is make sure none of the images in that particular post have the same name (I use one UUID for all images in a post).

Bunch of Amphetamine

Mac

Part of the Mac series

Last month I wrote about Bunch, a wonderful utility for scripting work sessions, complete with sets of apps and the ability to customize various Mac settings. Last night as I was creating transcripts for Friends with Brews,, I realized that part of my transcription workflow could be handy for podcasting as well – namely, starting an Amphetamine session.

Sounds a little extreme, you might be thinking, but it’s actually less controversial than that. Amphetamine is a Mac utility that can keep your Mac from sleeping for a predetermined period of time, with granularity. Want to let the monitor sleep, but nothing else? Can do. Want to set a trigger so that whenever a specific app is running, Amphetamine is active? Can do!

In my case, since I already set up for podcasting by running my podcast bunch, I decided to see if I could trigger an Amphetamine session on and off with it. The answer is simple – can do! The reason is William Gustafson, creator of Amphetamine, made it possible to trigger sessions with AppleScript, and Brett Simmons, author of Bunch, supports running AppleScript commands in a bunch. Problem solved.

Starting an Amphetamine session with AppleScript in a bunch script:

* tell application "Amphetamine" to start new session

The asterisk tells Bunch that the following is an AppleScript command. It’s not part of the AppleScript syntax.

Stopping an Amphetamine session with AppleScript in a bunch:

* tell application "Amphetamine" to end session

Just by adding these lines to my podcast bunch, I now have the ability to stand in front of my Mac for long podcast sessions without touching mouse or keyboard and not having to worry about the screensaver kicking on. Perfect.

Astro Markdown Image Story

Part of the Astro series

Until now, Astro hasn’t had a built-in way to dump image links in straight Markdown content files and have Astro generate optimized images and responsive HTML for them. This caused me a problem, which I partially solved by using MDX instead of Markdown for blog posts, and importing and calling Astro Image inside the MDX post files. This SOUNDS great, because this is the whole purpose of MDX, in MDX’s own words:

MDX allows you to use JSX in your markdown content. You can import components, such as interactive charts or alerts, and embed them within your content. This makes writing long-form content with components a blast. 🚀

There are, however, a couple problems with this. One of them I’ve spoken about on this site, which is MDX makes it very hard to generate full-content RSS feeds with Astro (part 1 and part 2 of that saga here and here).

Also, using the Astro Image component directly in my content means mixing writing and implementation details, something I strongly dislike. When I’m writing a blog post, I don’t WANT to have to remember Astro Image syntax, and I don’t WANT to have to remember exactly what widths I like to specify and what media-query-ish styling I put in the sizes attribute. I just want to write and to let my system handle all that by itself. That’s what computers are for.

Here’s what it looks like when I want to put an image in one of my posts using MDX as my content file format and the Astro Image component directly inside my blog post:

---
import { Picture } from "@astrojs/image/components";
import somethingSomething from "/images/posts/somethingsomething.png";
---
<Picture
src={somethingSomething}
widths={[600, 900, 1200, 1500]}
sizes="(max-width: 800px) 90vw, 800px"
formats={["avif", "webp", "png"]}
alt={"This is a lot of work just to drop an image in a blog post"}
/>

I don’t want to remember that. I never want to think about that at all. I want to put an image link in using standard markdown and have Astro do all that for me.

[![This is a lot of work just to drop an image in a blog post](../../assets/images/posts/somethingsomething.png)](/images/posts/somethingsomething.png)

I have two pieces of good news for you if you’re in the same boat as me:

  1. The wonderful people at Astro are building an Astro Assets integration that can create optimized versions of and responsive img tags for images linked to in Markdown.

  2. In the meantime, you can use the really nice and fully functional Astro Markdown Eleventy Image Astro component by CJ Ohanaja. As you may have guessed, it uses Eleventy Image to do the work of intercepting Markdown image links and replacing them with responsive ones (and generating the responsive images themselves, of course).

The Astro Assets integration loudly proclaims itself as experimental, and that’s not self-deprecation: it won’t build. It runs great in the dev server, but it gives all kinds of wacky errors when trying to build. But just using it in dev mode is enough to see the future, and it’s great.

As for Astro Markdown Eleventy Image, it works great in build, but it doesn’t bother to optimize anything in dev mode. That means if you use the browser inspector tools to look at your images while testing in dev mode, you’ll see gigantic original file sizes. You’ll have to build and run preview to serve up the built pages locally to see its handiwork.

But the good news is, you can quit or never start using MDX right this minute, and you can still have optimized images from Markdown image links with Astro.

By the way, in case you’ve forgotten my RSS story at the start of this, now that I’m using straight Markdown files for my posts again, I can just straight up go back to using Astro RSS and generate an RSS feed with full post content, and not have to do my hacky custom nonsense anymore.

That’s such good news for me, because that hack only generated the RSS file in dev mode, so every time I did a build I had to copy the RSS.xml to the dist folder, AND remember to change all the link prefixes from http://localhost:3000 to https://scottwillsey.com.

Another annoying implementation detail I never want to think about again, vanquished!

Friends With Transcripts

I talked before about Whisper.cpp and my goal of getting episode transcripts up on the Friends with Brews website. That day is here! We now have transcript functionality on the site.

You’ll notice I said transcript functionality. I’m weasel-wording it a bit there because now I need to generate transcripts for all the episodes. So far I have them for episodes 1, 22, and 26 (the current podcast episode as of this writing).

On the Friends with Brews homepage, click the Transcripts link under the podcast description paragraph, and you’ll see a list of available transcripts.

Friends with Brews episode transcripts

In addition, any episodes with available transcripts will show a transcript link under its episode title.

Episode transcript link

The transcript pages themselves have links to the episode page, to the transcripts index, and to the episodes index, in addition to an episode description followed by the transcript.

Episode 26 transcript

I still have more work to do on this feature. I plan to make the raw transcripts downloadable, and also to integrate them into the RSS feed with srt formatting, at the suggestion of John Chidgey.

One thing you’ll notice right away is the transcripts are not perfect. I haven’t done any A B testing yet, but I think the transcript better separates transitions in speakers if I only output the transcript as a raw text file and don’t simultaneously output the srt file and the raw text file. At any rate, Whisper.cpp doesn’t know about individual speakers, and so there are no names showing who is saying what.

Also, Whisper gets some things wrong, and there will occasionally be some confusing text that doesn’t exactly match what we were saying at that point. Overall though, I think they’re pretty good and at least you can search the site and find what episode contained some specific mention of something. Again, it’s not perfect - if you search for Shaquille O’Neal (mentioned in episode 1), you won’t find him, because the transcript butchered the spelling of his name and I didn’t fix every typo that Whisper.cpp made.

Still, I think having transcripts, even imperfect ones, is a net gain for the site and the podcast. It adds more work for me as I have to generate them and then clean them up, but now that I have the functionality built into my Astro code, getting newly generated transcripts published is a snap.