Skip to content

Instantly share code, notes, and snippets.

View 1914Jegx's full-sized avatar

Jegx 1914Jegx

View GitHub Profile
@1914Jegx
1914Jegx / .gitignore
Created September 30, 2025 10:56
In-memory rate limiting middleware for FastAPI, Flask, and Express
fastapi_app/.venv/
flask_app/.venv/
express_app/node_modules/
__pycache__/
@1914Jegx
1914Jegx / README.md
Created September 30, 2025 10:49
Secret scanning script for files and git diffs

Secret Scanning Script

Lightweight Python script to scan files, directories, or git diffs for potential secrets before they hit your repository. Built-in detectors catch AWS keys, generic tokens, PEM blocks, and high-entropy strings, with support for custom allowlists and rule tuning.

Features

  • Recursive scanning of directories and single files.
  • Git diff mode (--git-diff) for pre-commit / pre-push hooks.
  • AWS access/secret keys, private keys, generic tokens, and JWTs out of the box.
  • Shannon entropy detector for suspicious high-entropy strings.
@1914Jegx
1914Jegx / README.md
Created September 30, 2025 10:39
Sensitive data masking helper with CLI

Sensitive Data Masking Helper

Utility functions and CLI for redacting secrets from logs or text blobs before they leave your machine. Includes batteries-included patterns for common credentials and allows custom regex additions.

Features

  • Masks AWS keys, bearer tokens, email/password pairs, JSON secrets, credit card numbers, and more.
  • Configurable replacement string and partial masking (keep prefix/suffix characters).
  • Python API (mask_text, mask_dict, Masker) for integrating into apps or middleware.
  • CLI command (mask-secrets) that reads from stdin or files and writes sanitized output.
@1914Jegx
1914Jegx / .gitignore
Created September 30, 2025 10:32
Request/response logging middleware for FastAPI and Express
fastapi_app/.venv/
__pycache__/
fastapi_app/.pytest_cache/
express_app/node_modules/
@1914Jegx
1914Jegx / .gitignore
Created September 30, 2025 10:22
Production-ready Python logger with Rich console and JSON outputs
__pycache__/
*.pyc
.venv/
*.log
@1914Jegx
1914Jegx / README.md
Created September 30, 2025 10:00
GitHub Actions workflow for Python linting, typing, and tests

GitHub Actions Python CI

Drop this workflow into your repository to run linting, type checks, and tests on every push or pull request. It is tuned to pair with the pyproject.toml baseline so Black, Ruff, MyPy, and Pytest all run automatically across multiple Python versions.

Workflow Highlights

  • Triggers on pushes, pull requests, manual runs, and a weekly schedule.
  • Two-stage pipeline: quality gates (Ruff, Black, MyPy) followed by a test matrix.
  • Matrix testing across Python 3.11 and 3.12 with pip caching for speed.
  • Adaptive dependency install that supports projects using pyproject.toml, requirements-dev.txt, or requirements.txt.
@1914Jegx
1914Jegx / .editorconfig
Created September 30, 2025 09:52
pyproject.toml baseline with Black, Ruff, and MyPy
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
@1914Jegx
1914Jegx / .dockerignore
Last active September 30, 2025 09:43
FastAPI + Postgres + Redis docker-compose starter
__pycache__/
*.py[cod]
*.sqlite3
.env