Skip to content

A collection of Python utilities, text formatting tools, and common code snippets for learning and reference.

Notifications You must be signed in to change notification settings

ehsanghaffar/python-playground

Repository files navigation

Python Playground

A collection of Python utilities, text formatting tools, and common code snippets for learning and reference.

📁 Project Structure

text-formater/plato-text-formatter/

Plato Text Formatter module for handling message formatting with Plato app constraints.

Features:

  • UTF-16 style emoji character counting (emojis count as 2 characters)
  • Max character limit: 255
  • Max lines limit: 3
  • Two formatting modes: strict (validates) and soft (trims)
  • Preview functionality

Files:


proccessing-utils/

Image and file processing utilities.

Files:

  • image_pre-proccessing.py

    • Decode base64 to PIL Image
    • Handle EXIF image rotation
    • Encode images/arrays to base64
    • Resize and crop images
    • Save images to temporary files
  • general.py

    • Convert binary/dictionary to bytes
    • Encode URLs or files to base64
    • Validate URLs
    • MIME type detection
  • encryptor.py

    • AES encryption/decryption with CBC mode
    • Key generation from passwords
    • Automatic padding handling
    • Originated from Gradio

common-snippets/

Reusable code snippets organized by difficulty level.

Part 1 - Basics

Part 2 - Intermediate

Part 3 - Advanced


About

A collection of Python utilities, text formatting tools, and common code snippets for learning and reference.

Topics

Resources

Stars

Watchers

Forks

Languages