Refactoring Legacy Code: Lessons Learned

I recently spent a weekend refactoring an old Python script I wrote three years ago. Looking back at your old code is a humbling experience. It works, but it's often ugly. ### The Spaghetti Mess The script was a single 800-line file with global variables everywhere and no...

Deploying Flask Applications with Docker and Nginx

"It works on my machine" is the developer's famous last words. To ensure my applications run consistently everywhere, I've fully embraced Docker. ### Containerization I wrap my Flask application in a Docker container. My `Dockerfile` starts with a lightweight Python image...

Self-Hosting Analytics: Why Privacy Matters

Most websites default to Google Analytics. It's free and easy, but the privacy trade-off is significant. You are essentially feeding your user's data into a massive ad-targeting machine. For this website, I decided to build my own analytics engine. ### What I Track I wanted...

Integrating Tetris into a Flask App: A Fun Experiment

I decided to add a bit of fun to my personal portfolio by embedding a fully playable Tetris game. While there are plenty of JS libraries for this, I wanted to build the integration myself to understand how to handle game state and persistence. ### The Stack * **Frontend:**...

My Journey into Hardware Modding: Raspberry Pi Projects

Software is great, but there's something satisfying about holding your project in your hand. I've been spending more time recently with Raspberry Pi hardware modifications ("mods"). ### The Pi-Hole Network Blocker My first "essential" project was a Pi-Hole. It acts as a DNS...

Optimizing SQL Queries in SQLAlchemy

When building web apps with Flask and SQLAlchemy, it's easy to fall into the trap of the "N+1 Problem". This happens when your code executes N additional database queries to fetch data for a list of N items, rather than fetching everything in a single query. ### The Problem...

Understanding Large Language Models: A Developer's Crash Course

Unless you've been living under a rock, you've heard of ChatGPT and LLMs (Large Language Models). As a developer, it's crucial to understand not just how to *use* them, but how they function at a high level. ### The Transformer Architecture At the heart of modern LLMs is the...

Introduction to Computer Vision with OpenCV and Python

Artificial Intelligence isn't just about text generation; Computer Vision (CV) is a fascinating field that allows computers to "see" and interpret the world. I've been experimenting with `OpenCV`, the industry-standard library for CV applications. ### What is OpenCV? OpenCV...

Building a Custom Discord Bot: From Idea to Deployment

Discord has become the de-facto communication platform for communities, and one of its best features is the API. Building a bot can automate moderation, provide fun utilities, or integrate external services. I recently built a bot for my private server, and the process was...

Why Flask is My Go-To Framework for Micro-Projects

When starting a new web project, the debate often lands on "Django vs. Flask". While Django is a "batteries-included" powerhouse perfect for large enterprise applications, I find myself reaching for Flask time and time again for my personal projects. Here is why. ###...

Automating My Home Office with Raspberry Pi and Python

In the world of smart homes, off-the-shelf solutions like Alexa or Google Home are great, but they often lack the granular control that a developer craves. Recently, I decided to take matters into my own hands and automate my home office using a Raspberry Pi 4 and Python. ###...