Blog Posts
Thoughts, tutorials, and insights on software engineering
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:
async with session.get(url) as response:
return await response.text() 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()