├── finance_manager.py ├── email_sender_bot.py ├── wealth_calculator.py ├── google_drive_uploader_bot.py └── desktop_cleaner_bot.py /finance_manager.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | # Save a CSV file of your transactions in the same folder as this project and put the name below 4 | FILE = '' 5 | 6 | def finance_manager(file): 7 | sum = 0 8 | transactions = [] 9 | with open(file, mode='r') as csv_file: 10 | csv_reader = csv.reader(csv_file) 11 | header = next(csv_reader) 12 | for row in csv_reader: 13 | #get name, amount, currency 14 | name = row[4] 15 | amount = float(row[7]) 16 | date = row[1] 17 | 18 | transaction = (date, name, amount) 19 | sum += amount 20 | transactions.append(transaction) 21 | print(f"The sum of your transactions this month is {sum}") 22 | print('') 23 | return transactions 24 | 25 | print(finance_manager(FILE)) -------------------------------------------------------------------------------- /email_sender_bot.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | # specify the Mailgun API endpoint and credentials 4 | MAILGUN_API_ENDPOINT = "" 5 | MAILGUN_API_KEY = '' 6 | 7 | # define a function to send an email 8 | def send_email(to, subject, body): 9 | 10 | # create a dictionary with the email data 11 | data = { 12 | # ! Fill in 13 | 'from': '', 14 | 'to': to, 15 | 'subject': subject, 16 | 'text': body 17 | } 18 | 19 | # send a POST request to the Mailgun API endpoint 20 | response = requests.post( 21 | MAILGUN_API_ENDPOINT, 22 | auth=('api', MAILGUN_API_KEY), 23 | data=data 24 | ) 25 | 26 | # check if the request was successful 27 | if response.status_code == 200: 28 | print('Email sent successfully!') 29 | else: 30 | print('An error occurred while sending the email.') 31 | 32 | # example usage - ! Fill in 33 | to = "" 34 | subject = 'HI' 35 | body = 'HIT THE LINKE BUTTON' 36 | send_email(to, subject, body) -------------------------------------------------------------------------------- /wealth_calculator.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def calculate_wealth_by_year(current_wealth, rate_of_return, monthly_savings, years): 4 | total_savings = current_wealth 5 | for year in range(1, years + 1): 6 | interest = total_savings * (rate_of_return / 100) 7 | total_savings += interest + (monthly_savings * 12) 8 | print(f"Year {year}: Total wealth = {total_savings:.2f}") 9 | return 0 10 | 11 | def calculate_years_till_freedom(current_wealth, rate_of_return, monthly_savings, target_wealth): 12 | total_savings = current_wealth 13 | years_to_freedom = 0 14 | while True: 15 | years_to_freedom += 1 16 | interest = total_savings * (rate_of_return / 100) 17 | total_savings += interest + (monthly_savings * 12) 18 | if total_savings > target_wealth: 19 | print(f"You will reach financial freedom in {years_to_freedom} years! Keep grinding!! ") 20 | return 0 21 | 22 | def main(): 23 | prog = input("Which program would you like to run? Type 'returns' or 'freedom' ") 24 | try: 25 | current_wealth = float(input("Enter your current wealth: ")) 26 | rate_of_return = float(input("Enter estimated rate of return (%): ")) 27 | monthly_savings = float(input("Enter how much you can save per month: ")) 28 | except ValueError: 29 | print("Invalid input. You must only enter numbers, dumbass!! ") 30 | sys.exit() 31 | if prog == 'returns': 32 | years = int(input("Enter investment period in years: ")) 33 | calculate_wealth_by_year(current_wealth, rate_of_return, monthly_savings, years) 34 | elif prog == 'freedom': 35 | try: 36 | target_wealth = float(input("How much money do you need to be financially free? ")) 37 | except ValueError: 38 | print("Invalid input. You must only enter numbers, dumbass!! ") 39 | sys.exit() 40 | calculate_years_till_freedom(current_wealth, rate_of_return, monthly_savings, target_wealth) 41 | else: 42 | print("Invalid input. Type 'returns' or 'freedom'") 43 | 44 | main() 45 | -------------------------------------------------------------------------------- /google_drive_uploader_bot.py: -------------------------------------------------------------------------------- 1 | import os 2 | import google.auth 3 | from google.oauth2.credentials import Credentials 4 | from googleapiclient.discovery import build 5 | from googleapiclient.errors import HttpError 6 | from googleapiclient.http import MediaFileUpload 7 | from google_auth_oauthlib.flow import InstalledAppFlow 8 | from google.auth.transport.requests import Request 9 | 10 | # ! Specify the ID of the folder to upload files to (from the URL of the Drive folder) 11 | folder_id = '' 12 | 13 | SCOPES=['https://www.googleapis.com/auth/drive'] 14 | 15 | 16 | def create_connection(): 17 | 18 | creds = None 19 | # The file token.json stores the user's access and refresh tokens, and is 20 | # created automatically when the authorization flow completes for the first 21 | # time. 22 | if os.path.exists('token.json'): 23 | creds = Credentials.from_authorized_user_file('token.json', SCOPES) 24 | # If there are no (valid) credentials available, let the user log in. 25 | if not creds or not creds.valid: 26 | if creds and creds.expired and creds.refresh_token: 27 | creds.refresh(Request()) 28 | else: 29 | flow = InstalledAppFlow.from_client_secrets_file( 30 | 'credentials.json', SCOPES) 31 | creds = flow.run_local_server(port=0) 32 | # Save the credentials for the next run 33 | with open('token.json', 'w') as token: 34 | token.write(creds.to_json()) 35 | return creds 36 | 37 | # define a function to upload a file to Google Drive 38 | def upload_file(file_path, file_name, creds): 39 | 40 | service = build('drive', 'v3', credentials=creds) 41 | try: 42 | # create a MediaFileUpload object for the file 43 | file = MediaFileUpload(file_path, resumable=True) 44 | 45 | # create a file resource with metadata 46 | file_metadata = { 47 | 'name': file_name, 48 | 'parents': [folder_id] 49 | } 50 | 51 | # send a request to upload the file 52 | file = service.files().create( 53 | body=file_metadata, 54 | media_body=file, 55 | fields='id' 56 | ).execute() 57 | 58 | print(f'File "{file_name}" uploaded to Google Drive with ID: {file.get("id")}') 59 | 60 | except HttpError as error: 61 | print(f'An error occurred while uploading file "{file_name}" to Google Drive: {error}') 62 | file = None 63 | 64 | return file 65 | 66 | # define a function to bulk upload files to Google Drive 67 | def upload_files(directory_path, creds): 68 | # get the list of files in the directory 69 | files = os.listdir(directory_path) 70 | 71 | # iterate over each file and upload it to Google Drive 72 | for file_name in files: 73 | file_path = os.path.join(directory_path, file_name) 74 | upload_file(file_path, file_name, creds) 75 | 76 | # example usage 77 | creds = create_connection() 78 | # ! Fill in the path to the folder you want to upload files from (from your local computer) 79 | directory_path = '' 80 | upload_files(directory_path, creds) -------------------------------------------------------------------------------- /desktop_cleaner_bot.py: -------------------------------------------------------------------------------- 1 | from os import scandir, rename 2 | from os.path import exists, join, splitext 3 | from shutil import move 4 | 5 | import logging 6 | 7 | # ! FILL IN BELOW 8 | source_dir = "" 9 | dest_dir_sfx = "" 10 | dest_dir_music = "" 11 | dest_dir_video = "" 12 | dest_dir_image = "" 13 | dest_dir_documents = "" 14 | 15 | # ? supported image types 16 | image_extensions = [".jpg", ".jpeg", ".jpe", ".jif", ".jfif", ".jfi", ".png", ".gif", ".webp", ".tiff", ".tif", ".psd", ".raw", ".arw", ".cr2", ".nrw", 17 | ".k25", ".bmp", ".dib", ".heif", ".heic", ".ind", ".indd", ".indt", ".jp2", ".j2k", ".jpf", ".jpf", ".jpx", ".jpm", ".mj2", ".svg", ".svgz", ".ai", ".eps", ".ico"] 18 | # ? supported Video types 19 | video_extensions = [".webm", ".mpg", ".mp2", ".mpeg", ".mpe", ".mpv", ".ogg", 20 | ".mp4", ".mp4v", ".m4v", ".avi", ".wmv", ".mov", ".qt", ".flv", ".swf", ".avchd"] 21 | # ? supported Audio types 22 | audio_extensions = [".m4a", ".flac", "mp3", ".wav", ".wma", ".aac"] 23 | 24 | # ? supported Document types 25 | document_extensions = [".doc", ".docx", ".odt", 26 | ".pdf", ".xls", ".xlsx", ".ppt", ".pptx"] 27 | 28 | 29 | def make_unique(dest, name): 30 | filename, extension = splitext(name) 31 | counter = 1 32 | # * IF FILE EXISTS, ADDS NUMBER TO THE END OF THE FILENAME 33 | while exists(f"{dest}/{name}"): 34 | name = f"{filename}({str(counter)}){extension}" 35 | counter += 1 36 | 37 | return name 38 | 39 | def move_file(dest, entry, name): 40 | if exists(f"{dest}/{name}"): 41 | unique_name = make_unique(dest, name) 42 | oldName = join(dest, name) 43 | newName = join(dest, unique_name) 44 | rename(oldName, newName) 45 | move(entry, dest) 46 | 47 | def on_cleaner(): 48 | with scandir(source_dir) as entries: 49 | for entry in entries: 50 | name = entry.name 51 | check_audio_files(entry, name) 52 | check_video_files(entry, name) 53 | check_image_files(entry, name) 54 | check_document_files(entry, name) 55 | 56 | def check_audio_files(entry, name): # * Checks all Audio Files 57 | for audio_extension in audio_extensions: 58 | if name.endswith(audio_extension) or name.endswith(audio_extension.upper()): 59 | if entry.stat().st_size < 10_000_000 or "SFX" in name: # ? 10Megabytes 60 | dest = dest_dir_sfx 61 | else: 62 | dest = dest_dir_music 63 | move_file(dest, entry, name) 64 | logging.info(f"Moved audio file: {name}") 65 | 66 | def check_video_files(entry, name): # * Checks all Video Files 67 | for video_extension in video_extensions: 68 | if name.endswith(video_extension) or name.endswith(video_extension.upper()): 69 | move_file(dest_dir_video, entry, name) 70 | logging.info(f"Moved video file: {name}") 71 | 72 | def check_image_files(entry, name): # * Checks all Image Files 73 | for image_extension in image_extensions: 74 | if name.endswith(image_extension) or name.endswith(image_extension.upper()): 75 | move_file(dest_dir_image, entry, name) 76 | logging.info(f"Moved image file: {name}") 77 | 78 | def check_document_files(entry, name): # * Checks all Document Files 79 | for documents_extension in document_extensions: 80 | if name.endswith(documents_extension) or name.endswith(documents_extension.upper()): 81 | move_file(dest_dir_documents, entry, name) 82 | logging.info(f"Moved document file: {name}") 83 | 84 | --------------------------------------------------------------------------------