smol projects

a really extra way to send myself reminders

14.09.2023 3 min read

So, since yesterday, I’ve taken a break from learning / reading / writing rust code. I really want to like rust… and actually, I do. I just find that the amount of upfront investment is tremendous - and maybe not worthwhile for personal projects (I never tend to get that far with those, anyway). Mostly, I find myself struggling with the type system, and return types. It’s not that much of an issue with self-contained code, but when dependencies are involved and each function requires some dependency-specific return type, I find myself at a loss on how to make the compiler happy. Saying that I’m out of my depth would be an understatement.


I’m still in “learning mode”, so I went back to go. I don’t dislike it as much anymore. The syntax is mostly fine. I’m not happy about the lack of functional methods, though. But development speed is so quick compared to rust. I wrote a small API that interfaces with a Pocketbase collection, which hardly took any time - and didn’t manage to get an equivalent working in rust, at all. And then I had an idea to implement something I’ve been thinking about for awhile. Namely, a way to send myself reminders for uncompleted tasks in Obsidian.

Bit by bit, I’ve been trying to move away from Google’s services, and I’ve been mostly successful (email is hard, and I may not ever make that happen). The one thing I find myself missing is Google Task’s push notifications. I love using Obsidian, but the mobile app doesn’t have push notification support - and that’s kind of important for time-bound tasks. I wrote something in go to do just that (which may or may not be that most extra thing ever). Here’s what goes down:

  1. Traverse my Obsidian vault with WalkDir
  2. If I find a file and not a directory, read the file’s contents and look for a regex match.
    // snip
    dtRegx, e := regexp.Compile(`(.*)\(@(\d+-\d+-\d+)\s(\d+:\d+)\)`)
    // snip
    taskRegx, err := regexp.Compile(`(-\s\[(\s)\])\s(.*)`) 

The above regex should allow me to get any lines with a datetime in this format @(2023-09-14 09:55) (it’s the format that Obsidian reminders format uses), then I’ll further search for unchecked tasks.

I have to then extract the match to the parts that are relevant to me: due time and task description.

Because I need a way to keep track of whether I’ve notified myself about a certain task, I need to persist data somewhere. For this, I’m using Pocketbase (again). I have the following fields: task (string), notified_day and notified_hour (bool).

  1. Check whether the task exists in Pocketbase. If it doesn’t exist, create one.
  2. Parse the time from the regex match and compare it to the time Now. If the task is close to being due (24 hours or 1 hour), send a push notification to a ntfy web server.
  3. Mark it as notified in the relevant field
  4. Sleep for 5 minutes, and run forever
  5. Build the go binary and run it as a background service

So… yeah. It’s extra, but it works. I’m pretty sure there are better ways of doing this - I just don’t know what they are yet. That said… I probably won’t use Obsidian tasks all that much, even with this, but it was a nice little project to learn a bit more go.

Built with Astro and Tailwind 🚀