Blog Posts
Thoughts, tutorials, and insights on software engineering
Inferential vs Descriptive Statistics
Understanding the two primary branches of statistics. Learn how descriptive statistics summarizes data with measures of central tendency and dispersion, while inferential statistics generalizes from samples to populations using probability and hypothesis testing.
import numpy as np
data = [23, 45, 12, 67, 34, 89, 21]
mean = np.mean(data) # 41.57
std = np.std(data) # 25.24 Classic Algorithms Explained
An exploration of essential algorithms including Karatsuba multiplication, binary search, sorting algorithms, and graph traversal—with practical Python implementations and complexity analysis.
def binary_search(arr, target):
left, right = 0, len(arr) - 1
while left <= right:
mid = (left + right) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
left = mid + 1
else:
right = mid - 1
return -1 Artificial Vision and Computer Vision: From Pixels to Understanding
An introduction to computer vision and image processing. From spatial domain operations to frequency transforms, with practical Python examples using OpenCV.
import cv2 import numpy as np
# Read an image image = cv2.imread('photo.jpg')
# Rotate the image 45 degrees height, width = image.shape[:2] center = (width // 2, height // 2) rotation_matrix = cv2.getRotationMatrix2D(center, 45, 1.0) rotated = cv2.warpAffine(image, rotation_matrix, (width, height))
# Apply histogram equalization to grayscale gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) equalized = cv2.equalizeHist(gray)
# Apply a Gaussian blur (spatial filter) blurred = cv2.GaussianBlur(image, (5, 5), 0)
cv2.imshow('Original', image) cv2.imshow('Rotated', rotated) cv2.imshow('Equalized', equalized) cv2.imshow('Blurred', blurred) cv2.waitKey(0) cv2.destroyAllWindows() Dynamic Programming
Learn how dynamic programming works, when to use it, and how to model solutions using top-down memoization and bottom-up tabulation.
def fib(n):
dp = [0, 1]
for i in range(2, n + 1):
dp.append(dp[i - 1] + dp[i - 2])
return dp[n] Economía Básica
Conceptos fundamentales de economía: transacciones, oferta y demanda, crédito, ciclos económicos, y más. Una guía práctica para entender cómo funciona la economía.
def calculate_roi(investment: float, returns: float) -> float:
return (returns - investment) / investment * 100 Indicadores Económicos
Los indicadores económicos más importantes: PIB, inflación, desempleo, balanza comercial y más. Qué miden, cómo se calculan y por qué importan.
PIB = C + I + G + (X - M) Building a Production-Ready Remote MCP Server
Lessons from building a remote MCP server in Python. Challenges with stateful sessions, input validation, scoped tool access, and OAuth 2.1 authorization in horizontally scaled production environments.
from http_mcp import Server
from http_mcp.types import Tool
tool = Tool(
inputs=MyInput,
output=MyOutput,
func=my_handler,
scopes=("mcp:read",),
) SOLID Python
The five SOLID design principles applied to Python. Practical examples of SRP, OCP, LSP, ISP, and DIP to write cleaner, more maintainable code.
from abc import ABC, abstractmethod
class Animal(ABC):
@abstractmethod
def make_sound(self) -> str:
pass Most Useful Git Commands
A practical reference for the git commands I use the most. From stash tricks and interactive rebase to worktrees, bisect, and recovery with reflog.
git log --oneline --graph --all
git stash
git rebase -i HEAD~3
git bisect start WSGI vs ASGI Protocols
Comprehensive guide comparing WSGI and ASGI protocols in Python web development. Learn key differences, implementation examples, and when to use each protocol for optimal web application performance.
def app(environ, start_response):
start_response("200 OK", [("Content-Type", "text/plain")])
return [b"Hello, World!"] Concurrency and Multithreading
Understanding concurrency, parallelism, and multithreading. How threads share memory, why concurrency matters for performance, and practical patterns with async Python.
async def fetch(url: str) -> str:
async with(
aiohttp.ClientSession() as session,
session.get(url) as response
):
return await response.text() Functional Programming
A practical introduction to functional programming in Python: pure functions, immutability, composition, and common patterns.
from functools import reduce
numbers = [1, 2, 3, 4]
result = reduce(lambda acc, x: acc + x * 2, numbers, 0) Python Great Features
Exploring duck typing, Abstract Base Classes, Protocols, and caching decorators. The features that make Python flexible and expressive beyond the basics.
def stateful_function(func):
cache = {}
def wrapper_function(*args, **kwargs):
key = str(args) + str(kwargs)
if key not in cache:
cache[key] = func(*args, **kwargs)
return cache[key]
return wrapper_function
@stateful_function
def fibonacci(n):
if n < 2:
return n
return fibonacci(n - 1) + fibonacci(n - 2) Python Virtual Environments
How to isolate project dependencies with virtual environments. Creating, activating, freezing requirements, and packaging Python projects with Docker.
FROM python:3.7
WORKDIR /app
COPY requirements.txt /app
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY /app /app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"] Terminal Basics
A beginner-friendly guide to the command line. What shells, terminals, and commands are, plus essential operations for navigating and managing files.
mkdir dir_name
cd dir_name
touch file_name
echo 'foo' > file_name
ls
cat file_name
rm file_name Python Basics
Python is a great language for beginners and experts alike. Let's explore the basics of Python. From modules, packages, scope, and more. Let's dive in!
def outer():
x = "local"
def inner():
nonlocal x
x = "nonlocal"
inner()
if __name__ == "__main__":
outer()