Code Snippets
A curated collection of useful code snippets, examples, and ready-to-use solutions for various programming languages, frameworks, and common development scenarios. Copy, paste, and adapt for your projects.
AWS EC2 Instance Management with Boto3: Start, Stop, and Query Instances
- Mohammad Abu Mattar
- Cloud
- Aws
- Devops
- Automation
- Published: 14 Apr, 2026
If you've ever spent 20 minutes clicking through the AWS Console just to stop a handful of dev instances, you already know the pain. It's tedious, it doesn't scale, and one wrong click can ruin your a
Redis Caching Patterns: Cache-Aside, Write-Through & Cache Invalidation
- Mohammad Abu Mattar
- Backend
- Performance
- Published: 07 Apr, 2026
Need to scale your backend without throwing money at servers? Redis caching patterns are your answer. Most databases can handle hundreds of queries per second, but thousands? Your app slows to a
PostgreSQL Query Optimization: Indexes, EXPLAIN ANALYZE & Execution Plans
- Mohammad Abu Mattar
- Database
- Performance
- Published: 29 Mar, 2026
Need to optimize slow PostgreSQL queries? Here's how with EXPLAIN ANALYZE and strategic indexing. Slow database queries kill application performance. But most developers don't know where the actu
Multi-Environment Secret Management with HashiCorp Vault
- Mohammad Abu Mattar
- Security
- Devops
- Published: 03 Mar, 2026
Need to manage secrets safely across multiple environments? Here's how with HashiCorp Vault. Storing secrets in .env files, hardcoding them, or even using separate secret managers per environme
Top 7 Open Source OCR Models for Document Processing
- Mohammad Abu Mattar
- Ai ml
- Computer vision
- Document processing
- Published: 09 Jan, 2026
AI Tool Turn your documents into perfect digital copies with these powerful open source OCR models. No more dealing with messy text extraction get clean, accurate markdown from PDFs, images, and
Why printf Beats echo in Linux Scripts
- Mohammad Abu Mattar
- Shell scripting
- Devops
- Linux
- Published: 02 Jan, 2026
Scripting Tip You know that feeling when a script works perfectly on your machine but fails miserably somewhere else? That's probably because you're using echo for output. Let me show you why pri
Essential Bash Variables for Every Script
- Mohammad Abu Mattar
- Shell scripting
- Devops
- Published: 26 Dec, 2025
Overview Quick Tip You know what's worse than writing scripts? Writing scripts that break every time you move them to a different machine. Let's fix that with some built-in Bash variables tha
Per-App Shell History for Bash
- Mohammad Abu Mattar
- Shell scripting
- Productivity
- Published: 18 Dec, 2025
Terminal Chaos? Organize Your Bash History! Ever jumped between iTerm2, Ghostty, and VS Code's terminal only to have your command history get all mixed up? This Bash snippet keeps things clean by