Budget Planner with Visualization

 import pandas as pd

import matplotlib.pyplot as plt

from tkinter import *

from tkinter import ttk, messagebox

import os

from datetime import datetime


# Create main window

root = Tk()

root.title("Budget Planner with Visualization")

root.geometry("800x600")


# CSV file name

filename = "budget_data.csv"


# Load existing data

if os.path.exists(filename):

    df = pd.read_csv(filename)

else:

    df = pd.DataFrame(columns=["Date", "Category", "Type", "Amount"])


# Function to add entry

def add_entry():

    date = date_entry.get()

    category = category_entry.get()

    ttype = type_combo.get()

    amount = amount_entry.get()


    if not date or not category or not ttype or not amount:

        messagebox.showerror("Input Error", "All fields are required.")

        return


    try:

        datetime.strptime(date, "%Y-%m-%d")

        amount = float(amount)

    except:

        messagebox.showerror("Input Error", "Invalid date or amount.")

        return


    new_entry = {"Date": date, "Category": category, "Type": ttype, "Amount": amount}

    global df

    df = pd.concat([df, pd.DataFrame([new_entry])], ignore_index=True)

    df.to_csv(filename, index=False)

    update_table()

    messagebox.showinfo("Success", "Entry added successfully!")


# Function to update table

def update_table():

    for row in tree.get_children():

        tree.delete(row)

    for index, row in df.iterrows():

        tree.insert("", "end", values=list(row))


# Function to show chart

def show_chart():

    try:

        expense_df = df[df["Type"] == "Expense"]

        summary = expense_df.groupby("Category")["Amount"].sum()

        summary.plot.pie(autopct="%1.1f%%", startangle=90)

        plt.title("Expenses by Category")

        plt.ylabel("")

        plt.show()

    except Exception as e:

        messagebox.showerror("Chart Error", str(e))


# Input Form

form_frame = Frame(root)

form_frame.pack(pady=10)


Label(form_frame, text="Date (YYYY-MM-DD)").grid(row=0, column=0, padx=5)

date_entry = Entry(form_frame)

date_entry.grid(row=0, column=1, padx=5)


Label(form_frame, text="Category").grid(row=0, column=2, padx=5)

category_entry = Entry(form_frame)

category_entry.grid(row=0, column=3, padx=5)


Label(form_frame, text="Type").grid(row=1, column=0, padx=5)

type_combo = ttk.Combobox(form_frame, values=["Income", "Expense"], state="readonly")

type_combo.grid(row=1, column=1, padx=5)


Label(form_frame, text="Amount").grid(row=1, column=2, padx=5)

amount_entry = Entry(form_frame)

amount_entry.grid(row=1, column=3, padx=5)


Button(form_frame, text="Add Entry", command=add_entry).grid(row=2, column=0, columnspan=4, pady=10)


# Treeview

tree = ttk.Treeview(root, columns=["Date", "Category", "Type", "Amount"], show="headings")

for col in ["Date", "Category", "Type", "Amount"]:

    tree.heading(col, text=col)

    tree.column(col, width=150)

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


# Show chart button

Button(root, text="Show Expense Chart", command=show_chart).pack(pady=10)


# Load initial table

update_table()


root.mainloop()


Website Availability & Uptime Tracker

 import requests

import schedule

import time

import smtplib

from email.mime.text import MIMEText


# List of websites to track

websites = {

    "Google": "https://www.google.com",

    "My Portfolio": "https://yourportfolio.com"

}


# Email Config

EMAIL_ADDRESS = "your_email@gmail.com"

EMAIL_PASSWORD = "your_app_password"

TO_EMAIL = "recipient_email@example.com"


def send_email_alert(site):

    msg = MIMEText(f"Alert: {site} is DOWN!")

    msg["Subject"] = f"🚨 {site} is Down!"

    msg["From"] = EMAIL_ADDRESS

    msg["To"] = TO_EMAIL


    with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smtp:

        smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)

        smtp.send_message(msg)

        print(f"Email sent: {site} is down.")


def check_sites():

    for name, url in websites.items():

        try:

            response = requests.get(url, timeout=5)

            if response.status_code != 200:

                print(f"[{name}] Status: {response.status_code}")

                send_email_alert(name)

            else:

                print(f"[{name}] is up ✅")

        except requests.exceptions.RequestException:

            print(f"[{name}] is unreachable ❌")

            send_email_alert(name)


# Check every 5 minutes

schedule.every(5).minutes.do(check_sites)


print("🔍 Website Uptime Tracker Started...")

while True:

    schedule.run_pending()

    time.sleep(1)



Twilio SMS Integration


from twilio.rest import Client

account_sid = "your_sid"
auth_token = "your_token"
twilio_number = "+1234567890"
receiver_number = "+91999xxxxxxx"

def send_sms_alert(site):
    client = Client(account_sid, auth_token)
    client.messages.create(
        body=f"🚨 {site} is DOWN!",
        from_=twilio_number,
        to=receiver_number
    )

Document Similarity Checker

 import streamlit as st

from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.metrics.pairwise import cosine_similarity

import spacy


nlp = spacy.load("en_core_web_sm")


st.title("📄 Document Similarity Checker")


def preprocess(text):

    doc = nlp(text)

    return " ".join([token.lemma_ for token in doc if not token.is_stop and token.is_alpha])


file1 = st.file_uploader("Upload First Document", type=["txt"])

file2 = st.file_uploader("Upload Second Document", type=["txt"])


if file1 and file2:

    text1 = file1.read().decode("utf-8")

    text2 = file2.read().decode("utf-8")


    clean_text1 = preprocess(text1)

    clean_text2 = preprocess(text2)


    tfidf = TfidfVectorizer()

    tfidf_matrix = tfidf.fit_transform([clean_text1, clean_text2])

    sim_score = cosine_similarity(tfidf_matrix[0:1], tfidf_matrix[1:2])[0][0]


    st.subheader("🧮 Similarity Score")

    st.write(f"**{sim_score:.2f}** (1 = identical, 0 = completely different)")


    if sim_score > 0.75:

        st.success("The documents are quite similar! 🟢")

    elif sim_score > 0.4:

        st.info("The documents are moderately similar. 🟡")

    else:

        st.warning("The documents are quite different. 🔴")


Smart Calendar CLI App

 import click

import requests

from datetime import datetime, timedelta


# Placeholder for real GCal and weather integration

EVENTS = [

    {"title": "Standup Meeting", "time": "10:00", "date": "2025-04-16", "location": "Remote"},

    {"title": "Doctor Appointment", "time": "15:00", "date": "2025-04-16", "location": "City Clinic"},

]


@click.group()

def cli():

    pass


@cli.command()

def today():

    click.echo("📅 Today's Events:")

    today = datetime.today().strftime('%Y-%m-%d')

    for e in EVENTS:

        if e["date"] == today:

            click.echo(f"- {e['time']}: {e['title']} 📍 {e['location']}")


@cli.command()

@click.option('--title', prompt='Event title')

@click.option('--date', prompt='Event date (YYYY-MM-DD)')

@click.option('--time', prompt='Event time (HH:MM)')

@click.option('--location', prompt='Event location')

def add(title, date, time, location):

    EVENTS.append({"title": title, "date": date, "time": time, "location": location})

    click.echo("✅ Event created successfully!")


@cli.command()

def forecast():

    if not EVENTS:

        click.echo("No events to check weather for.")

        return

    event = EVENTS[-1]

    click.echo(f"🌦 Forecast for: {event['title']}")

    weather = get_weather(event['location'])

    click.echo(f"📍 Location: {event['location']} | Date: {event['date']}")

    click.echo(f"☁️ Weather Forecast: {weather}")


def get_weather(city):

    API_KEY = "your_openweathermap_api_key"

    url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={API_KEY}&units=metric"

    r = requests.get(url)

    if r.status_code == 200:

        data = r.json()

        return f"{data['weather'][0]['main']}, {data['main']['temp']}°C"

    return "Weather data unavailable"


if __name__ == '__main__':

    cli()


Voice-Controlled Notes App

import speech_recognition as sr

import pyttsx3

import os


notes = {}


engine = pyttsx3.init()


def speak(text):

    engine.say(text)

    engine.runAndWait()


def listen_command():

    r = sr.Recognizer()

    with sr.Microphone() as source:

        speak("Listening...")

        audio = r.listen(source)

    try:

        command = r.recognize_google(audio)

        return command.lower()

    except:

        speak("Sorry, I didn't catch that.")

        return ""


def create_note():

    speak("What should I name the note?")

    title = listen_command()

    speak("What is the content?")

    content = listen_command()

    notes[title] = content

    speak(f"Note '{title}' created.")


def read_notes():

    if notes:

        for title, content in notes.items():

            speak(f"{title}: {content}")

    else:

        speak("No notes found.")


def delete_note():

    speak("Which note should I delete?")

    title = listen_command()

    if title in notes:

        del notes[title]

        speak(f"Note '{title}' deleted.")

    else:

        speak("Note not found.")


def main():

    speak("Voice Notes App Started.")

    while True:

        speak("Say a command: create, read, delete, or exit.")

        command = listen_command()


        if "create" in command:

            create_note()

        elif "read" in command:

            read_notes()

        elif "delete" in command:

            delete_note()

        elif "exit" in command:

            speak("Goodbye!")

            break

        else:

            speak("Unknown command.")


if __name__ == "__main__":

    main()