TIL: Python Collections, Git Commands, Juju, and EC2

Python Programming Collections Module - defaultdict collections.defaultdict takes a type not a value It will initialize based on the default value for that type Common mistake: passing a value instead of a callable type Example: defaultdict(list) not defaultdict([]) Cleaner than manually checking if keys exist before accessing Version Control Git Commands and Tricks git log --format="%H" -n 1 | cat outputs the last commit ID Useful for scripting and automation The cat ensures the output is properly formatted %H format specifier gives the full commit hash -n 1 limits to the most recent commit Cloud Infrastructure and DevOps AWS EC2 Free Tier EC2 has a Free tier! I can request a bunch of machines here Great for learning and experimenting with cloud infrastructure Limited resources but sufficient for development and testing Good entry point for understanding cloud computing concepts Juju - Multi-Cloud Orchestration Juju is a tool that helps manage server providers, whether they are GCP, AWS, your own servers or Azure, among others Gives you one way to start, setup and run your servers across different cloud providers Abstracts away cloud provider differences Enables consistent deployment across hybrid and multi-cloud environments Juju Configuration System Juju’s configurations are called charms These are written in Python Charms define how services should be deployed and configured Reusable deployment patterns for common software stacks Community-maintained charm store with pre-built configurations

August 1, 2020 · 2 min

TIL: Programming Challenges, System Tools, and Learning Resources

Today I learned about Advent of Code programming challenges, GPU hash tables, Python gotchas, Rust concurrent data structures, and various development tools and learning resources.

July 27, 2020 · 15 min

TIL: Python Collections Optimization and Linux Display Management

Today I learned about Python collections.defaultdict performance benefits, the sorted function's reverse parameter, and using arandr as a frontend for xrandr in tiling window managers.

July 26, 2020 · 14 min

TIL: Dash Memoization, Flask-Dash Integration, and Testing

TIL 2020-07-23 Memoizing Dash Callback Responses with Flask-Caching - It’s possible to cache dash callback responses for better performance using flask-caching. Configurable Dash Registration - Always ensure that dash registration in a Flask-Dash app is configurable. You might want to skip loading dash when testing backend-only functionality. pytest-dash Status - pytest-dash has been abandoned since the official dash repository now supports Selenium testing via pytest directly.

July 23, 2020 · 1 min

TIL: Dash Testing, Docker Compose, and Python Mocking

Web Development and Testing Dash Framework Testing It is possible to memoize dash callback responses with flask-caching Dash supports response caching to improve performance Flask-caching integration allows for sophisticated caching strategies Important for optimizing callback-heavy Dash applications Flask-Dash Integration Best Practices Always ensure that dash registration in a Flask-Dash app is configurable Might want to not load dash when testing backend only Separation of concerns between backend API and frontend visualization Enables more targeted testing strategies Testing and Mocking Python Mock Module Best Practices When mocking python functions in a flask test, ensure you reference the module where the function is called, not where it originates from Common pitfall: mocking at the wrong import level Mock at the point of use, not the point of definition Critical for effective unit testing in complex applications Infrastructure and Networking Docker Compose Development Insights docker-compose has no docstrings Interesting observation about code documentation practices Even popular tools can have documentation gaps Reminder of the importance of good code documentation DNS and Network Tools Pi-hole Architecture pihole’s Faster than light engine is a fork of dnsmasq Built on proven DNS server technology Optimized for ad-blocking and DNS filtering Demonstrates how open source projects build on each other Command Line Tools argparse does support sub-commands Python’s built-in argument parsing library is more capable than often realized Enables building complex CLI interfaces with nested commands Alternative to third-party libraries like Click for simpler use cases

July 23, 2020 · 2 min

TIL: Python Code Quality and Development Tools Deep Dive

Today I learned about advanced Python code quality tools, CPython internals resources, and modern development practices from my archive of learning notes.

July 18, 2020 · 6 min

TIL: Real World Cryptography, Programming Languages, and JPEG Decoding

Cryptography and Security Real World Cryptography Book Book on Real World Cryptography Practical approach to understanding cryptographic concepts Focuses on real-world applications rather than pure theory Manning Publications interactive book format VPN Solutions Pritunl - Simple OpenVPN Implementation pritunl is a simple home OpenVPN implementation Web-based OpenVPN server management Simplified setup and configuration for home users Alternative to complex commercial VPN solutions Computer Science Education Brown University Programming Course Brown University: Programming and Programming Languages Comprehensive course on programming language theory and implementation Covers language design, semantics, and implementation techniques Free online course materials available Technical Deep Dives JPEG Decoder Implementation Understanding and writing a JPEG decoder in Python Step-by-step guide to implementing JPEG decoding Explains the JPEG compression algorithm and file format Practical Python implementation with detailed explanations Great for understanding image compression fundamentals

July 16, 2020 · 1 min

TIL: Flask Advanced Patterns and Development Tools

Today I learned about advanced Flask patterns including Method Views, Signals, profiling techniques, and security extensions that enhance Flask application development.

July 15, 2020 · 7 min

TIL: Barry Warsaw Zen of Python Song and Flit

Python Community and Culture Barry Warsaw’s Zen of Python Song Barry Warsaw adapted the Zen of Python into a Song! Creative interpretation of Tim Peters’ famous “Zen of Python” principles Demonstrates the playful and creative side of the Python community Barry Warsaw is a core Python developer and former release manager Python Packaging Tools Flit - Simple Python Package Publishing Flit for Python Lightweight alternative to setuptools for simple Python packages Focuses on pure Python packages without complex build requirements Simplifies the package creation and publishing process Uses pyproject.toml for configuration Created for packages that don’t need complex build steps or C extensions

July 14, 2020 · 1 min

TIL: Barry Warsaw, Flit, Gumshoe, Poetry, and More

TIL 2020-07-14 Barry Warsaw adapted the Zen of Python into a Song! - A delightful musical interpretation of Python’s guiding principles. Flit for Python - A simple way to put Python packages and modules on PyPI. Gumshoe is a great scrolling effect for sidebars etc in vanilla JS - A vanilla JavaScript scrollspy script. Poetry for Python Projects - Manage environments for Python, as well as project dependency information. Profiling Flask Apps using werkzeug.contrib.profiler.ProfilerMiddleware - A gist showing how to profile Flask applications. ...

July 14, 2020 · 1 min