Redowan's Reflections
Hi, I’m Redowan.
A roving amateur fumbling through software, systems, and sundry.
Recent writing
Optimize Django model saves with update_fields parameter to generate leaner SQL queries and improve performance in tight update loops.
Configure Python logging for AWS Lambda's pre-configured handlers while maintaining compatibility with local development environments.
Learn from a production outage caused by loading large CSV files into memory. Stream process files to prevent OOM errors and crashes.
Automate commit message validation with GitHub Actions. Enforce refs and closes patterns to maintain clean Git history and link commits to issues.
Master shell quoting rules: single vs double quotes, backticks vs $(). Learn when to quote variables to prevent spaces and special characters from breaking commands.
Understand how return values work in Bash functions. Learn exit codes, status evaluation patterns, and proper boolean returns with true/false commands.
Secure webhooks by verifying payload authenticity using HMAC hash signatures with shared secrets, preventing man-in-the-middle attacks.
Practical SQLite recipes for Python: execute statements, batch operations, transactions, row factories, and context managers with sqlite3.
Use Python's urlsplit instead of urlparse for faster URL parsing by skipping the rarely-needed params component in URL decomposition.
Emulate Python's random.choice in SQLite using JSON arrays and the random() function. Populate tables with realistic test data efficiently.
Master Python's ExitStack for managing multiple context managers, conditional callbacks, request rollbacks, and avoiding nested with statements.
Combine session and function-scoped pytest fixtures to avoid expensive test setup while maintaining test isolation and preventing state coupling.
Master Python mocking: patch objects at their import location, not where they're defined, to avoid common unittest.mock pitfalls.
Assert specific mock call arguments while ignoring others using unittest.mock.ANY for flexible test assertions without brittle checks.
Fix divergent branch errors with git pull --rebase. Learn when to rebase local commits on top of remote changes for cleaner Git history.