A collection of Python utilities, text formatting tools, and common code snippets for learning and reference.
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:
plato_text_formatter.py- Main formatter classhow_to_use.md- Usage examples
Image and file processing utilities.
Files:
-
- Decode base64 to PIL Image
- Handle EXIF image rotation
- Encode images/arrays to base64
- Resize and crop images
- Save images to temporary files
-
- Convert binary/dictionary to bytes
- Encode URLs or files to base64
- Validate URLs
- MIME type detection
-
- AES encryption/decryption with CBC mode
- Key generation from passwords
- Automatic padding handling
- Originated from Gradio
Reusable code snippets organized by difficulty level.
iindex-for-loop.py- Access list indices with enumerationgenerate-captcha.py- Generate CAPTCHA imagesshuffle-a-deck.py- Shuffle and draw card deckprime.number.py- Check if number is primecountdown-time.py- Display countdown timer
chcek_palindrome.py- Check if string is palindromewhile-loop.py- While loop examplesfizz-buzz.py- FizzBuzz problem solutionlist.py- List operations and methodsboolean-logic.py- Boolean condition examplesTranspose-a-Matrix.py- Matrix transposition methodsChaining-Multiple-Conditions.py- Complex boolean logicreq.py- Socket-based HTTP requestsget-request-loop.py- HTTP GET requests with redirects
extract-file-extension.py- Extract file extensionsmerge-mails.py- Merge mail templates with namesfind-hash.py- Calculate SHA-1 file hash