A blog about everything, by Jack Baty

Using .bike files as templates in DEVONthink

(originally posted on my wiki, but thought it would be more discoverable here)

I keep several template files in DEVONthinks Templates.noindex folder so I can easily create copies using Data->New from template…

When doing that with a Bike App template, DEVONthink would create an .html file instead. After some digging, I learned that there’s a hidden preference called “AdditionalPlainTextExtensions” and I needed to add .bike to the list.

First, I checked to make sure there were no current additional extensions (one line):

defaults read com.devon-technologies.think3 AdditionalPlainTextExtensions

Then, I added .bike (one line):

defaults write com.devon-technologies.think3 \ 
         AdditionalPlainTextExtensions -string .bike

Fixed.

Grab the weather forecast using weatherapi.com

I like to record the weather in my journals. For several years, I’ve used https://wttr.in via curl. Recently, wttr has often been unreachable or would throw errors, so I took a look at https://www.weatherapi.com/

Designed for developers by developers, Weather API is the ultimate weather and geolocation API

The free account limits are generous, so I created an account. The default JSON results are very thorough. I created a little shell script that returns only the high/low temps and a text summary of the forecast:

#!/bin/sh
# Jack Baty, 2023 (https://baty.net)

jq=/opt/homebrew/bin/jq
weatherfile=`mktemp`

curl -s "https://api.weatherapi.com/v1/forecast.json?key=MYAPIKEY&q=MYZIPCODE&days=1&aqi=no&alerts=no" > $weatherfile

condition=`${jq} -r .forecast.forecastday[0].day.condition.text ${weatherfile}`
high=`${jq} -r .forecast.forecastday[0].day.maxtemp_f ${weatherfile}`
low=`${jq} -r .forecast.forecastday[0].day.mintemp_f ${weatherfile}`

echo "Low ${low}, High ${high} - ${condition}"

The output looks like this:

Low 52.1, High 72.6 - Patchy rain possible

Easy enough. I wrote a small lisp function for inserting the weather in Emacs:

(defun jab/insert-forecast ()
  "Use weatherapi.com to insert the weather forecast at point"
  (interactive)
  (let ((w (shell-command-to-string "~/bin/getweather")))
  (insert w)))

RSS feeds as emails using Notmuch and rss2email

I’m all-in with Emacs after once again failing to get along with Obsidian.

I’d stopped using Notmuch in Emacs for email, but I brought it back after re-reading Paul Ford’s article in Wired: I Finally Reached Computing Nirvana.

Could I too start storing things as email and find them later using Notmuch?

So far, I’ve solved RSS feeds. Rather than reading feeds in NetNewsWire or Elfeed, I’m using rss2email to convert RSS feeds to emails and reading them in Notmuch.

A good reference for getting started with rss2email is LinuxBabe’s How to Install and Use rss2email on Ubuntu

The tricky part of rss2email is actually sending the emails. I eventually got things working using msmtp, which would have been fine, but it’s a lot of extra hoohah. If only I could save the RSS items directly into Notmuch. Guess what, I can!

rss2email supports writing to Maildir files. It was as easy as adding the following to my rss2email config:

email-protocol = maildir
maildir-path = ~/Mail/Baty.net
maildir-mailbox = Feeds

rss2email supports importing OPML files, but I decided to clean things up and add feeds one at a time, like this:

r2e add BatyBlog https://baty.blog/feed.rss

Then, when I want to read my feeds I run r2e run and everything ends up right in Notmuch. I don’t want them tagged with inbox” along with my real email, so I added a filter to the post-new hook in Notmuch.

notmuch tag +feed -inbox -- '(from:jack+rss@baty.net)'

I have the rss2email sender configured as so it’s easy to filter just those messages. With that hook, new RSS feed items do not appear in the inbox, but I can easily read them in Notmuch by searching for tag:feed AND tag:unread.

So there, I’ve moved my RSS feeds into emails and manage them via Notmuch.

Pebble.is and AI

Wired: X Challenger Pebble Thinks AI-Generated Posts Can Help Lure Users Away From Elon Musk:

Pebble, a Twitter-style service formerly known as T2, today launched a new approach: Users can skip past its What’s happening?” nudge and click on a tab labeled Ideas with a lightbulb icon, to view a list of AI-generated posts or replies inspired by their past activity. Publishing one of those suggestions after reviewing it takes a single click.

I hate this so much.

I’m in Easy Mode

Sometimes I feel like doing things the easy way. I don’t want to think about every step of every process. I just want to do something and then do something else.

The problem is, I can’t seem to consistently define easy”. For example, I’m typing this in Emacs for my Blot.im blog. To create this post I ran a custom lisp function that automatically creates the Markdown file, fills in the YAML front matter, and puts the cursor at the ready. Dropbox then syncs the file and Blot’s server renders the post. Easy, right? Not really. There’s a lot going on there. So is it easy if it’s easy now, even though it was difficult to get here? Or, does easy have to mean that there’s nothing to it, right from the get go?

I honestly don’t know.

Forklift 4 on SetApp

I use Forklift all day on my Mac. They just released version 4, which looked like a nice update. Forklift is included in SetApp, but wasn’t getting the update, so I was concerned it was going to be left out. I needn’t have been worried, the update was installed today via SetApp and I’m good to go.

I haven’t forgotten you, Blot.

Kev Quirk suggested that he might move away from Blot due to some weirdness and search issues. Of course this reminded me that I haven’t posted to Blot in some time and I miss how simple it all is. Plus, I like how my theme looks. Why’d I stop using it, again? 😜

Also, It’s back at the baty.blog domain, just in case.

This is the kind of thing I do to myselfThis is the kind of thing I do to myself

Wednesday, June 14, 2023

Blot.im has been down for going on two days now. I assume this is due to Amazon’s AWS issues over the past 24 hours. Still, it’s a bummer. As a defensive maneuver I’ve moved the site back to Hugo, at least for now.

Update (3:45 p.m.): Blot is back up after the server was caught in a deathloop”. I copied today’s entry over and pointed the DNS back to Blot.


Mike Hall is on a roll with his Denote setup. I’m following it all closely because I use a nearly identical set of tooling, except mine is not nearly as well thought out or complete as his. His latest adjustment is around org-gtd and Things. I’ve been using org-gtd for a week or so and I’m also not sure it’ll stick. Mike created a nice way to generate links between Denote notes and Things that has me thinking.


Speaking of Mike Hall, He recently posted about how he’s generating a searchable, static HTML version of his Denote notes so that he can look stuff up while on his phone. All I want from my Denote notes on iPhone is the ability to find and read them. I asked Mike to share his setup, which he kindly did. A few path tweaks and I was up and running in no time.


If y’all were born in the 50s or 60s you’d have done things exactly the same as we did. And if we were born in the 80s or 90s we’d be bitching about it, same as you. Just like your kids and/or grandkids will be bitching about all the stupid things you’re doing that will turn out to have been mistakes.

Renaming an item in DEVONthink to match the name of its parent group

When creating a new project folder (group) in DEVONthink, I often make use of Templates. Templates are just files in a folder somewhere that get copied into the DEVONthink database. For example, I have a project starter” Tinderbox document named Basic Project Template.tbx”. When inserting the template file into my DEVONthink project, it uses the same name as the original, which isn’t helpful. DEVONthink is very scriptable, so I wrote an AppleScript to rename the selected document the same as the enclosing group/folder.

Well, I didn’t exactly write it. It’s more like I conjured it.

I first tried copying an existing script that seemed like it would give me a head start and set to modifying that. I didn’t know how to refer to the enclosing group in AppleScript so I started to browse DEVONthink’s dictionary. It occurred to me that maybe I could just ask ChatGPT for help, so I typed:

Write me an applescript to rename an item in DEVONthink to the name of its enclosing folder”

ChatGPT wrote the following:

tell application "DEVONthink 3"
    -- Get the currently selected item
    set selectedItem to content record of viewer window 1
    
    -- Get the enclosing group (folder) of the selected item
    set enclosingGroup to parent 1 of selectedItem
    
    -- Get the name of the enclosing group
    set enclosingGroupName to name of enclosingGroup
    
    -- Get the name of the selected item
    set selectedItemName to name of selectedItem
    
    -- Generate the new name by combining the enclosing group name and the selected item name
    set newName to enclosingGroupName & " - " & selectedItemName
    
    -- Rename the selected item with the new name
    set name of selectedItem to newName
end tell

It worked great on the first try. The only change I made was to remove the selectedItemName” from the final name. What a world.