Tiny Personal Programs I've written

Some of the tiny programs I’ve written. This list is inspired by Julia Evans’s Some tiny personal programs I’ve written.

One of the cool things of being able to code is that, when I have a problem I can simply write a program to solve it. Granted, there are tones of no-code solutions which likely to get me the same results. But writing a program from scratch is fun and the outputs I get is more customisable.

I remember when I first started to write program I was always so impressed by others’ projects, but sometimes I felt frustrated with myself because I felt like “I couldn’t come up with any programmable things to build” - I was so fixated in building “large project”. Julia Evans’s post made me realise I have been looking at it the wrong angle, small programs count too.

And here is the list of some of the the personal programs I’ve written:

Getting all the hiking routes information in one place

The hiking website I always refer to when planning our hikes (WalkinHighlands) doesn’t have a place where I can see all the information (e.g. ratings, regions, category) of different hikes in one place. It’d be easier for us to decide where to hike if we can visualise these information in one place! So I wrote a script to get the data from the different page and populated it in my local db. And now I can easily sort them in the order I want, with the information I need.

Learnings: parsing html, set up and query local psql, more about database

A friendly “friend” to cheer myself up

Some time I feel low and could use a sentence of encouragement from something. And I thought it’d be cool to have an API endpoints where I can call to get that! So I created one with AWS lambda and AWS Gateway. To add a personal touch, I can even send my name as query parameter so it will returns a string including it as if it’s really talking to me. A bit silly - but it makes me so happy everytime I call it.

And I still think it’s so cool we can just create an endpoint like that!

Learnings: Function as a service, Mapping template, clean URL

The script - the code is short, the tricky part was to set up the configurations.

Create Sticky note from the terminal

I wanted something on the top right corner of my screen to constantly remind me the task at hand. And I could either look for some Mac that support the functionality, or, use the pre-built function in Mac - Stickies! The goal is to be able to create the thing easily, preferably from the terminal. So I wrote this AppleScripts (adapted from the code shared on this SOF thread).

Part of me wanted to learn about AppleScripts properly but it’s unlikely it’s much use so I decided that getting the script do what I want is good enough.

Slightly different from the SOF suggested instead of creating a one-line bash script, I added it as a custom alias into the .zshrc file. So I can just call sticky from the terminal.

In the midst of it I also try doing it with Bashscript, but I looked like the furthest I could get was to open an application (Stickies) but cannot put text in it from the terminal.

Learnings: more about bashscript, building something with unfamiliar languages, good enough is good enough - there are better things to do

The script

Ongoing list: last update March 2024.

See you next time 👋
Julia