Podcast Downloader & Organizer

import tkinter as tk

from tkinter import filedialog, messagebox, Listbox, Scrollbar

import feedparser

import requests

import os


def fetch_episodes():

    url = url_entry.get()

    if not url:

        messagebox.showerror("Error", "Please enter a podcast RSS feed URL.")

        return

    

    global feed

    feed = feedparser.parse(url)

    episodes_list.delete(0, tk.END)


    if not feed.entries:

        messagebox.showerror("Error", "No episodes found or invalid RSS URL.")

        return


    for i, entry in enumerate(feed.entries[:20]):

        title = entry.title

        episodes_list.insert(tk.END, f"{i+1}. {title}")


def download_selected():

    selected = episodes_list.curselection()

    if not selected:

        messagebox.showerror("Error", "Please select an episode to download.")

        return


    entry = feed.entries[selected[0]]

    title = feed.feed.title

    episode_title = entry.title

    audio_url = entry.enclosures[0].href if entry.enclosures else None


    if not audio_url:

        messagebox.showerror("Error", "No audio found in this episode.")

        return


    folder = os.path.join("Podcasts", title)

    os.makedirs(folder, exist_ok=True)

    filename = os.path.join(folder, f"{episode_title}.mp3")


    try:

        r = requests.get(audio_url, stream=True)

        with open(filename, 'wb') as f:

            for chunk in r.iter_content(1024):

                f.write(chunk)

        messagebox.showinfo("Success", f"Downloaded: {episode_title}")

    except Exception as e:

        messagebox.showerror("Download Failed", str(e))


# GUI setup

app = tk.Tk()

app.title("๐ŸŽ™๏ธ Podcast Downloader & Organizer")

app.geometry("500x400")


tk.Label(app, text="Enter Podcast RSS Feed URL:").pack(pady=5)

url_entry = tk.Entry(app, width=60)

url_entry.pack(pady=5)


tk.Button(app, text="Fetch Episodes", command=fetch_episodes).pack(pady=5)


frame = tk.Frame(app)

frame.pack(pady=10, fill=tk.BOTH, expand=True)


scrollbar = Scrollbar(frame)

scrollbar.pack(side=tk.RIGHT, fill=tk.Y)


episodes_list = Listbox(frame, yscrollcommand=scrollbar.set, width=80)

episodes_list.pack(padx=10, pady=10, expand=True)

scrollbar.config(command=episodes_list.yview)


tk.Button(app, text="Download Selected Episode", command=download_selected, bg="#4CAF50", fg="white").pack(pady=10)


app.mainloop()


Invoice Data Extractor

import tkinter as tk

from tkinter import filedialog, messagebox

from PIL import Image

import pytesseract

from pdf2image import convert_from_path

import re

import os


# Optional: Set Tesseract path

# pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'


def extract_text_from_file(file_path):

    if file_path.lower().endswith('.pdf'):

        images = convert_from_path(file_path, dpi=300)

        text = ""

        for image in images:

            text += pytesseract.image_to_string(image)

        return text

    elif file_path.lower().endswith(('.png', '.jpg', '.jpeg')):

        image = Image.open(file_path)

        return pytesseract.image_to_string(image)

    else:

        return ""


def extract_invoice_data(text):

    invoice_number = re.search(r'Invoice\s*#?:?\s*(\w+)', text, re.IGNORECASE)

    date = re.search(r'Date\s*:?(\s*\d{1,2}/\d{1,2}/\d{2,4})', text, re.IGNORECASE)

    total = re.search(r'Total\s*:?[\s$]*(\d+[\.,]?\d*)', text, re.IGNORECASE)


    return {

        "Invoice Number": invoice_number.group(1) if invoice_number else "Not Found",

        "Date": date.group(1).strip() if date else "Not Found",

        "Total Amount": total.group(1) if total else "Not Found"

    }


def process_invoice():

    file_path = filedialog.askopenfilename(title="Select Invoice", filetypes=[("PDF/Image Files", "*.pdf *.jpg *.png *.jpeg")])

    if not file_path:

        return


    text = extract_text_from_file(file_path)

    data = extract_invoice_data(text)


    result = f"""

    ๐Ÿ“„ File: {os.path.basename(file_path)}

    ๐Ÿงพ Invoice Number: {data['Invoice Number']}

    ๐Ÿ“… Date: {data['Date']}

    ๐Ÿ’ฐ Total: {data['Total Amount']}

    """

    messagebox.showinfo("Extracted Invoice Data", result)


# GUI Setup

app = tk.Tk()

app.title("๐Ÿงพ Invoice Data Extractor")

app.geometry("400x200")

app.configure(bg="#f9f9f9")


label = tk.Label(app, text="Click below to select an invoice PDF or image", bg="#f9f9f9", font=("Helvetica", 12))

label.pack(pady=20)


btn = tk.Button(app, text="Select Invoice", command=process_invoice, bg="#4CAF50", fg="white", font=("Helvetica", 12), padx=10, pady=5)

btn.pack()


app.mainloop()


File Locker CLI

import argparse

import getpass

import os

from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC

from cryptography.hazmat.backends import default_backend

from cryptography.hazmat.primitives import hashes

from cryptography.fernet import Fernet

import base64


def derive_key(password: str, salt: bytes) -> bytes:

    kdf = PBKDF2HMAC(

        algorithm=hashes.SHA256(),

        length=32,

        salt=salt,

        iterations=390000,

        backend=default_backend()

    )

    return base64.urlsafe_b64encode(kdf.derive(password.encode()))


def encrypt_file(filepath, password):

    with open(filepath, 'rb') as file:

        data = file.read()


    salt = os.urandom(16)

    key = derive_key(password, salt)

    fernet = Fernet(key)

    encrypted_data = fernet.encrypt(data)


    with open(filepath + ".locked", 'wb') as file:

        file.write(salt + encrypted_data)


    os.remove(filepath)

    print(f"๐Ÿ”’ File encrypted as {filepath}.locked")


def decrypt_file(filepath, password):

    with open(filepath, 'rb') as file:

        content = file.read()


    salt = content[:16]

    encrypted_data = content[16:]

    key = derive_key(password, salt)

    fernet = Fernet(key)


    try:

        decrypted_data = fernet.decrypt(encrypted_data)

    except Exception:

        print("โŒ Wrong password or corrupted file.")

        return


    original_path = filepath.replace(".locked", "")

    with open(original_path, 'wb') as file:

        file.write(decrypted_data)


    os.remove(filepath)

    print(f"๐Ÿ”“ File decrypted as {original_path}")


def main():

    parser = argparse.ArgumentParser(description="๐Ÿ” File Locker CLI")

    parser.add_argument("action", choices=["lock", "unlock"], help="Lock or unlock the file")

    parser.add_argument("filepath", help="Path to the file")


    args = parser.parse_args()

    password = getpass.getpass("Enter password: ")


    if args.action == "lock":

        encrypt_file(args.filepath, password)

    elif args.action == "unlock":

        decrypt_file(args.filepath, password)


if __name__ == "__main__":

    main()


Plagiarism Detector

 import difflib

from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.metrics.pairwise import cosine_similarity


def read_file(filename):

    with open(filename, 'r', encoding='utf-8') as file:

        return file.read()


def basic_diff_score(text1, text2):

    seq = difflib.SequenceMatcher(None, text1, text2)

    return round(seq.ratio() * 100, 2)


def nlp_cosine_similarity(text1, text2):

    tfidf = TfidfVectorizer().fit_transform([text1, text2])

    score = cosine_similarity(tfidf[0:1], tfidf[1:2])

    return round(score[0][0] * 100, 2)


def main():

    file1 = input("Enter path to first file: ")

    file2 = input("Enter path to second file: ")


    text1 = read_file(file1)

    text2 = read_file(file2)


    basic_score = basic_diff_score(text1, text2)

    nlp_score = nlp_cosine_similarity(text1, text2)


    print("\n--- Plagiarism Detection Result ---")

    print(f"Simple Match (difflib): {basic_score}%")

    print(f"Semantic Match (TF-IDF Cosine Similarity): {nlp_score}%")


    if nlp_score > 80:

        print("โš ๏ธ High similarity detected. Possible plagiarism.")

    elif nlp_score > 50:

        print("โš ๏ธ Moderate similarity. Review recommended.")

    else:

        print("โœ… Low similarity. Likely original.")


if __name__ == "__main__":

    main()


Online Exam Proctoring Tool

import cv2

import face_recognition

import datetime


def log_alert(msg):

    with open("proctoring_log.txt", "a") as f:

        f.write(f"{datetime.datetime.now()} - {msg}\n")


def main():

    cap = cv2.VideoCapture(0)


    if not cap.isOpened():

        print("Could not access webcam.")

        return


    print("[INFO] Proctoring started. Press 'q' to quit.")


    while True:

        ret, frame = cap.read()

        if not ret:

            break


        # Resize frame for faster processing

        small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)

        rgb_small_frame = small_frame[:, :, ::-1]


        # Detect all faces

        face_locations = face_recognition.face_locations(rgb_small_frame)

        face_count = len(face_locations)


        # Draw rectangles around faces

        for (top, right, bottom, left) in face_locations:

            top, right, bottom, left = top*4, right*4, bottom*4, left*4

            cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2)


        # Check for multiple faces

        if face_count > 1:

            cv2.putText(frame, "ALERT: Multiple Faces Detected!", (10, 30),

                        cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 0, 255), 2)

            log_alert("Multiple faces detected!")


        # Show output

        cv2.imshow("Exam Proctoring Feed", frame)


        # Break on 'q' key

        if cv2.waitKey(1) & 0xFF == ord('q'):

            break


    cap.release()

    cv2.destroyAllWindows()

    print("[INFO] Proctoring ended.")


if __name__ == "__main__":

    main()