Archive
-
Understanding Awaitables: Coroutines, Tasks, and Futures in Python
Previously, we explored chatbot building with AsyncIO. As I am committing to publish one article a week, I am constantly on the lookout for new ideas. Then I figured it may be a good opportunity to delve deeper into asynchronous programming. The writing plan eventually expanded to a series of articles, and we are starting…
-
A Love Story in Code: Building My Self-Hosted Photo Album
I am almost one year into my current relationship. It is hard to believe how fast time flies, until I look into our photo archive. Being an enthusiastic photographer, my partner captured moments of us together. However, the increasing stack of photos is accelerating the imminent explosion of my cloud storage. That’s when I started…
-
The Versatility of __call__: A Python Developer’s Secret Weapon
Refactoring with __call__: From Personal Code to FastAPI Consider the following fictional example, Suppose we have both arg_b and arg_c defined, but we do not know about arg_a. If both arg_b and arg_c do not affect the behaviour of later computations, it would be nice to not having to keep passing the values around. Fortunately, Python…
-
How to write an AsyncIO Telegram bot in Python
Last week, we discussed a quick weekend project on building a word game. That project was sparked by a conversation suggesting I integrate LLM functionality into my experimental chatbot, BigMeow. Currently, I’m working on another chatbot project, and I’m reusing some code from BigMeow. Back then, I struggled a lot, especially with the lack of…
-
I built a word guessing game with LLM
After a period of regrouping, I resumed my quest for a new job or project. While sourcing ideas from discussion groups and friends, a message from my mentor resonated with me. “OK, hear me out. Add some LLM features to BigMeow.”, he said. “Then you can say you did. Add those in, and then use…
-
Hair dryers have standards, why not software? A call for Rights by Design.
We can plug and use electrical appliances without fear, thanks to the existence of SIRIM certification. We can go grab food from friendly neighbourhood restaurants, without having to carry a test kit to check for food safety. But what about software? There are groups and organizations keeping hair dryers and teh tarik safe to consume,…
-
Beyond the Code: A Lunar New Year Reflection on Career, Recovery, and New Beginnings
The lunar new year celebration just concluded yesterday. My family and I went to the temple to offer our hopes and prayers for a good and happy year ahead. Just out of curiosity, we also went to draw a fortune stick. The text accompanying our fortune stick resonated with a saying: “After winter comes spring”,…
-
Applying Cramer’s Rule for Advent of Code 2024, day 13
Day 13 is relatively easy, especially if you’re comfortable with math. I originally started with a purely brute-force approach, but it quickly became clear that it would be inefficient as the difficulty increased. When I attempted the puzzle, I was already a few days behind. After a hint from a friend who was keeping up…
-
Finally, an application for my FSM library! Advent of Code 2024 day 11
We’ve finally completed 10 puzzles, surpassing my previous record (though I still have days 24 and 25 to tackle, and I’ll likely need to revisit day 12 for part two). Coincidentally, I was able to adapt my FSM library to solve day 11. While it’s not the most efficient solution, I’m eager to share it.…
-
Climbing a depth-first search hill, Advent of Code 2024, day 10
Today, we’re diving into the Day 10 puzzle. Like Day 6, it’s a 2D grid, but this time, we need to consider multiple paths. It’s fascinating to see how depth-first search comes into play here. Each point on the map is represented by a single-digit integer indicating its height, ranging from 0 to 9, with…