Skip to content

Instantly share code, notes, and snippets.

View decbr1's full-sized avatar

Dec decbr1

View GitHub Profile
@decbr1
decbr1 / InputValidator.py
Created February 24, 2026 15:55
input validation class with a flexible 'add_rules(condition, msg)`
class InputValidator:
def __init__(self, prompt, cast=str, error_msg="Invalid input."):
self.prompt = prompt
self.cast = cast
self.error_msg = error_msg
self.rules = []
def add_rule(self, condition, message=None):
self.rules.append((condition, message or self.error_msg))
return self # allows method chaining
@decbr1
decbr1 / fileindexer.sh
Created January 5, 2026 00:57
File Indexing Script
#!/bin/bash
declare -a NEW_ORDER=(
"item 1"
"item 2"
"item 3"
"cont."
)
i=1