Tag: python
-
AsyncIO Task Management: A Hands-On Scheduler Project
We discussed Awaitables last week. The article covered coroutines, tasks and futures as well as a quick introduction to the event loop. Let’s build an example task management project to continue our journey on learning asynchronous programming with AsyncIO. Here’s a recap of relevant articles on AsyncIO so far: How to write an AsyncIO Telegram…
-
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…
-
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…
-
How to parse computer code, Advent of Code 2024 day 3
Having tackled some of the later Advent of Code challenges, I wanted to revisit Day 3, which presented an interesting parsing problem. The task involved extracting valid code from a noisy input, a great exercise in parser and lexer development. Join me as I explore my approach to this challenge. When I first wrote about…