Smart Scripts & Automations to Simplify Work
Over time, I’ve built a growing collection of small but powerful automation tools — scripts that streamline repetitive tasks, boost productivity, and solve everyday problems for developers, freelancers, and businesses. Many are open-source and designed to be easily adapted. If any of these tools speak to a challenge you face, feel free to explore the code, use them, or even contribute!
Auto-organize Your Downloads Folder
Automatically move files into folders based on file type.
import os
import shutil
from pathlib import Path
import time
DOWNLOAD_PATH = str(Path.home() / "Downloads")
FILE_TYPES = {
"Images": [".jpg", ".jpeg", ".png", ".gif", ".svg"],
"Videos": [".mp4", ".mov", ".avi", ".mkv"],
"Documents": [".pdf", ".docx", ".txt", ".xlsx", ".pptx"],
"Archives": [".zip", ".rar", ".7z", ".tar"],
"Music": [".mp3", ".wav", ".aac"],
"Code": [".py", ".js", ".html", ".css", ".ts"]
}
def organize_files():
for filename in os.listdir(DOWNLOAD_PATH):
file_path = os.path.join(DOWNLOAD_PATH, filename)
if os.path.isfile(file_path):
file_ext = os.path.splitext(filename)[1].lower()
moved = False
for folder, extensions in FILE_TYPES.items():
if file_ext in extensions:
target_folder = os.path.join(DOWNLOAD_PATH, folder)
os.makedirs(target_folder, exist_ok=True)
shutil.move(file_path, os.path.join(target_folder, filename))
print(f"Moved {filename} to {folder}")
moved = True
break
if not moved:
print(f"Skipped {filename} (not matching category)")
if __name__ == "__main__":
INTERVAL_MINUTES = 5
print(f"Running file organizer every {INTERVAL_MINUTES} minutes...
")
while True:
organize_files()
print("Waiting...
")
time.sleep(INTERVAL_MINUTES * 6
Send Personalized Cold Emails
Upload a CSV and send emails in bulk using templates.
import csv
import smtplib
from email.message import EmailMessage
from string import Template
from pathlib import Path
EMAIL_ADDRESS = "oussamachahidi20@gmail.com"
EMAIL_PASSWORD = "vfyk ojkj dsiu wgfu"
SMTP_SERVER = "smtp.gmail.com"
SMTP_PORT = 587
template_path = Path("template.txt")
template = Template(template_path.read_text())
with open("clients.csv", newline='', encoding="utf-8") as csvfile:
reader = csv.DictReader(csvfile)
clients = list(reader)
with smtplib.SMTP(SMTP_SERVER, SMTP_PORT) as smtp:
smtp.starttls()
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
for client in clients:
msg = EmailMessage()
content = template.substitute(client)
lines = content.strip().split("
", 1)
subject = lines[0].replace("Subject:", "").strip()
body = lines[1].strip()
msg["Subject"] = subject
msg["From"] = EMAIL_ADDRESS
msg["To"] = client["email"]
msg.set_content(body)
try:
smtp.send_message(msg)
print(f"✅ Sent to {client['name']} ({client['email']})")
except Exception as e:
print(f"❌ Failed to send to {client['email']}: {e}")