├── .github ├── ISSUE_TEMPLATE │ ├── New_Script_Idea.md │ ├── bug_report.md │ └── feature_request.md └── pull_request_template.md ├── .gitignore ├── Arrange It ├── README.md └── arrangeit.py ├── Auto WiFi Check ├── README.md └── wifi_checker.py ├── AutoCert ├── README.md ├── Sample.png ├── exports │ └── rahul.pdf ├── fonts │ ├── Roboto-Light.ttf │ ├── Roboto-Thin.ttf │ └── orbitron-black.otf ├── main.py ├── names.csv └── requirements.txt ├── Automate Emails Daily └── main.py ├── Automating Emails ├── Birthday-Manager.py ├── README.md └── birthday.csv ├── Blackjack ├── BlackjackGame.py └── README.md ├── CODE_OF_CONDUCT.md ├── CSV to Excel └── csv_excel.py ├── Cafe Management System ├── README.md ├── cafe-management.py ├── cafe.png └── false.png ├── Calculate Compound Interest └── calculateCompoundInterest.py ├── Chess Board ├── ChessBoard.py └── README.md ├── Contributions.md ├── Countdown Timer ├── README.md └── timer.py ├── Crop Images ├── README.md ├── crop.py ├── icon.png └── output screenshot.png ├── Currency Script ├── currency.py └── currency_calculator.py ├── Digital Clock ├── DigitalClock.py └── README.md ├── Display Popup Window ├── DisplayPopupWindow.bat ├── DisplayPopupWindow.py └── README.md ├── Duplicate Finder ├── Readme.md └── duplicate-finder.py ├── Expense Tracker ├── README.md ├── expense.py └── requirements.txt ├── Face Reaction └── app.py ├── Fake Profile ├── FakeProfile.py └── README.md ├── File Encryption Decryption ├── README.md ├── fileEncryptDecrypt.py └── krishna.txt ├── Font Art ├── FontArt.py └── README.md ├── Fractal tree ├── README.md └── fractaltree.py ├── Get Hexcodes From Websites ├── README.md └── getColoursFromWeb.py ├── HTML to Images ├── README.md └── html-to-images.py ├── Hand Volume ├── handTrackingModule.py └── main.py ├── Harvest Predictor ├── Procfile ├── README.md ├── Regression.ipynb ├── app.py ├── model_pickle ├── requirements.txt ├── static │ └── 101608227-paddy-field.jpg └── templates │ └── index.html ├── IP Geolocator └── main.py ├── Image Capture ├── README.md └── take_pictures_from_webcam.py ├── Image Compress └── compressor.py ├── Image Manipulation without libraries ├── README.md ├── imagemanipulationwithoutlibraries.py └── sample.jpg ├── Image Text to PDF ├── img.jpg ├── input.txt ├── readme.md └── script.py ├── Image Text ├── image3.png └── text_image.py ├── Image to ASCII ├── ascii_image.txt ├── main.py ├── python.jpg └── requirements.txt ├── Image to GIF ├── README.md └── imageTogif.py ├── JSON to CSV 2 ├── README.md └── main.py ├── JSON to CSV ├── README.md └── code │ └── pyscript.py ├── JSON to YAML └── json_to_yaml.py ├── Jokes Generator ├── jokes.py └── readme.md ├── Json to CSV Convertor ├── README.MD ├── image.png ├── json_to_csv.py ├── json_to_csv_with_nested_dict.py └── requirements.txt ├── Keylogger ├── README.md └── cryptography │ ├── DecryptFile.py │ └── GenerateKey.py ├── Keyword Retweet Twitter Bot ├── README.md ├── bot.txt └── main.py ├── LICENSE ├── LinkedIn Bot ├── README.md ├── requirements.txt └── scraper.py ├── Mail Sender ├── mail_sender.py ├── readme.md └── temp.txt ├── Merge Two Images ├── README.md └── mergeImages.py ├── Mouse Mover ├── MouseMover.py └── README.md ├── No Screensaver ├── Readme.md └── noscreensaver.py ├── OTP Verify └── Otpverification.py ├── PDF to Audio ├── audio_book.py └── python_basics.pdf ├── PDF to HTML ├── README.md ├── __init__.py └── script.py ├── PNG-To-JPG ├── README.md ├── example.jpg ├── example.png └── main.py ├── Password Generator └── PasswordGenerator.py ├── Password Manager ├── README.MD └── pwd_mgmr.py ├── Planet Simulation └── main.py ├── Playlist Exchange ├── README.md ├── playlistexchange.py └── requirements.txt ├── Profanity Checker └── ProfanityChecker.py ├── QR Code Generator ├── QRcode.py └── qrcode.png ├── QR Ticket Generator ├── README.md ├── main.py └── requirements.txt ├── README.md ├── Random Color Generator ├── README.md ├── RandColorGen.py └── Random Color Generator.zip ├── Remove Background ├── README.md └── code.py ├── Rock Paper Scissor ├── README.md └── rps.py ├── Run Then Notify ├── README.md └── run_then_notify.py ├── Selfie with Python └── Selfie_with_Python.py ├── Snake Water Gun └── snake-water-gun.py ├── Sorting ├── bubblesort.py ├── insertionsort.py └── selectionsort.py ├── Star Pattern ├── README.md └── starPattern.py ├── TCP Chat Server └── server.py ├── Take A Break ├── README.md └── TakeABreak.py ├── Text Recognition ├── README.md └── Text_recognition.ipynb ├── Text to Image ├── README.md ├── fonts │ └── Roboto-Black.ttf └── text2image.py ├── Tic-Tac-Toe 2 └── Game.py ├── Tic-Tac-Toe └── tic_tac_toe.py ├── Turtle Art ├── Doraemon.py ├── Pikachu.py ├── Prompt_Based │ ├── benzene.py │ ├── tkinterName.py │ └── windowsLogo.py ├── README.md ├── Shinchan.py ├── Xsquare.py ├── art2.py ├── art4.py ├── art5.py ├── happy_birthday.py ├── rainbow_hexagon.py ├── rainbow_triangle.py ├── scenery.py └── sunflowerGood.py ├── Turtle Graphics ├── README.md └── TurtleGraphics.py ├── Twitter Selenium Bot ├── README.md ├── like_tweets_homepage.py ├── like_tweets_keyword.py ├── post_tweet.py └── twitter_bot_class.py ├── URL Shortener └── urlshortener.py ├── Umbrella Reminder └── umbrellaReminder.py ├── Video Downloader ├── README.md └── VideoDownloader.py ├── Video Watermarker └── VideoWatermarker.py ├── Virtual Painter ├── tools.png └── virtual_paint_app.py ├── Wallpaper Changer └── wallpaperchanger.py ├── Weather GUI └── weather.py ├── Website Blocker ├── mac │ └── Website_Blocker.py └── read.me ├── Website Cloner ├── README.md ├── index.html ├── main.css ├── server.py └── util.css ├── Weight Converter ├── readme.md ├── requirements.txt └── weight.py ├── Wikipedia Data Extractor ├── README.md └── wikipedia_extractor.py ├── Word to PDF converter └── wordToPDF.py ├── Youtube Downloader ├── README.md └── youtubeDownloader.py ├── emoji ├── emoji.py └── emoji.tiff ├── emoji_to_pdf ├── Symbola_hint.ttf ├── emoji.pdf ├── emoji_to_pdf.py └── requirements.txt ├── freelance-help-program ├── README.md └── calc.py ├── import of music and video ├── Readme.md ├── import.music.py └── import.vd.py └── recently_accessed_files ├── README.MD ├── image-1.png └── recently_accessed_files.py /.github/ISSUE_TEMPLATE/New_Script_Idea.md: -------------------------------------------------------------------------------- 1 | # New Script Idea 2 | **Hi Everyone**, 3 | 4 | **Script Idea Name**: 5 | 6 | **Description Of The Script**: 7 | 8 | **Ready To Contribute For The Script Idea**:*[Yes/No]* 9 | 10 | **Reference for the idea(if any)**: 11 | 12 | _Thank You_, 13 | 14 | (Your Name) 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # PR Title 2 | Give a title to your PR 3 | 4 | ## Summary 5 | 6 | summary... 7 | 8 | 9 | ## Description 10 | 11 | 12 | 13 | ### The changes are as follows: 14 | - Change 1 15 | - Change 2 16 | 17 | 18 | 19 | ## Checks 20 | 21 | ### in the repository 22 | 23 | - [ ] Made no changes that degrades the functioning of the repository 24 | - [ ] Gave each commit a better title (unlike updated README.md) 25 | 26 | ### in the PR 27 | - [ ] Followed the format of the pull_request_template 28 | - [ ] Made the Pull Request in a small level (for the creator's wellfare) 29 | - [ ] Tested the changes you made 30 | 31 | 32 | 33 | Thank You, 34 | 35 | [Your Name] 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # If you need to test anything name the file as "test" followed by any extension 2 | # This helps in testing the code while in development environment 3 | # These files will not be pushed in github 4 | test* 5 | 6 | # VSCode 7 | .vscode/* 8 | !.vscode/settings.json 9 | !.vscode/tasks.json 10 | !.vscode/launch.json 11 | !.vscode/extensions.json 12 | *.code-workspace 13 | # Local History for Visual Studio Code 14 | .history/ 15 | 16 | # Common credential files 17 | **/credentials.json 18 | **/client_secrets.json 19 | **/client_secret.json 20 | *creds* 21 | *.dat 22 | *password* 23 | *.httr-oauth* 24 | 25 | # Private Node Modules 26 | node_modules/ 27 | creds.js 28 | 29 | # Private Files 30 | *.json 31 | *.csv 32 | *.csv.gz 33 | *.tsv 34 | *.tsv.gz 35 | *.xlsx 36 | 37 | 38 | # Mac/OSX 39 | .DS_Store 40 | 41 | 42 | # Byte-compiled / optimized / DLL files 43 | __pycache__/ 44 | *.py[cod] 45 | *$py.class 46 | 47 | # C extensions 48 | *.so 49 | 50 | # Distribution / packaging 51 | .Python 52 | build/ 53 | develop-eggs/ 54 | dist/ 55 | downloads/ 56 | eggs/ 57 | .eggs/ 58 | lib/ 59 | lib64/ 60 | parts/ 61 | sdist/ 62 | var/ 63 | wheels/ 64 | share/python-wheels/ 65 | *.egg-info/ 66 | .installed.cfg 67 | *.egg 68 | MANIFEST 69 | 70 | # PyInstaller 71 | # Usually these files are written by a python script from a template 72 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 73 | *.manifest 74 | *.spec 75 | 76 | # Installer logs 77 | pip-log.txt 78 | pip-delete-this-directory.txt 79 | 80 | # Unit test / coverage reports 81 | htmlcov/ 82 | .tox/ 83 | .nox/ 84 | .coverage 85 | .coverage.* 86 | .cache 87 | nosetests.xml 88 | coverage.xml 89 | *.cover 90 | *.py,cover 91 | .hypothesis/ 92 | .pytest_cache/ 93 | cover/ 94 | 95 | # Translations 96 | *.mo 97 | *.pot 98 | 99 | # Django stuff: 100 | *.log 101 | local_settings.py 102 | db.sqlite3 103 | db.sqlite3-journal 104 | 105 | # Flask stuff: 106 | instance/ 107 | .webassets-cache 108 | 109 | # Scrapy stuff: 110 | .scrapy 111 | 112 | # Sphinx documentation 113 | docs/_build/ 114 | 115 | # PyBuilder 116 | .pybuilder/ 117 | target/ 118 | 119 | # Jupyter Notebook 120 | .ipynb_checkpoints 121 | 122 | # IPython 123 | profile_default/ 124 | ipython_config.py 125 | 126 | # pyenv 127 | # For a library or package, you might want to ignore these files since the code is 128 | # intended to run in multiple environments; otherwise, check them in: 129 | # .python-version 130 | 131 | # pipenv 132 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 133 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 134 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 135 | # install all needed dependencies. 136 | #Pipfile.lock 137 | 138 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 139 | __pypackages__/ 140 | 141 | # Celery stuff 142 | celerybeat-schedule 143 | celerybeat.pid 144 | 145 | # SageMath parsed files 146 | *.sage.py 147 | 148 | # Environments 149 | .env 150 | .venv 151 | env/ 152 | venv/ 153 | ENV/ 154 | env.bak/ 155 | venv.bak/ 156 | 157 | # Spyder project settings 158 | .spyderproject 159 | .spyproject 160 | 161 | # Rope project settings 162 | .ropeproject 163 | 164 | # mkdocs documentation 165 | /site 166 | 167 | # mypy 168 | .mypy_cache/ 169 | .dmypy.json 170 | dmypy.json 171 | 172 | # Pyre type checker 173 | .pyre/ 174 | 175 | # pytype static type analyzer 176 | .pytype/ 177 | 178 | # Cython debug symbols 179 | cython_debug/ 180 | -------------------------------------------------------------------------------- /Arrange It/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Arrange It 3 | 4 | With the help of this script, files can be moved automatically to the folder that corresponds to their extension (for example, ".jpg" or ".png" ==> "/Pictures," and ".mp4" ==> "/Videos"). 5 | 6 | ## How To Run 7 | 8 | - Put in Download Folder Or Wherever You want to automatically move the file and Just run 9 | 10 | For CLI 11 | 12 | ```bash 13 | python arrangeit.py 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /Arrange It/arrangeit.py: -------------------------------------------------------------------------------- 1 | from shutil import move 2 | from os import path 3 | import os 4 | 5 | 6 | directory = { 7 | 'Programming Files': set(['ipynb', 'py', 'java', 'cs', 'js', 'vsix', 'jar', 'cc', 'ccc', 'html', 'xml', 'kt']), 8 | 'Music': set(['mp3', 'wav', 'wma', 'mpa', 'ram', 'ra', 'aac', 'aif', 'm4a', 'tsa']), 9 | 'Videos': set(['mp4', 'webm', 'mkv', 'MPG', 'MP2', 'MPEG', 'MPE', 'MPV', 'OGG', 'M4P', 'M4V', 'WMV', 'MOV', 'QT', 'FLV', 'SWF', 'AVCHD', 'avi', 'mpg', 'mpe', 'mpeg', 'asf', 'wmv', 'mov', 'qt', 'rm']), 10 | 'Pictures': set(['jpeg', 'jpg', 'png', 'gif', 'tiff', 'raw', 'webp', 'jfif', 'ico', 'psd', 'svg', 'ai']), 11 | 'Applications': set(['exe', 'msi', 'deb', 'rpm']), 12 | 'Compressed': set(['zip', 'rar', 'arj', 'gz', 'sit', 'sitx', 'sea', 'ace', 'bz2', '7z']), 13 | 'Documents': set(['txt', 'pdf', 'doc', 'xlsx', 'pdf', 'ppt', 'pps', 'docx', 'pptx']), 14 | 'Other': set([]) 15 | } 16 | 17 | 18 | def create_folders(): 19 | 20 | for dir_ in directory: 21 | try: 22 | os.mkdir(dir_) 23 | print(f'{dir_:20} Created') 24 | except OSError: 25 | print(f'{dir_:20} Already Exists') 26 | 27 | 28 | def get_folder(ext): 29 | 30 | for f, ex in directory.items(): 31 | if ext in ex: 32 | return f 33 | return 'Other' 34 | 35 | 36 | def start(): 37 | for filename in os.listdir(): 38 | if filename != __file__ and filename[0] != '.' and '.' in filename: 39 | ext = os.path.basename(filename).split('.')[-1] 40 | folder = get_folder(ext) 41 | if not os.path.isfile(os.path.join(folder, filename)): 42 | move(filename, folder) 43 | 44 | 45 | if __name__ == '__main__': 46 | create_folders() 47 | start() 48 | -------------------------------------------------------------------------------- /Auto WiFi Check/README.md: -------------------------------------------------------------------------------- 1 |

WiFi Connection Checker and Restarter

2 | 3 |

Overview

4 |

This Python script is designed to check the status of your WiFi connection on a Windows system. If the WiFi network is inactive and not able to receive ping packets, the script will automatically turn off the WiFi, turn it on again, and check whether the connection is live again or not. The script utilizes the schedule package for task scheduling, netsh commands for controlling the WiFi interface, and the netifaces package to retrieve meaningful network interface names.

5 | 6 |

Prerequisites

7 | 11 | 12 |

Dependencies

13 |

Install the schedule and netifaces packages using the following commands:

14 |
15 | pip install schedule
16 | pip install netifaces
17 | 
18 | 19 |

Usage

20 |
    21 |
  1. Run the script with administrative privileges to ensure it can control the WiFi interface.
  2. 22 |
    python wifi_checker.py
    23 |
  3. The script will schedule a periodic check of the WiFi connection status.
  4. 24 |
  5. If the WiFi connection is inactive (unable to receive ping packets), the script will automatically turn off and on the WiFi interface.
  6. 25 |
  7. The script will log the status of the WiFi connection in the console.
  8. 26 |
27 | 28 |

Important Notes

29 | 33 | 34 |

References

35 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Auto WiFi Check/wifi_checker.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | import subprocess 3 | import sys 4 | import time 5 | from datetime import datetime 6 | import schedule as sc 7 | 8 | 9 | def enable(): 10 | subprocess.call("netsh interface set interface Wi-Fi enabled") 11 | print("Turning On the laptop WiFi") 12 | 13 | def disable(): 14 | subprocess.call("netsh interface set interface Wi-Fi disabled") 15 | print("Turning Off the laptop WiFi") 16 | 17 | 18 | 19 | def job(): 20 | if subprocess.call("netsh interface set interface Wi-Fi enabled") == 0: 21 | print("WiFi is enabled and connected to internet") 22 | hostname = "www.google.com" 23 | response = subprocess.call("ping -n 1 " + hostname) 24 | if response == 1: 25 | print("Your Connection is not working") 26 | disable() 27 | time.sleep(1) 28 | enable() 29 | 30 | def is_admin(): 31 | try: 32 | return ctypes.windll.shell32.IsUserAnAdmin() 33 | except: 34 | return False 35 | 36 | if is_admin(): 37 | # job() 38 | sc.every(50).seconds.do(job) 39 | else: 40 | ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1) 41 | 42 | 43 | while True: 44 | sc.run_pending() 45 | time.sleep(1) -------------------------------------------------------------------------------- /AutoCert/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | ## Script - AutoCert 10 | 11 | A Python script to auto generate e-certificates in bulk. 12 | 13 | # Instruction to use 14 |
    15 |
  1. First install all the dependencies, present in the requirements.txt file
  2. 16 |
  3. Put a certificate template with blank fields, in the project folder, with the name `certificateTemplate.png` .Make sure the template is in `png` format only
  4. 17 |
  5. Put the input `csv` file containing a list of the participant names by under a column name.
  6. 18 |
  7. Once all this is done, run `python3 main.py` in your terminal
  8. 19 |
  9. The generated certificates would be present under the *export* folder, with each certificate having the name of the participant.
  10. 20 |
21 | 22 | # Optional 23 | - One can change the font, by adding custom fonts under the font folder. 24 | - One can change the location of the name inside the main.py file. 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /AutoCert/Sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/AutoCert/Sample.png -------------------------------------------------------------------------------- /AutoCert/exports/rahul.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/AutoCert/exports/rahul.pdf -------------------------------------------------------------------------------- /AutoCert/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/AutoCert/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /AutoCert/fonts/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/AutoCert/fonts/Roboto-Thin.ttf -------------------------------------------------------------------------------- /AutoCert/fonts/orbitron-black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/AutoCert/fonts/orbitron-black.otf -------------------------------------------------------------------------------- /AutoCert/main.py: -------------------------------------------------------------------------------- 1 | from PIL import Image, ImageFont, ImageDraw 2 | import pandas as pd 3 | import os 4 | 5 | 6 | def generator(name_list, name_font, name_size, name_loc, id_font, id_size, id_loc, event_id, id_offset=0): 7 | name_font = ImageFont.truetype(name_font, size=name_size) 8 | id_font = ImageFont.truetype(id_font, size=id_size) 9 | 10 | for i in range(0, len(name_list)): 11 | im = Image.open("Sample.png") 12 | sample = ImageDraw.Draw(im) 13 | text_color = (63, 61, 86) 14 | 15 | name = name_list[i] 16 | w, h = sample.textsize(name, font=name_font) 17 | W, H = name_loc 18 | sample.text((W - w / 2, H - h / 2), name, font=name_font, fill=text_color) 19 | 20 | cert_id = event_id + str(i + 1) 21 | W, H = id_loc 22 | sample.text((W, H), cert_id, font=id_font, fill=text_color) 23 | 24 | rgb = Image.new('RGB', im.size, (255, 255, 255)) 25 | rgb.paste(im, mask=im.split()[3]) 26 | rgb.save('exports/' + name + '.pdf', 'PDF', resoultion=100.0) 27 | 28 | 29 | def process(): 30 | data = pd.read_csv('names.csv', names=['names']) 31 | evnetID = input("Enter the event name") 32 | generator( 33 | data.names.tolist(), 34 | "fonts/Roboto-Light.ttf", 35 | 60, 36 | (1260.5, 811.5), 37 | "fonts/orbitron-black.otf", 38 | 48, 39 | (1326, 1369), 40 | evnetID, 41 | 0 42 | ) 43 | 44 | 45 | process() 46 | -------------------------------------------------------------------------------- /AutoCert/names.csv: -------------------------------------------------------------------------------- 1 | vaibhav,rahul 2 | -------------------------------------------------------------------------------- /Automate Emails Daily/main.py: -------------------------------------------------------------------------------- 1 | import smtplib 2 | import ssl 3 | import os 4 | from email.message import EmailMessage 5 | from email.utils import formataddr 6 | 7 | def send_email(sender_email: str, 8 | sender_name: str, 9 | password:str, 10 | receiver_emails: str , 11 | email_body: str, 12 | email_subject: str="No subject",)-> None: 13 | 14 | msg = EmailMessage() 15 | msg["Subject"] = email_subject 16 | msg["From"] = formataddr((f"{sender_name}", f"{sender_email}")) 17 | msg["BCC"] = sender_email 18 | msg.set_content(email_body) 19 | 20 | smtp_port = 587 21 | smtp_server = "smtp.gmail.com" 22 | 23 | # Adding ssl layer of security 24 | ssl_context = ssl.create_default_context() 25 | 26 | try: 27 | # Creating smtp server 28 | print("Connecting to Server...") 29 | my_server = smtplib.SMTP(smtp_server, smtp_port) 30 | my_server.starttls(context=ssl_context) 31 | 32 | # Login to smtp server 33 | my_server.login(sender_email, password) 34 | print("Connected to server!") 35 | 36 | # Sending email 37 | print(f"Sending email from: {sender_email}") 38 | print("**************************************") 39 | for receiver in receiver_emails: 40 | msg["To"] = receiver 41 | print(f"Sending email to: {receiver}") 42 | my_server.sendmail(sender_email, receiver, msg.as_string()) 43 | print(f"...\nSuccessfully sent to: {receiver}") 44 | print("**************************************") 45 | del msg["To"] 46 | except Exception as e: 47 | print(f"ERROR: {e}") 48 | finally: 49 | my_server.quit() 50 | 51 | # change these variables to suite your requirements 52 | sender_email = "your-email@gmail.com" 53 | sender_name = "your name" 54 | password = os.environ.get("EMAIL_PASSWORD") 55 | 56 | email_subject = "good morning" 57 | email_body = "good morning, hope you have a wonderful day" 58 | 59 | receiver_emails = ["receiver1-email@gmail.com", "receiver2-email@gmail.com", "receiver3-email@gmail.com"] 60 | 61 | send_email(sender_email, sender_name, password, receiver_emails, email_body,email_subject) -------------------------------------------------------------------------------- /Automating Emails/Birthday-Manager.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import smtplib, ssl 3 | 4 | message = """Hi {fname}, 5 | I wish you a very Happy Birthday. 6 | I hope you had a great day.""" 7 | 8 | sender_address = "you@example.com" 9 | sender_password = "examplePassword" 10 | 11 | context = ssl.create_default_context() 12 | with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as server: 13 | server.login(sender_address, sender_password) 14 | 15 | with open(r"birthday.csv") as birthdays: 16 | reader = csv.reader(birthdays) 17 | next(reader) 18 | for fname, lname, email, dob in reader: 19 | server.sendmail( 20 | sender_address, 21 | email, 22 | message.format(fname=fname), 23 | ) 24 | 25 | choice = input( 26 | """Do you wish to add or remove names from the csv file? 27 | if you would like to add names type add 28 | otherwise if you would like to remove names type remove 29 | When you are finished, type exit 30 | """ 31 | ) 32 | 33 | if choice == "add": 34 | new_data = input("Enter data as first name,lastname,email,date of birth: ") 35 | new_data = new_data.split(",") 36 | with open(r"birthday.csv", "r ") as file: 37 | writer_object = csv.writer(file) 38 | next(file) 39 | writer_object.writerow(new_data) 40 | elif choice == "remove": 41 | lines = [] 42 | removal = input("Enter the first name of the person to be removed: ") 43 | with open(r"birthday.csv", "r") as file: 44 | reader = csv.reader(file) 45 | 46 | for row in reader: 47 | lines.append(row) 48 | 49 | for fields in row: 50 | if fields == removal: 51 | lines.remove(row) 52 | 53 | with open(r"birthday.csv", "w", newline="") as file: 54 | writer = csv.writer(file) 55 | writer.writerows(lines) 56 | 57 | -------------------------------------------------------------------------------- /Automating Emails/README.md: -------------------------------------------------------------------------------- 1 | # Automating-Emails-on-a-.csv-file 2 |
3 | Python program to automate an email personalized birthday message by reading details from a .csv file
4 | Also includes options to add and remove details from said .csv file -------------------------------------------------------------------------------- /Automating Emails/birthday.csv: -------------------------------------------------------------------------------- 1 | John,Smith,jsmith@example.com,01011990 2 | -------------------------------------------------------------------------------- /Blackjack/README.md: -------------------------------------------------------------------------------- 1 | If a player's first two cards are an ace and a "ten-card" (a picture card or 10), giving a count of 21 in two cards, this is a natural or "blackjack." If any player has a natural and the dealer does not, the dealer immediately pays that player one and a half times the amount of their bet. -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | Trust, respect, collaboration and transparency are core values we believe should live and breathe within our project. Our community welcomes participants from around the world with different experiences, unique perspectives, and great ideas to share. 4 | 5 | ## Our Pledge 6 | 7 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 8 | 9 | ## Our Standards 10 | 11 | Examples of behavior that contributes to creating a positive environment include: 12 | 13 | - Using welcoming and inclusive language 14 | - Being respectful of differing viewpoints and experiences 15 | - Gracefully accepting constructive criticism 16 | - Attempting collaboration before conflict 17 | - Focusing on what is best for the community 18 | - Showing empathy towards other community members 19 | 20 | Examples of unacceptable behavior by participants include: 21 | 22 | - Violence, threats of violence, or inciting others to commit self-harm 23 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 24 | - Trolling, intentionally spreading misinformation, insulting/derogatory comments, and personal or political attacks 25 | - Public or private harassment 26 | - Publishing others' private information, such as a physical or electronic address, without explicit permission 27 | - Abuse of the reporting process to intentionally harass or exclude others 28 | - Advocating for, or encouraging, any of the above behavior 29 | - Other conduct which could reasonably be considered inappropriate in a professional setting 30 | 31 | ## Our Responsibilities 32 | 33 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 34 | 35 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 36 | 37 | ## Scope 38 | 39 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 40 | 41 | ## Enforcement 42 | 43 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting us anonymously through [this form](https://goo.gl/forms/chVYUnA4bP70WGsL2). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. 44 | 45 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 46 | 47 | If you are unsure whether an incident is a violation, or whether the space where the incident took place is covered by our Code of Conduct, **we encourage you to still report it**. We would prefer to have a few extra reports where we decide to take no action, than to leave an incident go unnoticed and unresolved that may result in an individual or group to feel like they can no longer participate in the community. Reports deemed as not a violation will also allow us to improve our Code of Conduct and processes surrounding it. If you witness a dangerous situation or someone in distress, we encourage you to report even if you are only an observer. 48 | 49 | ## Attribution 50 | 51 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), [version 1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html). 52 | -------------------------------------------------------------------------------- /CSV to Excel/csv_excel.py: -------------------------------------------------------------------------------- 1 | import openpyxl 2 | import sys 3 | 4 | csv_name = input("Name of the input CSV file with extension: ") 5 | sep = input("Separator of the CSV file: ") 6 | ename = input("Name of the output excel file with extension: ") 7 | sname = input("Name of the output excel sheet: ") 8 | try: 9 | workbook = openpyxl.load_workbook(ename) 10 | sheet = workbook.get_sheet_by_name(sname) 11 | 12 | file = open(csv_name, "r", encoding="utf-8") 13 | except: 14 | print("Error: File not found") 15 | sys.exit() 16 | excel_row = 1 17 | excel_column = 1 18 | 19 | for lines in file: 20 | 21 | lines = lines[:-1] 22 | lines = lines.split(sep) 23 | 24 | for dat in lines: 25 | 26 | sheet.cell(excel_row, excel_column).value = dat 27 | 28 | excel_column += 1 29 | 30 | excel_column = 1 31 | excel_row += 1 32 | 33 | 34 | workbook.save(ename) 35 | file.close() 36 | 37 | csv_name = input("Name of the input CSV file with extension: ") 38 | sep = input("Separator of the CSV file: ") 39 | ename = input("Name of the output excel file with extension: ") 40 | sname = input("Name of the output excel sheet: ") 41 | try: 42 | workbook = openpyxl.load_workbook(ename) 43 | sheet = workbook.get_sheet_by_name(sname) 44 | 45 | file = open(csv_name, "r", encoding="utf-8") 46 | except: 47 | print("Error: File not found") 48 | sys.exit() 49 | excel_row = 1 50 | excel_column = 1 51 | 52 | for lines in file: 53 | 54 | lines = lines[:-1] 55 | lines = lines.split(sep) 56 | 57 | for dat in lines: 58 | 59 | sheet.cell(excel_row, excel_column).value = dat 60 | 61 | excel_column += 1 62 | 63 | excel_column = 1 64 | excel_row += 1 65 | 66 | 67 | workbook.save(ename) 68 | file.close() 69 | -------------------------------------------------------------------------------- /Cafe Management System/README.md: -------------------------------------------------------------------------------- 1 | # Cafe Management System 2 | 3 | - This is a cafe Management System Coded by Python using `tkinter` library. 4 | - You need to install `Pillow`by entering `pip install Pillow`. -------------------------------------------------------------------------------- /Cafe Management System/cafe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Cafe Management System/cafe.png -------------------------------------------------------------------------------- /Cafe Management System/false.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Cafe Management System/false.png -------------------------------------------------------------------------------- /Calculate Compound Interest/calculateCompoundInterest.py: -------------------------------------------------------------------------------- 1 | print('How many years will you be saving?') 2 | years = int(input('Enter years: ')) 3 | 4 | print('How much money is currently in your account?') 5 | principal = float(input('Enter current amount in account: ')) 6 | 7 | print ('How much money do you plan on investin monthly?') 8 | monthly_invest = float(input('Enter amount: ')) 9 | 10 | print ('What do you estimate will be the yearly interest of this investment?') 11 | interest = float(input ('Enter interest in decimal numbers (10% = 0.1): ')) 12 | print(' ' ) 13 | 14 | monthly_invest = monthly_invest * 12 15 | final_amount = 0 16 | 17 | for i in range(0, years): 18 | if final_amount == 0: 19 | final_amount = principal 20 | 21 | final_amount = (final_amount + monthly_invest) * (1 + interest) 22 | 23 | print("This is how much money you would have in your account after{} years: ".format (years) + str(final_amount)) 24 | -------------------------------------------------------------------------------- /Chess Board/ChessBoard.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import numpy as np 3 | from matplotlib.colors import LogNorm 4 | 5 | dx, dy = 0.015, 0.05 6 | #numpy.arrange returns evenly spaced values within a given interval 7 | x = np.arange(-04.0, 4.0, dx) 8 | y = np.arange(-04.0, 4.0, dy) 9 | #returns coordinate matrices from coordinate vectors 10 | X, Y = np.meshgrid(x, y) 11 | 12 | extent = np.min(x), np.max(x), np.min(y), np.max(y) 13 | 14 | Z1 = np.add.outer(range(8), range(8)) % 2 15 | 16 | plt.imshow(Z1, cmap="binary_r", interpolation="nearest", extent = extent, alpha=1) 17 | 18 | plt.title("Chess Board", fontweight="bold") 19 | 20 | plt.show() -------------------------------------------------------------------------------- /Chess Board/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | 10 | ## Script - Chessboard 11 | 12 | Create a chesboard using matplotlib 13 | ChessBoard.py 14 | 15 | 16 | -------------------------------------------------------------------------------- /Contributions.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via issue, with the maintainers of this repository before making a change. 4 | 5 | First time contributers can refer to various resources on how 6 | to make their first contribution, one which we would refer is [this.][first] 7 | 8 | Please note we have a code of conduct, please follow it in all your interactions with the project. 9 | 10 | ## Pull Request Process 11 | 12 | 1. Create an issue and fork the repository, add a new folder with a name that describes your script in short. You'll place your Python script(s) in there. 13 | 2. Add a `README.md` in that file which explains your script 14 | and any prerequisites it may have. 15 | 3. Update the main `README.md`, adding your script to the List of Scripts in Repo, providing the script's name, a link to it, and a brief description. 16 | 4. Mention the issue you made in 1) in your Pull Request, which will be then verified and merged accordingly. 17 | 5. Ensure any install or build dependencies are removed before the end of the layer when doing a build. 18 | 19 | --- 20 | ## Code of Conduct 21 | 22 | ### Our Pledge 23 | 24 | In the interest of fostering an open and welcoming environment, we as 25 | contributors and maintainers pledge to making participation in our project and 26 | our community a harassment-free experience for everyone, regardless of age, body 27 | size, disability, ethnicity, gender identity and expression, level of experience, 28 | nationality, personal appearance, race, religion, or sexual identity and 29 | orientation. 30 | 31 | ### Our Standards 32 | 33 | Examples of behavior that contributes to creating a positive environment 34 | include: 35 | 36 | * Using welcoming and inclusive language 37 | * Being respectful of differing viewpoints and experiences 38 | * Gracefully accepting constructive criticism 39 | * Focusing on what is best for the community 40 | * Showing empathy towards other community members 41 | 42 | Examples of unacceptable behavior by participants include: 43 | 44 | * The use of sexualized language or imagery and unwelcome sexual attention or 45 | advances 46 | * Trolling, insulting/derogatory comments, and personal or political attacks 47 | * Public or private harassment 48 | * Publishing others' private information, such as a physical or electronic 49 | address, without explicit permission 50 | * Other conduct which could reasonably be considered inappropriate in a 51 | professional setting 52 | 53 | ### Our Responsibilities 54 | 55 | Project maintainers are responsible for clarifying the standards of acceptable 56 | behavior and are expected to take appropriate and fair corrective action in 57 | response to any instances of unacceptable behavior. 58 | 59 | Project maintainers have the right and responsibility to remove, edit, or 60 | reject comments, commits, code, wiki edits, issues, and other contributions 61 | that are not aligned to this Code of Conduct, or to ban temporarily or 62 | permanently any contributor for other behaviors that they deem inappropriate, 63 | threatening, offensive, or harmful. 64 | 65 | ### Scope 66 | 67 | This Code of Conduct applies both within project spaces and in public spaces 68 | when an individual is representing the project or its community. Examples of 69 | representing a project or community include using an official project e-mail 70 | address, posting via an official social media account, or acting as an appointed 71 | representative at an online or offline event. Representation of a project may be 72 | further defined and clarified by project maintainers. 73 | 74 | ### Enforcement 75 | 76 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 77 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All 78 | complaints will be reviewed and investigated and will result in a response that 79 | is deemed necessary and appropriate to the circumstances. The project team is 80 | obligated to maintain confidentiality with regard to the reporter of an incident. 81 | Further details of specific enforcement policies may be posted separately. 82 | 83 | Project maintainers who do not follow or enforce the Code of Conduct in good 84 | faith may face temporary or permanent repercussions as determined by other 85 | members of the project's leadership. 86 | 87 | ### Attribution 88 | 89 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 90 | available [here.][version] 91 | 92 | [homepage]: http://contributor-covenant.org 93 | [version]: http://contributor-covenant.org/version/1/4/ 94 | [first]: https://dev.to/diballesteros/step-by-step-guide-for-the-first-time-open-source-contribution-48bo 95 | -------------------------------------------------------------------------------- /Countdown Timer/README.md: -------------------------------------------------------------------------------- 1 | # Countdown Timer 2 | 3 | This program takes in the number of seconds to countdown and displays a message when the time elapses. 4 | 5 | # Prerequisites 6 | 7 | It requires no prerequisites, you only need to run the script. If you don't have Python installed, you can visit [here](https://www.python.org/downloads/) to download Python. 8 | 9 | # How to run the script 10 | 11 | Running the script is pretty easy, open a terminal in the folder where your script is located and run the following command : 12 | 13 | `python timer.py` 14 | 15 | # Author's name 16 | 17 | [KOTHA V V S AAKASH](https://github.com/AakashKotha) 18 | -------------------------------------------------------------------------------- /Countdown Timer/timer.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | def countdownTimer(): 4 | # get the number of seconds 5 | no_of_secs = int(input('How many seconds?: ')) 6 | while no_of_secs: 7 | if no_of_secs < 60: 8 | # calculate the number of hours, minutes and seconds 9 | hrs = no_of_secs // 3600 10 | mins = no_of_secs // 60 11 | secs = no_of_secs % 60 12 | # format the hours, minutes 13 | # and seconds to be displayed 14 | timer = '%02d:%02d:%02d' %(hrs, mins, secs) 15 | print(timer, end='\r') 16 | # delay execution of code by one second 17 | time.sleep(1) 18 | # countdown the number of seconds 19 | no_of_secs -= 1 20 | elif 60 <= no_of_secs < 3600: 21 | # calculate the number of hours, minutes and seconds 22 | hrs = no_of_secs // 3600 23 | mins = no_of_secs // 60 24 | secs = no_of_secs % 60 25 | # format the hours, minutes 26 | # and seconds to be displayed 27 | timer = '%02d:%02d:%02d' %(hrs, mins, secs) 28 | print(timer, end='\r') 29 | # delay execution of code by one second 30 | time.sleep(1) 31 | # countdown the number of seconds 32 | no_of_secs -= 1 33 | elif 3600 <= no_of_secs <= 86400: 34 | # calculate the number of hours, minutes and seconds 35 | hrs = no_of_secs // 3600 36 | mins = (no_of_secs % 3600) // 60 37 | secs = (no_of_secs % 3600) % 60 38 | # format the hours, minutes 39 | # and seconds to be displayed 40 | timer = '%02d:%02d:%02d' %(hrs, mins, secs) 41 | print(timer, end='\r') 42 | # delay execution of code by one second 43 | time.sleep(1) 44 | # countdown the number of seconds 45 | no_of_secs -= 1 46 | print('Time Up!') 47 | 48 | countdownTimer() 49 | -------------------------------------------------------------------------------- /Crop Images/README.md: -------------------------------------------------------------------------------- 1 | Crop the image: 2 | This script will crop the given image. 3 | 4 | Prerequisites 5 | Libraries: Pillow(PIL) 6 | 7 | How to run the script: 8 | Run in terminal {python3 crop.py} 9 | 10 | Screenshot/GIF showing the sample use of the script: 11 | Added in the same folder 12 | 13 | Author Name: 14 | Git Username: G0V1NDK -------------------------------------------------------------------------------- /Crop Images/crop.py: -------------------------------------------------------------------------------- 1 | #imports 2 | from PIL import Image 3 | 4 | #image to be inserted 5 | img=Image.open("icon.png") 6 | #edit the dimension of the image 7 | dimension=(300,100,500,200) 8 | cropImg=img.crop(box=dimension) 9 | #This will show the image 10 | cropImg.show() -------------------------------------------------------------------------------- /Crop Images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Crop Images/icon.png -------------------------------------------------------------------------------- /Crop Images/output screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Crop Images/output screenshot.png -------------------------------------------------------------------------------- /Currency Script/currency.py: -------------------------------------------------------------------------------- 1 | # Python program to convert the currency 2 | # of one country to that of another country 3 | 4 | # Import the modules needed 5 | import requests 6 | 7 | class Currency_convertor: 8 | # empty dict to store the conversion rates 9 | rates = {} 10 | def __init__(self, url): 11 | data = requests.get(url).json() 12 | 13 | # Extracting only the rates from the json data 14 | self.rates = data["rates"] 15 | 16 | # function to do a simple cross multiplication between 17 | # the amount and the conversion rates 18 | def convert(self, from_currency, to_currency, amount): 19 | initial_amount = amount 20 | if from_currency != 'EUR' : 21 | amount = amount / self.rates[from_currency] 22 | 23 | # limiting the precision to 2 decimal places 24 | amount = round(amount * self.rates[to_currency], 2) 25 | print('{} {} = {} {}'.format(initial_amount, from_currency, amount, to_currency)) 26 | 27 | # Driver code 28 | if __name__ == "__main__": 29 | 30 | # YOUR_ACCESS_KEY = 'GET YOUR ACCESS KEY FROM fixer.io' 31 | url = str.__add__('http://data.fixer.io/api/latest?access_key=', YOUR_ACCESS_KEY) 32 | c = Currency_convertor(url) 33 | from_country = input("From Country: ") 34 | to_country = input("TO Country: ") 35 | amount = int(input("Amount: ")) 36 | 37 | c.convert(from_country, to_country, amount) 38 | -------------------------------------------------------------------------------- /Currency Script/currency_calculator.py: -------------------------------------------------------------------------------- 1 | from locale import currency 2 | import requests 3 | import json 4 | 5 | currency = input().lower() 6 | cache = {} 7 | 8 | while True: 9 | 10 | currency_exch = input().lower() 11 | 12 | if currency_exch == '': 13 | break 14 | 15 | amount_to_exch = int(input()) 16 | 17 | URL = f'http://www.floatrates.com/daily/{currency}.json' 18 | 19 | exch = json.loads(requests.get(URL).text) 20 | 21 | if currency == 'usd': 22 | cache.update(eur=exch['eur']['rate']) 23 | elif currency == 'eur': 24 | cache.update(usd=exch['usd']['rate']) 25 | else: 26 | cache.update(usd=exch['usd']['rate'], eur=exch['eur']['rate']) 27 | 28 | print("Checking the cache...") 29 | if currency_exch in cache: 30 | rate = round(amount_to_exch * cache[currency_exch], 2) 31 | print("Oh! It is in the cache!") 32 | print(f"You received {rate} {currency_exch.upper()}.") 33 | else: 34 | #print("Sorry, but it is not in the cache!") 35 | cache[currency_exch] = exch[currency_exch]['rate'] 36 | rate = round(amount_to_exch * cache[currency_exch], 2) 37 | print(f"You received {rate} {currency_exch.upper()}.") 38 | -------------------------------------------------------------------------------- /Digital Clock/DigitalClock.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | from time import strftime 3 | 4 | top = tkinter.Tk() 5 | top.title('Digital Clock') 6 | # 0,0 makes the window non-resizable 7 | top.resizable(0,0) 8 | 9 | def time(): 10 | # %p defines AM or PM 11 | string = strftime('%H: %M: %S %p') 12 | clockTime.config(text=string) 13 | clockTime.after(1000, time) 14 | 15 | clockTime = tkinter.Label(top, font=('courier new', 40), 16 | background='red',foreground='black') 17 | clockTime.pack(anchor='center') 18 | time() 19 | top.mainloop() -------------------------------------------------------------------------------- /Digital Clock/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | ## Script - Digital Clock 10 | 11 | DigitalClock.py 12 | -------------------------------------------------------------------------------- /Display Popup Window/DisplayPopupWindow.bat: -------------------------------------------------------------------------------- 1 | REM This is a comment 2 | cd "< file path >" 3 | python DisplayPopupWindow.py 4 | ECHO Ran first batch 5 | PAUSE -------------------------------------------------------------------------------- /Display Popup Window/DisplayPopupWindow.py: -------------------------------------------------------------------------------- 1 | # !/usr/bin/python3 2 | import tkinter 3 | from PIL import ImageTk, Image as image 4 | 5 | window = tkinter.Tk() 6 | window.title("Dhanush Automated Script") 7 | text = tkinter.Label(window, text = " Time to Walk !!! ", 8 | bg="#0a8ca6", 9 | fg="#8c180b", 10 | font="<> 20", 11 | pady=70, 12 | padx=70 13 | ) 14 | text.pack(); 15 | 16 | #Get height & weight 17 | windowWidth = window.winfo_reqwidth() 18 | windowHeight = window.winfo_reqheight() 19 | 20 | # Get half of screen width & height 21 | positionRight = int(window.winfo_screenwidth()/2 - windowWidth/2) 22 | positionDown = int(window.winfo_screenheight()/2 - windowHeight/2) 23 | 24 | window.geometry("+{}+{}".format(positionRight, positionDown)) 25 | 26 | window.configure(bg="#db7c23") 27 | 28 | window.mainloop() -------------------------------------------------------------------------------- /Display Popup Window/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | 10 | ## Script - Popup Window 11 | 12 | Displaying a popup window 13 | DisplayPopupWindow.py 14 | 15 | -------------------------------------------------------------------------------- /Duplicate Finder/Readme.md: -------------------------------------------------------------------------------- 1 | # Duplicate Finder Script 2 | 3 | This script scans a given directory for duplicate files based on their MD5 hash. It provides options to delete or move the duplicate files to another directory. 4 | 5 | ## Features 6 | 7 | - Scan a directory recursively for duplicate files. 8 | - Filter files by minimum size. 9 | - Display a list of duplicate files. 10 | - Option to delete or move the duplicate files. 11 | 12 | ## Usage 13 | 14 | 1. Run the script. 15 | 2. Enter the directory you want to scan for duplicates. 16 | 3. Specify the minimum file size to consider (in bytes). By default, it's set to 0, which means all files will be considered. 17 | 4. The script will display a list of duplicate files, if any. 18 | 5. Choose an action: 19 | - `(D)elete`: Deletes all but one of each set of duplicate files. 20 | - `(M)ove`: Moves all but one of each set of duplicate files to another directory. 21 | - `(N)o action`: Exits the script without making any changes. 22 | 23 | ## Notes 24 | 25 | - When choosing the delete option, the script keeps the first file it encounters and deletes the rest of the duplicates. 26 | - When choosing the move option, the script keeps the first file it encounters and moves the rest to the specified directory. If the target directory doesn't exist, it will be created. 27 | - The script uses MD5 hashing to identify duplicates. While MD5 is fast, it's not the most secure hashing algorithm. There's a very low probability of hash collisions (different files having the same hash), but it's something to be aware of. 28 | 29 | 30 | ## Disclaimer 31 | 32 | Always backup your data before using scripts that modify files. The author is not responsible for any data loss. 33 | 34 | -------------------------------------------------------------------------------- /Duplicate Finder/duplicate-finder.py: -------------------------------------------------------------------------------- 1 | import os 2 | import hashlib 3 | 4 | def get_file_hash(filepath): 5 | """Return the MD5 hash of a file.""" 6 | hasher = hashlib.md5() 7 | with open(filepath, 'rb') as f: 8 | buf = f.read() 9 | hasher.update(buf) 10 | return hasher.hexdigest() 11 | 12 | def find_duplicates(directory, min_size=0): 13 | """Find duplicate files in a directory.""" 14 | hashes = {} 15 | duplicates = {} 16 | 17 | for dirpath, dirnames, filenames in os.walk(directory): 18 | for filename in filenames: 19 | filepath = os.path.join(dirpath, filename) 20 | if os.path.getsize(filepath) >= min_size: 21 | file_hash = get_file_hash(filepath) 22 | if file_hash in hashes: 23 | duplicates.setdefault(file_hash, []).append(filepath) 24 | # Also ensure the original file is in the duplicates list 25 | if hashes[file_hash] not in duplicates[file_hash]: 26 | duplicates[file_hash].append(hashes[file_hash]) 27 | else: 28 | hashes[file_hash] = filepath 29 | 30 | return {k: v for k, v in duplicates.items() if len(v) > 1} 31 | 32 | def main(): 33 | directory = input("Enter the directory to scan for duplicates: ") 34 | min_size = int(input("Enter the minimum file size to consider (in bytes, default is 0): ") or "0") 35 | 36 | duplicates = find_duplicates(directory, min_size) 37 | 38 | if not duplicates: 39 | print("No duplicates found.") 40 | return 41 | 42 | print("\nDuplicates found:") 43 | for _, paths in duplicates.items(): 44 | for path in paths: 45 | print(path) 46 | print("------") 47 | 48 | action = input("\nChoose an action: (D)elete, (M)ove, (N)o action: ").lower() 49 | 50 | if action == "d": 51 | for _, paths in duplicates.items(): 52 | for path in paths[1:]: # Keep the first file, delete the rest 53 | os.remove(path) 54 | print(f"Deleted {path}") 55 | 56 | elif action == "m": 57 | target_dir = input("Enter the directory to move duplicates to: ") 58 | if not os.path.exists(target_dir): 59 | os.makedirs(target_dir) 60 | 61 | for _, paths in duplicates.items(): 62 | for path in paths[1:]: # Keep the first file, move the rest 63 | target_path = os.path.join(target_dir, os.path.basename(path)) 64 | os.rename(path, target_path) 65 | print(f"Moved {path} to {target_path}") 66 | 67 | else: 68 | print("No action taken.") 69 | 70 | if __name__ == "__main__": 71 | main() 72 | -------------------------------------------------------------------------------- /Expense Tracker/README.md: -------------------------------------------------------------------------------- 1 | ## Expense tracker 2 | 3 | ### Usage 4 | 5 | Install the required dependencies using pip: 6 | 7 | ``` 8 | pip install -r requirements.txt 9 | ``` 10 | 11 | Run the expense.py file to start the bot: 12 | 13 | ``` 14 | python expense.py 15 | ``` 16 | -------------------------------------------------------------------------------- /Expense Tracker/expense.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import os 3 | 4 | CSV_FILE = "expenses.csv" 5 | 6 | def initialize_csv(): 7 | if not os.path.exists(CSV_FILE): 8 | with open(CSV_FILE, "w", newline="") as file: 9 | writer = csv.writer(file) 10 | writer.writerow(["Date", "Description", "Amount"]) 11 | 12 | def add_expense(date, description, amount): 13 | with open(CSV_FILE, "a", newline="") as file: 14 | writer = csv.writer(file) 15 | writer.writerow([date, description, amount]) 16 | 17 | def view_expenses(): 18 | with open(CSV_FILE, "r") as file: 19 | reader = csv.reader(file) 20 | for row in reader: 21 | print(", ".join(row)) 22 | 23 | if __name__ == "__main__": 24 | initialize_csv() 25 | 26 | while True: 27 | print("\nExpense Tracker Menu:") 28 | print("1. Add Expense") 29 | print("2. View Expenses") 30 | print("3. Exit") 31 | 32 | choice = input("Enter your choice: ") 33 | 34 | if choice == "1": 35 | date = input("Enter the date (YYYY-MM-DD): ") 36 | description = input("Enter the description: ") 37 | amount = input("Enter the amount: ") 38 | 39 | add_expense(date, description, amount) 40 | print("Expense added successfully!") 41 | 42 | elif choice == "2": 43 | print("Expenses:") 44 | view_expenses() 45 | 46 | elif choice == "3": 47 | break 48 | 49 | else: 50 | print("Invalid choice. Please try again.") 51 | -------------------------------------------------------------------------------- /Expense Tracker/requirements.txt: -------------------------------------------------------------------------------- 1 | csv 2 | os 3 | -------------------------------------------------------------------------------- /Face Reaction/app.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | from fer import FER 4 | 5 | scr = cv2.VideoCapture(0) #30fps 6 | scr.set(3, 640) 7 | scr.set(4, 480) 8 | 9 | #init FRE (Facial expression recognition from images) 10 | detector = FER(mtcnn=True) 11 | 12 | while True: 13 | 14 | ret,frame = scr.read() 15 | # frame = cv2.flip(frame,1) 16 | 17 | #return emotion name and % of true detection 18 | emotion, score = detector.top_emotion(frame) 19 | 20 | print(emotion,score) 21 | if emotion == 'angry': 22 | emoj = cv2.imread('https://i.ibb.co/QN0gqNH/angry.png') 23 | elif emotion == 'disgust': 24 | emoj = cv2.imread('https://i.ibb.co/tJDxrhD/disgust.png') 25 | elif emotion == 'fear': 26 | emoj = cv2.imread('https://i.ibb.co/yBczSFB/fear.png') 27 | elif emotion == 'happy': 28 | emoj = cv2.imread('https://i.ibb.co/g6DW0Cf/happy.png') 29 | elif emotion == 'sad': 30 | emoj = cv2.imread('https://i.ibb.co/NyF0sDq/sad.png') 31 | elif emotion == 'surprise': 32 | emoj = cv2.imread('https://i.ibb.co/D4rDyfM/surprise.png') 33 | elif emotion == 'neutral': 34 | emoj = cv2.imread('https://i.ibb.co/KX7VSjh/neutral.png') 35 | else: 36 | emoj = cv2.imread('https://i.ibb.co/LdnS9nL/none.png') 37 | 38 | 39 | #Adding Image on Screen 40 | 41 | # Read emoj and resize 42 | size = 150 43 | emoj = cv2.resize(emoj, (size, size)) 44 | 45 | # Create a mask of emoj 46 | img2gray = cv2.cvtColor(emoj, cv2.COLOR_BGR2GRAY) 47 | ret, mask = cv2.threshold(img2gray, 1, 255, cv2.THRESH_BINARY) 48 | 49 | roi = frame[-size-20:-20, -size-20:-20] 50 | # roi = frame[-size-310:-310, -size-470:-470] 51 | # Set an index of where the mask is 52 | roi[np.where(mask)] = 0 53 | roi += emoj 54 | 55 | 56 | #add text 57 | font = cv2.FONT_HERSHEY_SIMPLEX 58 | org = (40, 210) 59 | fontScale = 1 60 | color = (255, 0, 0) 61 | thickness = 2 62 | cv2.putText(frame,emotion, org, font, fontScale, color, thickness, cv2.LINE_AA) 63 | 64 | #show screen 65 | cv2.imshow('frame',frame) 66 | 67 | #stop 68 | if cv2.waitKey(1) & 0xff == ord('q'): 69 | break 70 | 71 | scr.release() 72 | 73 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Fake Profile/FakeProfile.py: -------------------------------------------------------------------------------- 1 | from faker import Faker 2 | fake = Faker(['it_IT', 'en_US', 'ja_JP']) 3 | print("### ALL faker Attribute") 4 | print(dir(fake)) 5 | 6 | profile = """ 7 | ### Faker Profile ### 8 | Name : {} 9 | Email : {} 10 | Social Security number (SSN) : {} 11 | Address : {} 12 | Location : {}, {} 13 | URL : {} 14 | """.format(fake.name(), 15 | fake.email(), 16 | fake.ssn(), 17 | fake.address(), 18 | fake.latitude(), fake.longitude(), 19 | fake.url() 20 | ) 21 | 22 | print(profile) 23 | -------------------------------------------------------------------------------- /Fake Profile/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Scripts 8 | 9 | 10 | ## Script - Fake Profiles 11 | 12 | Get many fake profiles using python 13 | FakeProfile.py 14 | 15 | -------------------------------------------------------------------------------- /File Encryption Decryption/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | 10 | ## Script - File Encryption Decryption 11 | 12 | Developed File Encryption Decryption Simple Algorithm using python pyAedCrypt module 13 | Files can be encrypted using desired password. 14 | fileEncryptDecrypt.py 15 | 16 | 17 | -------------------------------------------------------------------------------- /File Encryption Decryption/fileEncryptDecrypt.py: -------------------------------------------------------------------------------- 1 | # This is code for File Encryption Decryption Using AES Algorithms 2 | 3 | # Advanced Encryption Standard (AES) is a specification for the encryption of electronic data established by the U.S National Institute of Standards and Technology (NIST) in 2001. AES is widely used today as it is a much stronger than DES and triple DES despite being harder to implement. 4 | 5 | # pyAesCrypt is a file encryption module that uses AES256-CBC to encrypt/decrypt files and binary streams. Install pyAesCrypt as follows: pip3 install pyAesCrypt. 6 | 7 | # pip install pyAesCrypt 8 | 9 | import pyAesCrypt 10 | import sys 11 | 12 | def encryptFile(filename, password): 13 | pyAesCrypt.encryptFile(filename, filename + ".aes", password) 14 | print("File Encryption successfully done.") 15 | 16 | def decryptFile(filename, password): 17 | pyAesCrypt.decryptFile(filename + ".aes", filename, password) 18 | print("File Decryption successfully done.") 19 | 20 | 21 | # Enter the file in the argument and password also 22 | 23 | encryptFile(sys.argv[0], sys.argv[1]) 24 | decryptFile(sys.argv[0], sys.argv[1]) -------------------------------------------------------------------------------- /File Encryption Decryption/krishna.txt: -------------------------------------------------------------------------------- 1 | Hare krishna -------------------------------------------------------------------------------- /Font Art/FontArt.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pyfiglet import Figlet 3 | text = Figlet(font="slant") 4 | os.system("cls") 5 | os.system("mode con: cols=75 lines=30") 6 | print(text.renderText("Dhanush N")) -------------------------------------------------------------------------------- /Font Art/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Scripts 8 | 9 | ## Script - Font Art 10 | 11 | Display a font art using python 12 | FontArt.py 13 | -------------------------------------------------------------------------------- /Fractal tree/README.md: -------------------------------------------------------------------------------- 1 | # Fractal trees in python 2 | -------------------------------------------------------------------------------- /Fractal tree/fractaltree.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | bruh = turtle.Turtle() 3 | bruh.left(90) 4 | bruh.speed('fastest') 5 | 6 | bruh.hideturtle() 7 | bruh.penup() 8 | bruh.goto(0, -450) 9 | bruh.pendown() 10 | 11 | 12 | 13 | 14 | def tree(i): 15 | if i < 5: 16 | return 17 | else: 18 | bruh.forward(i) 19 | bruh.left(30) 20 | tree(3 * i/4) 21 | bruh.right(60) 22 | tree(3 * i/4) 23 | bruh.left(30) 24 | bruh.backward(i) 25 | 26 | 27 | tree(250) 28 | 29 | turtle.done() -------------------------------------------------------------------------------- /Get Hexcodes From Websites/README.md: -------------------------------------------------------------------------------- 1 | This tools allows you to get a python list formated colors.txt file containing most of the colors(*Hexcodes*) that the website had. 2 | 3 | To use the tool you will need to import bs4 library by doing 4 | *pip install bs4* -------------------------------------------------------------------------------- /Get Hexcodes From Websites/getColoursFromWeb.py: -------------------------------------------------------------------------------- 1 | # import necessary libraries 2 | from bs4 import BeautifulSoup 3 | import requests 4 | 5 | 6 | # function to extract html document from given url 7 | def getHTMLdocument(url): 8 | 9 | # request for HTML document of given url 10 | response = requests.get(url) 11 | 12 | if(response.status_code == 200): 13 | # return HTML document 14 | return response.text 15 | else: 16 | # return None 17 | raise Exception("Invalid URL or Check your internet connection") 18 | 19 | 20 | # assign required credentials 21 | # assign URL 22 | url_to_scrape = input("Enter the URL to be Scraped: ") 23 | 24 | # create document 25 | html_document = getHTMLdocument(url_to_scrape) 26 | 27 | # create soap object 28 | soup = BeautifulSoup(html_document, 'html.parser') 29 | 30 | def getHash(link): 31 | s = '' 32 | i = 0 33 | n = len(link) 34 | while(i < n): 35 | if(link[i] == '#'): 36 | s += link[i:i+7] 37 | i += 1 38 | return s 39 | 40 | # find all the anchor tags with "href" 41 | # attribute starting with "https://" 42 | 43 | l = set() 44 | 45 | for link in soup.find_all('td'): 46 | s = getHash(str(link)) 47 | if s != '': 48 | l.add(s.lower()) 49 | file = open('colors.txt', 'a') 50 | file.write('[') 51 | for i in l: 52 | file.write("'"+i+"',") 53 | file.write(']') 54 | file.close() 55 | -------------------------------------------------------------------------------- /HTML to Images/README.md: -------------------------------------------------------------------------------- 1 | This python script is used for converting HTML documents to image files. 2 | 3 | This script requires that the html2image package is installed. 4 | 5 | Images will be stored in the same folder the script is in. 6 | 7 | Example use: 8 | >Enter the directory of your html file: ./test.html 9 | >Enter the name of your image including file format: out.jpg 10 | >(OPTIONAL) Enter the background color you would like: grey -------------------------------------------------------------------------------- /HTML to Images/html-to-images.py: -------------------------------------------------------------------------------- 1 | from html2image import Html2Image 2 | 3 | hti = Html2Image() 4 | 5 | file = str(input('Enter the directory of your html file: ')) 6 | img = str(input('Enter the name of your image including file format: ')) 7 | background = str(input('(OPTIONAL) Enter the background color you would like: ')) 8 | if len(background)>0: 9 | css = ('body {background: %s;}' % (background)) 10 | with open(file, errors='ignore') as f: 11 | hti.screenshot(f.read(), css_str=css, save_as=img) 12 | else: 13 | with open(file, errors='ignore') as f: 14 | hti.screenshot(f.read(), save_as=img) -------------------------------------------------------------------------------- /Hand Volume/handTrackingModule.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import mediapipe as mp 3 | import time 4 | 5 | 6 | class handDetector(): 7 | def __init__(self, mode=False, maxHands=2, detectionCon=0.5, trackCon=0.5): 8 | self.mode = mode 9 | self.maxHands = maxHands 10 | self.detectionCon = detectionCon 11 | self.trackCon = trackCon 12 | 13 | self.mpHands = mp.solutions.hands 14 | self.hands = self.mpHands.Hands(self.mode, self.maxHands, 15 | self.detectionCon, self.trackCon) 16 | self.mpDraw = mp.solutions.drawing_utils 17 | 18 | def findHands(self, img, draw=True): 19 | imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) 20 | self.results = self.hands.process(imgRGB) 21 | #print(results.multi_hand_landmarks) 22 | 23 | if self.results.multi_hand_landmarks: 24 | for handLms in self.results.multi_hand_landmarks: 25 | if draw: 26 | self.mpDraw.draw_landmarks(img, handLms, 27 | self.mpHands.HAND_CONNECTIONS) 28 | return img 29 | 30 | def findPosition(self, img, handNo=0, draw=True): 31 | 32 | lmList = [] 33 | if self.results.multi_hand_landmarks: 34 | myHand = self.results.multi_hand_landmarks[handNo] 35 | for id, lm in enumerate(myHand.landmark): 36 | # print(id, lm) 37 | h, w, c = img.shape 38 | cx, cy = int(lm.x * w), int(lm.y * h) 39 | # print(id, cx, cy) 40 | lmList.append([id, cx, cy]) 41 | if draw: 42 | cv2.circle(img, (cx, cy), 15, (255, 0, 255), cv2.FILLED) 43 | 44 | return lmList 45 | 46 | 47 | def main(): 48 | pTime = 0 49 | cTime = 0 50 | cap = cv2.VideoCapture(0) 51 | detector = handDetector() 52 | while True: 53 | success, img = cap.read() 54 | img = detector.findHands(img) 55 | lmList = detector.findPosition(img) 56 | if len(lmList) != 0: 57 | print(lmList[4]) 58 | 59 | cTime = time.time() 60 | fps = (float(1.0) / float((cTime - pTime))) 61 | pTime = cTime 62 | 63 | cv2.putText(img, str(int(fps)), (10, 70), cv2.FONT_HERSHEY_PLAIN, 3, 64 | (255, 0, 255), 3) 65 | 66 | cv2.imshow("Image", img) 67 | cv2.waitKey(1) 68 | 69 | 70 | if __name__ == "__main__": 71 | main() -------------------------------------------------------------------------------- /Harvest Predictor/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn flask_app:app 2 | -------------------------------------------------------------------------------- /Harvest Predictor/README.md: -------------------------------------------------------------------------------- 1 | # Harvest Predictor 2 | 3 | Paddy Harvest Prediction using linear regression machine learning algorithm with html and css frontend with flask backend 4 | 5 | to run open the terminal from the directory and run `flask run app.py` -------------------------------------------------------------------------------- /Harvest Predictor/app.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from flask import Flask, request, jsonify, render_template 3 | import pickle 4 | 5 | 6 | flask_app = Flask(__name__) 7 | model = pickle.load(open("model_pickle", "rb")) 8 | 9 | 10 | @flask_app.route("/") 11 | def Home(): 12 | background_image = "static/101608227-paddy-field.jpg" 13 | return render_template("index.html", background_image=background_image) 14 | 15 | 16 | @flask_app.route("/predict", methods=["POST"]) 17 | def predict(): 18 | float_features = [float(x) for x in request.form.values()] 19 | features = [np.array(float_features)] 20 | prediction = model.predict(features) 21 | return render_template("index.html", prediction_text=" {}".format(prediction)) 22 | 23 | 24 | if __name__ == "__main__": 25 | flask_app.run(debug=True,host='0.0.0.0') 26 | -------------------------------------------------------------------------------- /Harvest Predictor/model_pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Harvest Predictor/model_pickle -------------------------------------------------------------------------------- /Harvest Predictor/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==2.2.5 2 | numpy==1.22.0 3 | 4 | gunicorn==20.0.4 5 | Werkzeug==2.2.3 6 | Jinja2==2.11.3 7 | itsdangerous==1.1.0 8 | MarkupSafe==1.1.1 9 | -------------------------------------------------------------------------------- /Harvest Predictor/static/101608227-paddy-field.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Harvest Predictor/static/101608227-paddy-field.jpg -------------------------------------------------------------------------------- /IP Geolocator/main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | URL="http://ip-api.com/json/" 3 | def locate(IP): 4 | r = requests.get(URL+IP).json() 5 | if(r["status"] == "success"): 6 | print("Successfully Located :",IP) 7 | print("Country: ", r["country"]) 8 | print("Region: ", r["regionName"]) 9 | print("City: ", r["city"]) 10 | print("ZIP: ", r["zip"]) 11 | print("Latitude: ", r["lat"]) 12 | print("Longitude: ", r["lon"]) 13 | print("Timezone: ", r["timezone"]) 14 | print("ISP: ", r["isp"]) 15 | else: 16 | print("Error! Please try again.") 17 | IP=input("Enter IP Address To Geolocate: ") 18 | locate(IP) 19 | 20 | -------------------------------------------------------------------------------- /Image Capture/README.md: -------------------------------------------------------------------------------- 1 | This python script is used for taking images from your webcam and saving it on your local device. Path to the folder can be specified using the following command: 2 | 3 | > python3 take_pictures_from_webcam.py --directory pathname 4 | 5 | The default path would be your current directory. 6 | 7 | You can also give name to your image using following command: 8 | > python3 take_pictures_from_webcam.py --name ImageName 9 | -------------------------------------------------------------------------------- /Image Capture/take_pictures_from_webcam.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import cv2 4 | import click 5 | import os 6 | 7 | @click.command() 8 | @click.option( 9 | "--directory", default="None", help="Directory in which to store frames" 10 | ) 11 | @click.option( 12 | "--name", default="person", help="Directory in which to store frames" 13 | ) 14 | def main(name, directory): 15 | if directory=="None": 16 | directory = os.getcwd() 17 | capture = cv2.VideoCapture(0) 18 | frame_count = 0 19 | while True: 20 | ret, frame = capture.read() 21 | frame = cv2.resize(frame, (600,600)) 22 | cv2.imshow("frame", frame) 23 | key = cv2.waitKey(50) 24 | if key & 0xFF == ord("q"): 25 | cv2.destroyAllWindows() 26 | break 27 | if key & 0xFF == ord(" "): 28 | cv2.imwrite(f"{directory}/{name+str(frame_count)}.jpg", frame) 29 | print(f"got {name+str(frame_count)}" ) 30 | frame_count += 1 31 | 32 | 33 | if __name__ == "__main__": 34 | main() 35 | -------------------------------------------------------------------------------- /Image Compress/compressor.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | file_path = "path_of_image" 3 | img = Image.open(file_path) 4 | height, width = img.size 5 | compressed = img.resize((height, width), Image.ANTIALIAS) 6 | compressed.save("compressedImage.jpg", optimize=True, quality=9) 7 | -------------------------------------------------------------------------------- /Image Manipulation without libraries/README.md: -------------------------------------------------------------------------------- 1 | Image-Manipulation-using-Python-without-external-libraries 2 | --- 3 | Image manipulation techniques in Python without using external libraries like OpenCV, Pillow, etc 4 | 5 | Includes the following manipulations: 6 | 7 | - Channel-wise Addition 8 | - Invert Colors 9 | - Mirror Vertical 10 | - Mirror Horizontal 11 | - Blur(2 methods) 12 | - Resize 13 | - Lightness 14 | - Brightness 15 | - Contrast 16 | -------------------------------------------------------------------------------- /Image Manipulation without libraries/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Image Manipulation without libraries/sample.jpg -------------------------------------------------------------------------------- /Image Text to PDF/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Image Text to PDF/img.jpg -------------------------------------------------------------------------------- /Image Text to PDF/input.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Image Text to PDF/input.txt -------------------------------------------------------------------------------- /Image Text to PDF/readme.md: -------------------------------------------------------------------------------- 1 | ## About: 2 | This script adds image and text to a pdf file. 3 | 4 | ## Prerequisites 5 | Libraries: reportlab 6 | 7 | #### Install : 8 | ```console 9 | pip install reportlab 10 | ``` 11 | 12 | ## How to use: 13 | 14 | * Replace img.jpg with the image you want to add. 15 | * Add your text inside input.txt. 16 | * Run in terminal 17 | 18 | ```console 19 | python3 script.py 20 | ``` 21 | * Hurray!! Your PDF is generated. 22 | -------------------------------------------------------------------------------- /Image Text to PDF/script.py: -------------------------------------------------------------------------------- 1 | from reportlab.lib.enums import TA_JUSTIFY 2 | from reportlab.lib.pagesizes import letter 3 | from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image 4 | from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle 5 | from reportlab.lib.units import inch 6 | 7 | context=[] 8 | img="img.jpg" 9 | 10 | doc = SimpleDocTemplate("result.pdf",pagesize=letter, 11 | rightMargin=72,leftMargin=72, 12 | topMargin=72,bottomMargin=18) 13 | 14 | 15 | im = Image(img, 2*inch, 2*inch) 16 | context.append(im) 17 | 18 | context.append(Spacer(3, 20)) 19 | 20 | 21 | styles=getSampleStyleSheet() 22 | styles.add(ParagraphStyle(name='Justify', alignment=TA_JUSTIFY)) 23 | 24 | with open('input.txt') as f: 25 | while True: 26 | line = f.readline() 27 | if not line: 28 | break 29 | context.append(Paragraph(line, styles["Normal"])) 30 | 31 | doc.build(context) 32 | -------------------------------------------------------------------------------- /Image Text/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Image Text/image3.png -------------------------------------------------------------------------------- /Image Text/text_image.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | from pytesseract import pytesseract 3 | # Defining paths to tesseract.exe  4 | # and the image we would be using 5 | path_to_tesseract = r"C:\Program Files\Tesseract-OCR\tesseract.exe" 6 | image_path = r #"C:\Users\kusha\Downloads\image3.png" 7 | # Opening the image & storing it in an image object 8 | img = Image.open(image_path) 9 | # Providing the tesseract  10 | # executable location to pytesseract library 11 | pytesseract.tesseract_cmd = path_to_tesseract 12 | # Passing the image object to  13 | # image_to_string() function 14 | # This function will 15 | # extract the text from the image 16 | text = pytesseract.image_to_string(img) 17 | # Displaying the extracted text 18 | print(text[:-1]) 19 | -------------------------------------------------------------------------------- /Image to ASCII/main.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | 3 | # ascii characters used to build the output text 4 | ASCII_CHARS = ["@", "#", "S", "%", "?", "*", "+", ";", ":", ",", "."] 5 | 6 | # resize image according to a new width 7 | def resize_image(image, new_width=100): 8 | width, height = image.size 9 | ratio = height/width 10 | new_height = int(new_width * ratio) 11 | resized_image = image.resize((new_width, new_height)) 12 | return(resized_image) 13 | 14 | # convert each pixel to grayscale 15 | def grayify(image): 16 | grayscale_image = image.convert("L") 17 | return(grayscale_image) 18 | 19 | # convert pixels to a string of ascii characters 20 | def pixels_to_ascii(image): 21 | pixels = image.getdata() 22 | characters = "".join([ASCII_CHARS[pixel//25] for pixel in pixels]) 23 | return(characters) 24 | 25 | def main(new_width=100): 26 | # attempt to open image from user-input 27 | path = input("Enter a valid pathname to an image:\n") 28 | try: 29 | image =Image.open(path) 30 | except: 31 | print(path, " is not a valid pathname to an image.") 32 | return 33 | 34 | # convert image to ascii 35 | new_image_data = pixels_to_ascii(grayify(resize_image(image))) 36 | 37 | # format 38 | pixel_count = len(new_image_data) 39 | ascii_image = "\n".join([new_image_data[index:(index+new_width)] for index in range(0, pixel_count, new_width)]) 40 | 41 | # print result 42 | print(ascii_image) 43 | 44 | # save result to "ascii_image.txt" 45 | with open("Image-To-ASCII/ascii_image.txt", "w") as f: 46 | f.write(ascii_image) 47 | 48 | # run program 49 | main() -------------------------------------------------------------------------------- /Image to ASCII/python.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Image to ASCII/python.jpg -------------------------------------------------------------------------------- /Image to ASCII/requirements.txt: -------------------------------------------------------------------------------- 1 | pillow -------------------------------------------------------------------------------- /Image to GIF/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Scripts 8 | 9 | ## Script - Image-to-gif 10 | 11 | Generate gif from Images 12 | imageTogif.py 13 | -------------------------------------------------------------------------------- /Image to GIF/imageTogif.py: -------------------------------------------------------------------------------- 1 | import glob 2 | from PIL import Image 3 | def make_gif(frame_folder): 4 | frames = [Image.open(image) for image in glob.glob(f"{frame_folder}/*.JPG")] 5 | frame_one = frames[0] 6 | frame_one.save("my_awesome.gif", format="GIF", append_images=frames, 7 | save_all=True, duration=100, loop=0) 8 | 9 | if __name__ == "__main__": 10 | make_gif("/path/to/images") -------------------------------------------------------------------------------- /JSON to CSV 2/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # JSON to CSV 8 | 9 | Users will be able to quickly and easily convert JSON files to CSV files with the aid of this script. 10 | 11 | ## Script - JSON2CSV 12 | 13 | Python code to convert a JSON input file to CSV file. 14 | 15 | ### For CLI 16 | 17 | ```bash 18 | python main.py 19 | ``` 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /JSON to CSV 2/main.py: -------------------------------------------------------------------------------- 1 | import json 2 | import csv 3 | 4 | with open('./generated.json') as json_file: 5 | jsondata = json.load(json_file) 6 | 7 | data_file = open('./generated.csv', 'w', newline='') 8 | csv_writer = csv.writer(data_file) 9 | 10 | count = 0 11 | for data in jsondata: 12 | if count == 0: 13 | header = data.keys() 14 | csv_writer.writerow(header) 15 | count += 1 16 | csv_writer.writerow(data.values()) 17 | 18 | data_file.close() 19 | -------------------------------------------------------------------------------- /JSON to CSV/README.md: -------------------------------------------------------------------------------- 1 | ## JSON TO CSV: 2 | This script converts a JSON file to CSV file. 3 | 4 | #### JSON : 5 | It means that a script (executable) file which is made of text in a programming language, is used to store and transfer the data. Python supports JSON through a built-in package called JSON 6 | 7 | #### CSV : 8 | It is a simple file format used to store tabular data, such as a spreadsheet or database. -------------------------------------------------------------------------------- /JSON to CSV/code/pyscript.py: -------------------------------------------------------------------------------- 1 | import json 2 | import csv 3 | 4 | # Opening JSON file and loading the data 5 | # into the variable data 6 | with open('data.json') as json_file: 7 | data = json.load(json_file) 8 | 9 | employee_data = data['emp_details'] 10 | 11 | # now we will open a file for writing 12 | data_file = open('data_file.csv', 'w') 13 | 14 | # create the csv writer object 15 | csv_writer = csv.writer(data_file) 16 | 17 | # Counter variable used for writing 18 | # headers to the CSV file 19 | count = 0 20 | 21 | for emp in employee_data: 22 | if count == 0: 23 | 24 | # Writing headers of CSV file 25 | header = emp.keys() 26 | csv_writer.writerow(header) 27 | count += 1 28 | 29 | # Writing data of CSV file 30 | csv_writer.writerow(emp.values()) 31 | 32 | data_file.close() -------------------------------------------------------------------------------- /JSON to YAML/json_to_yaml.py: -------------------------------------------------------------------------------- 1 | # script to convert json to yaml 2 | import json 3 | import os 4 | import sys 5 | import yaml 6 | if len(sys.argv) > 1: 7 | if os.path.exists(sys.argv[1]): 8 | sourcefile = open(sys.argv[1], "r") 9 | contentsource = json.load(sourcefile) 10 | sourcefile.close() 11 | else: 12 | print("ERROR: " + sys.argv[1] + " not found") 13 | exit(1) 14 | else: 15 | print("Usage: json2yaml.py [target_file.yaml]") 16 | outs = yaml.dump(contentsource) 17 | if len(sys.argv) < 3: 18 | print(outs) 19 | elif os.path.exists(sys.argv[2]): 20 | print("ERROR: " + sys.argv[2] + " already exists") 21 | exit(1) 22 | else: 23 | target_file = open(sys.argv[2], "w") 24 | target_file.write(outs) 25 | target_file.close() 26 | ##end -------------------------------------------------------------------------------- /Jokes Generator/jokes.py: -------------------------------------------------------------------------------- 1 | import pyjokes 2 | 3 | def cat(op): 4 | if op == 1: 5 | return "neutral" 6 | if op == 2: 7 | return "chuck" 8 | if op == 3: 9 | return "twister" 10 | if op == 4: 11 | return "all" 12 | def lan(op): 13 | if op == 3: 14 | return "de" 15 | elif 1<=op<=2 or op == 4: 16 | return "en" 17 | 18 | option = 0 19 | print("MENU\n1. Neutral\n2. Chuck Norris jokes\n3. Twisters(in gerrman)\n4. All\n5. Exit.") 20 | while option != 5: 21 | try: 22 | option = int(input("enter option: ")) 23 | My_joke = pyjokes.get_joke(language= lan(option), category= cat(option)) 24 | print(My_joke) 25 | except pyjokes.pyjokes.LanguageNotFoundError: 26 | print("successfully exited!") -------------------------------------------------------------------------------- /Jokes Generator/readme.md: -------------------------------------------------------------------------------- 1 | # JOKES GENERATOR 2 | ### Generates jokes of different categories such as netural , chuck norris ,tongue twisters... 3 | 4 | This python code takes user input of different category of jokes and gives out jokes based on the user prefered category. 5 | 6 | #### Requirements: 7 | * Install pyjokes module 8 | * run `pip install pyjokes` 9 | 10 | ### Usage 11 | * Clone the repo 12 | * open the `Jokes-generator` folder 13 | ##### for windows 14 | * run `python jokes.py` 15 | ##### for linux 16 | * run `python3 jokes.py` 17 | -------------------------------------------------------------------------------- /Json to CSV Convertor/README.MD: -------------------------------------------------------------------------------- 1 | # json to csv convertor 2 | 3 | ## Introduction 4 | 5 | This Python script allows you to convert json file to csv file and save them to a specified directory. It uses json and csv library to process json files and do manupulations accordingly. 6 | 7 | ## Usage 8 | 9 | ### Prerequisites 10 | 11 | Before using this script, ensure you have the following: 12 | 13 | - Python installed on your system. 14 | - Required libraries: `csv`, `json`, `python` 15 | 16 | ### Running the Script 17 | 18 | 1. Place the json file you want to convert to csv file in the same directory as this script. 19 | 20 | 2. Replace the `input_file` variable with the name of your json file name with .json extention. 21 | 22 | ```python 23 | input_file = 'json_data.json' 24 | python json_to_csv_with_nested_dict.py 25 | ``` 26 | 27 | ### Information about .py file 28 | 29 | 1. `json_to_csv` function 30 | 31 | - This function defines the JSON to CSV converter. It takes three arguments: 32 | - Args : 33 | - **json_data**: A JSON object or list of JSON objects. 34 | - **csv_file**: The path to the CSV file to write the data to. 35 | - **mapping**: A dictionary mapping JSON field names to CSV column headers. 36 | - Returns: 37 | - None 38 | 39 | 1. `flatten_json` function 40 | 41 | - This function flattens the JSON data. It works by recursively iterating over the JSON object and converting any nested JSON objects into a single level of key-value pairs. 42 | 43 | - Args : 44 | - **obj**: A nested JSON object. 45 | 46 | - Returns: 47 | - A flattened JSON object. 48 | 49 | ### Output 50 | 51 | The script will create a directory named **csv_data.csv** in the same location as the script. Within this directory. 52 | 53 | ![Alt text](image.png) -------------------------------------------------------------------------------- /Json to CSV Convertor/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Json to CSV Convertor/image.png -------------------------------------------------------------------------------- /Json to CSV Convertor/json_to_csv.py: -------------------------------------------------------------------------------- 1 | import json 2 | import csv 3 | 4 | def json_to_csv(input_json_file, output_csv_file): 5 | try: 6 | # Read JSON data from input file using utf-8-sig encoding to handle BOM 7 | with open(input_json_file, 'r', encoding='utf-8-sig') as json_file: 8 | data = json.load(json_file) 9 | 10 | # Get the keys from the first JSON object to use as column headers 11 | headers = list(data[0].keys()) 12 | 13 | # Write CSV data to output file 14 | with open(output_csv_file, 'w', newline='') as csv_file: 15 | writer = csv.DictWriter(csv_file, fieldnames=headers) 16 | 17 | # Write column headers to CSV file 18 | writer.writeheader() 19 | 20 | # Write JSON data to CSV file 21 | for row in data: 22 | writer.writerow(row) 23 | 24 | print(f"Conversion from JSON to CSV completed successfully. CSV file saved as {output_csv_file}") 25 | 26 | except Exception as e: 27 | print(f"An error occurred: {str(e)}") 28 | 29 | # Example usage 30 | input_json_file = 'path_to_input.json' 31 | output_csv_file = 'path_to_output.csv' 32 | 33 | json_to_csv(input_json_file, output_csv_file) 34 | -------------------------------------------------------------------------------- /Json to CSV Convertor/json_to_csv_with_nested_dict.py: -------------------------------------------------------------------------------- 1 | import json 2 | import csv 3 | 4 | def json_to_csv(json_data, csv_file, mapping=None): 5 | 6 | if isinstance(json_data, list): 7 | # Flatten nested JSON structures. 8 | json_data = [flatten_json(obj) for obj in json_data] 9 | 10 | # Get the column headers from the mapping or from the JSON data itself. 11 | column_headers = mapping or json_data[0].keys() 12 | 13 | # Write the CSV file. 14 | with open(csv_file, "w", newline="") as f: 15 | writer = csv.writer(f) 16 | writer.writerow(column_headers) 17 | for row in json_data: 18 | # Convert nested values to strings. 19 | row_values = [str(row.get(column, "")) for column in column_headers] 20 | writer.writerow(row_values) 21 | 22 | def flatten_json(obj): 23 | 24 | flattened = {} 25 | for key, value in obj.items(): 26 | if isinstance(value, dict): 27 | flattened.update(flatten_json(value)) 28 | elif isinstance(value, list): 29 | for item in value: 30 | flattened["{}.{}".format(key, item)] = item 31 | else: 32 | flattened[key] = value 33 | return flattened 34 | 35 | # sample mapping if needed 36 | mapping = { 37 | "name": "Name", 38 | "status": "Status", 39 | "date": "Date", 40 | "author": "Author", 41 | "probability": "Probability", 42 | "result": "Result", 43 | "final_status": "Final Status", 44 | "connected.run_again": "Run Again", 45 | "connected.next_test": "Next Test", 46 | "connected.next_test_status": "Next Test Status" 47 | } 48 | 49 | 50 | def main(): 51 | # Load the JSON data. 52 | with open("json_data.json", "r") as json_file: 53 | json_data = json.load(json_file) 54 | 55 | # Convert the JSON data to CSV format. 56 | json_to_csv(json_data, "csv_data.csv") 57 | 58 | if __name__ == "__main__": 59 | main() 60 | -------------------------------------------------------------------------------- /Json to CSV Convertor/requirements.txt: -------------------------------------------------------------------------------- 1 | json 2 | csv -------------------------------------------------------------------------------- /Keylogger/README.md: -------------------------------------------------------------------------------- 1 | 2 | ![pyKeylogger](https://user-images.githubusercontent.com/77505989/162591491-fc2e14ea-3f2e-4d15-a86e-f0e7394a888d.png) 3 | 4 | Key loggers are activity-monitoring software programs that give hackers access to your data. The software is installed on your computer and records everything you type. Then it sends this log file to a server, where cybercriminals wait to use all this sensitive information. 5 | 6 | ### This key logger can not only detect & record your keystrokes but can also: 7 | 8 | - Takes screenshot at a particular interval of time 9 | 10 | - Records audio 11 | 12 | - Record your System’s information & IP Address 13 | 14 | - Sends the data to the remote server using [Twilio](https://www.twilio.com/) 15 | 16 | - Keep track of your clipboard information 17 | 18 | ## Technologies on which it is built: 19 | ``` 20 | 1. Python 21 | 2. Socket 22 | 3. Platform 23 | 4. Win32 24 | 5. Pynput 25 | 6. Scipy 26 | 7. Sound-Device 27 | 8. Cryptography 28 | 9. Twilio 29 | ``` 30 | ## Why pyKeylogger? 31 | 32 | - It will broaden the way of thinking of researchers about how we can innovate the key loggers. 33 | - It will help identify the loopholes in the current anti key loggers software. 34 | - Multi software hack: pyKeylogger is packed with many modules to make it more advance than traditional keyloggers. 35 | 36 | #### Capable of deleting all the records after sending them to the remote server. 37 |

38 | Delete Records 39 |

40 | 41 | #### Encrypts the data & generates a new key (Asymmetric Key Encryption) that only the person at the remote server can decrypt. 42 |

43 | Encryption 44 |

45 | 46 | #### Using Twilio for transferring the data to a remote server! 47 |

48 | Twilio 49 |

50 | 51 | ## How to use? 52 | After cloning & installing all the dependencies, run 53 | ``` 54 | >>> python GenerateKey.py 55 | ``` 56 | It will generate the encryption key. Paste this key into `DecryptFile.py` & `Keylogger.py`. Then run, 57 | ``` 58 | >>> python Keylogger.py 59 | ``` 60 | You will see that new files are generating on their own. Watch Demonstration of the project [Here](https://www.youtube.com/watch?v=upWCYSoyOt8). 61 | -------------------------------------------------------------------------------- /Keylogger/cryptography/DecryptFile.py: -------------------------------------------------------------------------------- 1 | ''' Fernet guarantees that a message encrypted using it cannot be manipulated or read without the key. Fernet is an implementation of symmetric (also known as “secret key”) authenticated cryptography. ''' 2 | 3 | from cryptography.fernet import Fernet 4 | 5 | ''' Get key from the GenerateKey.py file ''' 6 | 7 | key = "" 8 | 9 | system_information_e = 'e_systeminfo.txt' 10 | clipboard_information_e = 'e_clipboard.txt' 11 | keys_information_e = 'e_key_log.txt' 12 | 13 | encrypted_files = [system_information_e, clipboard_information_e, keys_information_e] 14 | count = 0 15 | 16 | for decrypting_files in encrypted_files: 17 | 18 | with open(encrypted_files[count], 'rb') as f: 19 | data = f.read() 20 | 21 | fernet = Fernet(key) 22 | decrypted = fernet.decrypt(data) 23 | 24 | with open("decryption.txt", 'ab') as f: 25 | f.write(decrypted) 26 | 27 | count += 1 -------------------------------------------------------------------------------- /Keylogger/cryptography/GenerateKey.py: -------------------------------------------------------------------------------- 1 | from cryptography.fernet import Fernet 2 | 3 | ''' generate_key() method generates a new fernet key. The key must be kept safe as it is the most important component to decrypt the ciphertext. ''' 4 | 5 | key = Fernet.generate_key() 6 | 7 | file = open("encryption_key.txt", 'wb') 8 | 9 | file.write(key) 10 | 11 | file.close() -------------------------------------------------------------------------------- /Keyword Retweet Twitter Bot/README.md: -------------------------------------------------------------------------------- 1 | # Keyword Retweeter bot 2 | 3 | This bot will search for the Keywords on twitter and then retweet the latest tweets containing it. 4 | 5 | a working example of this is : https://twitter.com/COVID_retweet 6 | 7 | ## Steps 8 | 9 | - Get a developer account from https://developer.twitter.com 10 | - Put the api tokens in the main.py file 11 | - Run the file and input the keyword you want to search 12 | 13 | Done :) 14 | -------------------------------------------------------------------------------- /Keyword Retweet Twitter Bot/bot.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Keyword Retweet Twitter Bot/bot.txt -------------------------------------------------------------------------------- /Keyword Retweet Twitter Bot/main.py: -------------------------------------------------------------------------------- 1 | import tweepy 2 | import time 3 | 4 | apic= ""# add api_code 5 | apisc="" # add api_secret_code 6 | 7 | acc= ""#add account_code 8 | acsc= ""# add acount_secret_code 9 | 10 | cnt=open(r"bot.txt","r+") 11 | counts=cnt.read() 12 | count=int(counts) 13 | auth = tweepy.OAuthHandler(apic,apisc) 14 | auth.set_access_token(acc,acsc) 15 | api=tweepy.API(auth,wait_on_rate_limit=True,wait_on_rate_limit_notify=True) 16 | user=api.me() 17 | print(user.screen_name) 18 | search=input("Enter the keyword to be searched") # akss for the keyword here 19 | nrtweets=500 20 | count=0 21 | for tweet in tweepy.Cursor(api.search,search).items(nrtweets): 22 | try: 23 | print("tweet-number",count,"retweeted") 24 | count=count+1 25 | tweet.retweet() 26 | time.sleep(30) 27 | ctr=str(count) 28 | cnt.truncate() 29 | cnt.write(ctr) 30 | print("RETWEETED:",count) 31 | except tweepy.TweepError as e: 32 | print(e.reason) 33 | except StopIteration: 34 | break 35 | ctr=str(count) 36 | cnt.truncate() 37 | cnt.write(ctr) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 DhanushNehru 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LinkedIn Bot/README.md: -------------------------------------------------------------------------------- 1 | ## LinkedIn Bot 2 | 3 | ### Usage 4 | 5 | Install the required dependencies using pip: 6 | 7 | ``` 8 | pip install -r requirements.txt 9 | ``` 10 | 11 | Run the scarper.py file to start the bot: 12 | 13 | ``` 14 | python scraper.py 15 | ``` 16 | 17 | If suggested you need to download web driver on your system. 18 | You can download it from here: https://chromedriver.chromium.org/downloads 19 | -------------------------------------------------------------------------------- /LinkedIn Bot/requirements.txt: -------------------------------------------------------------------------------- 1 | selenium 2 | beautifulsoup4 3 | csv -------------------------------------------------------------------------------- /LinkedIn Bot/scraper.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | from bs4 import BeautifulSoup 4 | from time import sleep 5 | import csv 6 | 7 | # Step 1 : Login to LinkedIn 8 | 9 | # Open Chrome and Login LinkedIn Login Site 10 | 11 | driver = webdriver.Chrome() #Used for accessing web browsers 12 | url = 'https://www.linkedin.com/home' 13 | driver.get(url) 14 | sleep(3) 15 | 16 | 17 | email_field = driver.find_element('id','session_key') 18 | email_field.send_keys("YOUR_EMAIL_HERE") 19 | sleep(3) 20 | 21 | password_field = driver.find_element('name','session_password') 22 | password_field.send_keys("YOUR_PASSWORD_HERE") 23 | sleep(3) 24 | 25 | login_field = driver.find_element('xpath', '//*[@id="main-content"]/section[1]/div/div/form[1]/div[2]/button') 26 | login_field.click() 27 | sleep(3) 28 | 29 | 30 | #Step 2 : Search for the profile 31 | 32 | search_field = driver.find_element('xpath', '//*[@id="global-nav-typeahead"]/input') 33 | search_query = input('What Profile you want to scrape ?') #seach query like "Software Engineer" 34 | search_field.send_keys(search_query) 35 | sleep(3) 36 | search_field.send_keys(Keys.RETURN) #presses enter 37 | sleep(3) 38 | people_link = driver.find_element('xpath','//a[contains(@href, "/search/results/people/") and contains(text(), "See all people results")]') 39 | people_link.send_keys(Keys.RETURN) 40 | sleep(4) 41 | 42 | 43 | #step 3 : extracting data 44 | def Geturl(): 45 | page_source = BeautifulSoup(driver.page_source, "html.parser") 46 | profiles = page_source.find_all('a', class_='app-aware-link') 47 | 48 | profile_list = [] 49 | 50 | for profile in profiles: 51 | profile_url = profile['href'] 52 | if "/in/" in profile_url: 53 | if profile_url not in profile_list: 54 | profile_list.append(profile_url) 55 | 56 | return profile_list 57 | 58 | 59 | 60 | 61 | #defining the range to scrape the pages 62 | 63 | number_of_page = int(input("Enter Number of pages you want to scrape: ")) 64 | 65 | url_all_page =[] 66 | 67 | for page in range(number_of_page): 68 | url_one_page = Geturl() 69 | sleep(2) 70 | driver.execute_script('window.scrollTo(0, document.body.scrollHeight);') 71 | sleep(2) 72 | next_button = driver.find_element('xpath', '//button[@aria-label="Next"]') 73 | driver.execute_script("arguments[0].click();", next_button) 74 | url_all_page = url_all_page + url_one_page 75 | sleep(2) 76 | 77 | 78 | # Step 4: Scraping the entire data and storing it 79 | 80 | with open('output1.csv', 'w', newline='') as file_output: 81 | headers = ['Name', 'Job Title', 'Location', 'URL'] 82 | writer = csv.DictWriter(file_output, delimiter=',', lineterminator='\n', fieldnames=headers) 83 | writer.writeheader() 84 | 85 | for linkedin_URL in url_all_page: 86 | driver.get(linkedin_URL) 87 | print('- Accessing profile:', linkedin_URL) 88 | 89 | sleep(2) 90 | page_source = BeautifulSoup(driver.page_source, "html.parser") 91 | try: 92 | name_element = page_source.find('h1', class_='text-heading-xlarge inline t-24 v-align-middle break-words') 93 | name = name_element.get_text(strip=True) if name_element else 'N/A' 94 | 95 | title_element = page_source.find('div', class_='text-body-medium break-words') 96 | title = title_element.get_text(strip=True) if title_element else 'N/A' 97 | 98 | location_element = page_source.find('span', class_='text-body-small inline t-black--light break-words') 99 | location = location_element.get_text(strip=True) if location_element else 'N/A' 100 | 101 | if search_query.lower() in title.lower(): 102 | writer.writerow({headers[0]: name, headers[1]: title, headers[2]: location, headers[3]: linkedin_URL}) 103 | 104 | print('--- Profile name:', name) 105 | print('--- Profile title:', title) 106 | print('--- Profile location:', location) 107 | print('\n') 108 | 109 | except: 110 | pass 111 | 112 | print('Mission Completed!') -------------------------------------------------------------------------------- /Mail Sender/mail_sender.py: -------------------------------------------------------------------------------- 1 | import smtplib 2 | from email.mime.multipart import MIMEMultipart 3 | from email.mime.text import MIMEText 4 | from email.mime.base import MIMEBase 5 | from email import encoders 6 | body = ''' 7 | Hello, Admin 8 | I am attaching The Sales Files With This Email. 9 | This Year We Got a Wooping 200% Profit One Our Sales. 10 | 11 | Regards, 12 | Team Sales 13 | xyz.com 14 | ''' 15 | # Sender Email addresses and password 16 | senders_email = '' 17 | sender_password = '' 18 | reveiver_email = '' 19 | 20 | message = MIMEMultipart() 21 | message['From'] = senders_email 22 | message['To'] = reveiver_email 23 | message['Subject'] = 'Sales Report 2021-- Team Sales' 24 | message.attach(MIMEText(body, 'plain')) 25 | 26 | attach_file_name = 'temp.txt' 27 | attach_file = open(attach_file_name, 'rb') 28 | payload = MIMEBase('application', 'octate-stream') 29 | payload.set_payload((attach_file).read()) 30 | encoders.encode_base64(payload) 31 | payload.add_header('Content-Decomposition', 'attachment', 32 | filename=attach_file_name) 33 | message.attach(payload) 34 | 35 | session = smtplib.SMTP('smtp.gmail.com', 587) # use gmail with port 36 | session.starttls() # enable security 37 | # login with mail_id and password 38 | session.login(senders_email, sender_password) 39 | text = message.as_string() 40 | session.sendmail(senders_email, reveiver_email, text) 41 | session.quit() 42 | print('Mail Sent') 43 | -------------------------------------------------------------------------------- /Mail Sender/readme.md: -------------------------------------------------------------------------------- 1 | Email Sender Script Documentation 2 | 3 | This Python script sends an email with an attachment using the smtplib library. It is designed to send a sales report email with a specific body and a file attachment. Below are the details and usage of the script: 4 | 5 | Email Content: 6 | 7 | The email's body contains a simple message with a sales report for the year. 8 | The sender's email address and password should be specified in the script. 9 | The recipient's email address should also be provided in the script. 10 | 11 | 12 | Code Explanation: 13 | 14 | The script uses the smtplib library to send emails. 15 | It constructs the email message with a subject, sender, recipient, and body text. 16 | It attaches the 'temp.txt' file to the email. 17 | It connects to the Gmail SMTP server, enables a secure connection, and logs in using the sender's credentials. 18 | The email message is converted to a string, sent, and the connection to the SMTP server is closed. 19 | A message, "Mail Sent," is printed to indicate that the email has been sent. 20 | 21 | Please note that this script is set up for Gmail's SMTP server by default. If you are using a different email service, you may need to adjust the SMTP server details accordingly. 22 | 23 | Ensure that you have allowed less secure apps to access your Gmail account or use an application-specific password for sending emails via Gmail 24 | -------------------------------------------------------------------------------- /Mail Sender/temp.txt: -------------------------------------------------------------------------------- 1 | Hello -------------------------------------------------------------------------------- /Merge Two Images/README.md: -------------------------------------------------------------------------------- 1 | # Merge Two Images 2 | 3 | * Merges two images as required- Horizontally or Vertically. 4 | 5 | ## Usage: 6 | * Required packages: `opencv`, Install with: 7 | ```bash 8 | pip3 install opencv-python 9 | ``` 10 | * Run the script with: 11 | ```bash 12 | python3 mergeImages.py 13 | ``` -------------------------------------------------------------------------------- /Merge Two Images/mergeImages.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from genericpath import isdir 3 | import cv2 4 | import os 5 | 6 | def vconcat_resize(img_list, interpolation= cv2.INTER_CUBIC): 7 | w_min = min(img.shape[1] for img in img_list) 8 | im_list_resize = [cv2.resize(img, 9 | (w_min, int(img.shape[0] * w_min / img.shape[1])), 10 | interpolation=interpolation) 11 | for img in img_list] 12 | return cv2.vconcat(im_list_resize) 13 | 14 | def hconcat_resize(img_list, interpolation= cv2.INTER_CUBIC): 15 | h_min = min(img.shape[0] for img in img_list) 16 | im_list_resize = [cv2.resize(img, 17 | (int(img.shape[1] * h_min / img.shape[0]), 18 | h_min), interpolation 19 | = interpolation) 20 | for img in img_list] 21 | return cv2.hconcat(im_list_resize) 22 | 23 | imgpath1 = input("Enter 1st image path:") 24 | imgpath2 = input("Enter 2nd image path:") 25 | if os.path.exists(imgpath1) and os.path.exists(imgpath2): 26 | if os.path.isdir(imgpath1): 27 | print("[ERROR] 1st image path is a directory!") 28 | exit(1) 29 | if os.path.isdir(imgpath2): 30 | print("[ERROR] 2nd image path is a directory!") 31 | exit(1) 32 | img1 = cv2.imread(imgpath1) 33 | img2 = cv2.imread(imgpath2) 34 | merge_method = input("Merge [V]erically or [H]orizontally? ") 35 | if merge_method == "H" or merge_method == "h": 36 | im_concat = hconcat_resize([img1, img2]) 37 | cv2.imwrite("horizontal_concatenated.jpg", im_concat) 38 | print("Image saved at ./horizontal_concatenated.jpg") 39 | elif merge_method == "V" or merge_method == "v": 40 | im_concat = vconcat_resize([img1, img2]) 41 | cv2.imwrite("vertical_concatenated.jpg", im_concat) 42 | print("Image saved at ./vertical_concatenated.jpg") 43 | else: 44 | print("Invalid Option!") 45 | else: 46 | print("[ERROR] given path(s) doesn't exist!") 47 | exit(1) -------------------------------------------------------------------------------- /Mouse Mover/MouseMover.py: -------------------------------------------------------------------------------- 1 | import win32api, win32con, time, random 2 | def click(x,y): 3 | win32api.SetCursorPos((x,y)) 4 | win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0) 5 | win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0) 6 | 7 | while True: 8 | click(random.randint(0, 100), random.randint(0,100)) 9 | time.sleep(15) -------------------------------------------------------------------------------- /Mouse Mover/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | 10 | ## Script - Chessboard 11 | 12 | Moves your mouse every 15 seconds 13 | MouseMover.py -------------------------------------------------------------------------------- /No Screensaver/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Noscreensaver 3 | 4 | * While writing from a pdf on our computer after sometime we need to move the mouse in order to prevent the screensaver from being turned on. 5 | * Or sometimes when the user needs to keep the computer always engaged. 6 | --- 7 | #### We can use this then. 8 | 9 | 10 | ## Run Locally 11 | 12 | Just copy the code and ensure you have pyautogui installed. 13 | 14 | If not then you can install by 15 | 16 | ` pip install pyautogui ` 17 | 18 | To close the program if run from terminal press `Ctrl+C` or if from IDLE then just simply close the interface. -------------------------------------------------------------------------------- /No Screensaver/noscreensaver.py: -------------------------------------------------------------------------------- 1 | import pyautogui 2 | 3 | # A infinite loop 4 | while 1>0: 5 | # makes the mouse sleep or wait for 40 seconds 6 | pyautogui.sleep(40) 7 | # clicks about in the corner of the screen like 8 | # on the co-ordinates of (50,400) 9 | pyautogui.click(50,400) -------------------------------------------------------------------------------- /OTP Verify/Otpverification.py: -------------------------------------------------------------------------------- 1 | import os 2 | import math 3 | import random 4 | import smtplib 5 | 6 | digits="0123456789" 7 | OTP="" 8 | for i in range(6): 9 | OTP+=digits[math.floor(random.random()*10)] 10 | otp = OTP + " is your OTP" 11 | msg= otp 12 | s = smtplib.SMTP('smtp.gmail.com', 587) 13 | s.starttls() 14 | s.login("Your Gmail Account", "You app password") 15 | emailid = input("Enter your email: ") 16 | s.sendmail('&&&&&&&&&&&',emailid,msg) 17 | a = input("Enter Your OTP >>: ") 18 | if a == OTP: 19 | print("Verified") 20 | else: 21 | print("Please Check your OTP again") -------------------------------------------------------------------------------- /PDF to Audio/audio_book.py: -------------------------------------------------------------------------------- 1 | import pyttsx3 2 | import PyPDF2 3 | book = open('python_basics.pdf','rb') 4 | val = input("Enter the page no from where you want to start: ") 5 | val_converted = int(val) 6 | start_page = val_converted-1 7 | pdfReader = PyPDF2.PdfFileReader(book) 8 | page = pdfReader.numPages 9 | print(page) 10 | speaker = pyttsx3.init() 11 | for num in range(start_page,page): 12 | page = pdfReader.getPage(start_page) 13 | text = page.extractText() 14 | speaker.say(text) 15 | speaker.runAndWait() -------------------------------------------------------------------------------- /PDF to Audio/python_basics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/PDF to Audio/python_basics.pdf -------------------------------------------------------------------------------- /PDF to HTML/README.md: -------------------------------------------------------------------------------- 1 | # HTML to PDF Converter 2 | 3 | The HTML to PDF Converter is a Python script that allows you to easily convert HTML files to PDF using the `pdfkit` library. This script provides a simple and convenient way to generate PDF documents from HTML content. 4 | 5 | ## Table of Contents 6 | 7 | - [Prerequisites](#prerequisites) 8 | - [Installation](#installation) 9 | - [Usage](#usage) 10 | - [Options](#options) 11 | - [Example](#example) 12 | - [License](#license) 13 | 14 | ## Prerequisites 15 | 16 | Before using this script, make sure you have the following prerequisites installed on your system: 17 | 18 | - Python 3 19 | - [pdfkit](https://pypi.org/project/pdfkit/) library 20 | 21 | You can install the `pdfkit` library using pip: 22 | 23 | ```bash 24 | pip install pdfkit 25 | -------------------------------------------------------------------------------- /PDF to HTML/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /PDF to HTML/script.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import pdfkit 3 | 4 | class HTMLToPDFConverter: 5 | def __init__(self, input_file, output_file): 6 | self.input_file = input_file 7 | self.output_file = output_file 8 | 9 | def convert(self): 10 | try: 11 | pdfkit.from_file(self.input_file, self.output_file) 12 | print(f"Conversion successful. PDF saved as '{self.output_file}'") 13 | except Exception as e: 14 | print(f"Conversion failed: {str(e)}") 15 | 16 | def main(): 17 | parser = argparse.ArgumentParser(description="Convert HTML to PDF using Python") 18 | parser.add_argument("input_file", help="Input HTML file to convert") 19 | parser.add_argument("output_file", help="Output PDF file name") 20 | parser.add_argument("--help", action="help", help="Show this help message and exit") 21 | 22 | args = parser.parse_args() 23 | 24 | converter = HTMLToPDFConverter(args.input_file, args.output_file) 25 | converter.convert() 26 | 27 | if __name__ == "__main__": 28 | main() 29 | -------------------------------------------------------------------------------- /PNG-To-JPG/README.md: -------------------------------------------------------------------------------- 1 | # PNG-TO-JPG 2 | 3 | Want a quick convertor that converts `.PNG` images to `.JPG` images within fraction of a second. This is a very light convertor that is very handy in times with huge number of image conversion. 4 | 5 | ## How to use: 6 | 7 | - use the following command to install the requirement: 8 | ``` 9 | pip install pillow 10 | ``` 11 | - next move the main.py script to the folder with the image files that needs to be converted ~ Dont worry the script is not even over 2kb 12 | - Now copy the path of the folder 13 | - Now run the following command in the cmd with the folder path: 14 | ``` 15 | cd [path of your folder] 16 | ``` 17 | - Now use the following command: 18 | ``` 19 | python main.py 20 | ``` 21 | 22 | ## Modules used: 23 | - Pillow 24 | - Glob 25 | 26 | ## Thank You 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /PNG-To-JPG/example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/PNG-To-JPG/example.jpg -------------------------------------------------------------------------------- /PNG-To-JPG/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/PNG-To-JPG/example.png -------------------------------------------------------------------------------- /PNG-To-JPG/main.py: -------------------------------------------------------------------------------- 1 | #Importing required module 2 | from PIL import Image 3 | from glob import glob 4 | 5 | # Printing list of .png files 6 | print(glob("*.png")) 7 | 8 | 9 | # main loop 10 | for img_file in glob("*.png"): 11 | img = Image.open(img_file)# Opening the image file 12 | rgb_img = img.convert("RGB")# Converting it into RGB 13 | rgb_img.save(img_file.replace("png","jpg"), quality=95)# Saving the img as .jpg 14 | -------------------------------------------------------------------------------- /Password Generator/PasswordGenerator.py: -------------------------------------------------------------------------------- 1 | import random as rr 2 | import string as ss 3 | 4 | 5 | 6 | """ 7 | ASCII 8 | A -> Z : 65 -> 90 9 | a -> z : 97 -> 122 10 | """ 11 | 12 | characters = ['@', '#', '$', '%', '&', '?'] 13 | 14 | 15 | pass_len = int(input('How lengthy do you want your password to be : ')) 16 | 17 | tempy, tempz = 0, 0 18 | tempx = rr.randint(2, pass_len-1) # alphabets 19 | 20 | if tempx != pass_len: 21 | tempy = rr.randint(1, (pass_len - tempx - 1)) # numbers 22 | total_nums = tempy 23 | 24 | if (tempx + tempy) != pass_len: 25 | tempz = rr.randint(1, (pass_len-(tempx+tempy))) # special characters 26 | total_symbols = tempz 27 | 28 | # password : empty string for now 29 | pass_word = '' 30 | 31 | # adding alphabets 32 | 33 | while tempx: 34 | x = tempx 35 | num_cap = rr.randint(0, x) 36 | num_low = x-num_cap 37 | 38 | total_cap = num_cap 39 | total_low = num_low 40 | 41 | # capitals in password : 42 | while num_cap: 43 | temp = chr(rr.randint(65, 90)) 44 | pass_word = pass_word + str(temp) 45 | num_cap -= 1 46 | 47 | # lower-case in password : 48 | while num_low: 49 | temp = chr(rr.randint(97, 122)) 50 | pass_word = pass_word + str(temp) 51 | num_low -= 1 52 | 53 | break 54 | 55 | # adding numbers to the password 56 | while tempy: 57 | temp = (rr.randint(0, 9)) 58 | pass_word = pass_word + str(temp) 59 | tempy -= 1 60 | 61 | # adding special characters to the password 62 | while tempz: 63 | temp = rr.randint(0, len(characters)-1) 64 | pass_word = pass_word + characters[temp] 65 | tempz -= 1 66 | 67 | #shuffles the string 68 | def shuffle_(alpha): 69 | str_temp = list(alpha) 70 | rr.shuffle(str_temp) 71 | alpha = ''.join(str_temp) 72 | return alpha 73 | 74 | #adds colour to the text 75 | def colored(r, g, b, text): 76 | return "\033[38;2;{};{};{}m{} \033[38;2;255;255;255m".format(r, g, b, text) 77 | 78 | final_pass =colored(200,200,50, (shuffle_(shuffle_(shuffle_(pass_word))))) 79 | 80 | 81 | # result & summary 82 | result = """ 83 | Generate Password Summary : 84 | 85 | Charactor Uppercase : {0} 86 | Charactor Lowercase : {1} 87 | Numbers : {2} 88 | Symbols : {3} 89 | 90 | Your computer generated password is : 91 | {4} 92 | """.format(total_cap, total_low, total_nums, total_symbols, final_pass) 93 | 94 | print(result) 95 | 96 | # print(f"\nYour computer generated password is : {final_pass}\n\n") 97 | -------------------------------------------------------------------------------- /Password Manager/README.MD: -------------------------------------------------------------------------------- 1 | # Password Manager 2 | 3 | ## Usage 4 | Run the pwd_mgmr.py file and you will be prompted for the rest of the required inputs 5 | 6 | ### Getting Started: 7 | 1. Select Option (1) Create a new key that will be used to encrypt your password file. 8 | 2. Select Option (3) Create a new password file that will be used to hold your encrypted passwords. 9 | 3. Select Option (5) Add a new password to the password file. \n 10 | 11 | ### Retrieving or Adding Passords: 12 | 1. Select Option (2) Load the existing key so it can be used to encrypt new passwords or retrieve passwords from the password file. 13 | 2. Select Option (4) Load the existing password file so it can be used to add or retrieve passwords. 14 | 3. Select Option (5) Add a new password to the password file. 15 | 4. Select Option (6) Retrieve a password for a site. 16 | 17 | ## Example 18 | 19 | What would you like to do? 20 | (1) Create a new key 21 | (2) Load an existing key 22 | (3) Create new password file 23 | (4) Load existing password file 24 | (5) Add a new password 25 | (6) Get a password for a site 26 | (7) Get the list of sites 27 | (m) Menu 28 | (h) Help 29 | (q) Quit 30 | Enter your choice: h 31 | Getting Started: 32 | 1. Select Option (1) Create a new key that will be used to encrypt your password file. 33 | 2. Select Option (3) Create a new password file that will be used to hold your encrypted passwords. 34 | 3. Select Option (5) Add a new password to the password file. 35 | 36 | Retrieving or Adding Passords: 37 | 1. Select Option (2) Load the existing key so it can be used to encrypt new passwords or retrieve passwords from the password file. 38 | 2. Select Option (4) Load the existing password file so it can be used to add or retrieve passwords. 39 | 3a. Select Option (5) Add a new password to the password file. 40 | 3b. Select Option (6) Retrieve a password for a site. 41 | Enter your choice: 1 42 | Invalid Choice! 43 | Enter your choice: 1 44 | Enter the path: C:\pwds\mykey.key 45 | Enter your choice: 3 46 | Enter the path: C:\pwds\pwds.pass 47 | Enter your choice: 5 48 | Enter the site: facebook 49 | Enter the password: password123 50 | Enter your choice: 6 51 | What site do you want: facebook 52 | password123 53 | Enter your choice: 7 54 | List of Sites: 55 | facebook 56 | Enter your choice: q 57 | Bye! 58 | -------------------------------------------------------------------------------- /Planet Simulation/main.py: -------------------------------------------------------------------------------- 1 | import pygame 2 | import math 3 | pygame.init() 4 | 5 | WIDTH , HEIGHT = 1000,800 6 | WIN = pygame.display.set_mode((WIDTH,HEIGHT)) 7 | pygame.display.set_caption("Planet Simulation") 8 | 9 | white = (255, 255, 255) 10 | yellow = (255, 255, 0) 11 | blue = (100, 149, 237) 12 | red = (188, 39, 50) 13 | dark_grey = (80, 78, 81) 14 | 15 | FONT = pygame.font.SysFont("comicsans", 16) 16 | 17 | class Planet: 18 | AU = 149.6e6 * 1000 19 | G = 6.67428e-11 20 | SCALE = 250 / AU # 1AU = 100 pixels 21 | timestep = 3600 * 24 # 1 day 22 | 23 | def __init__(self,x,y,radius,color,mass): 24 | self.x = x 25 | self.y = y 26 | self.radius = radius 27 | self.color = color 28 | self.mass = mass 29 | 30 | self.orbit = [] 31 | self.sun = False 32 | self.distance_to_sun = 0 33 | 34 | self.x_vel = 0 35 | self.y_vel = 0 36 | 37 | def draw(self, win): 38 | x = self.x * self.SCALE + (WIDTH / 2) 39 | y = self.y * self.SCALE + (HEIGHT / 2) 40 | 41 | if len(self.orbit) >2 : 42 | Updated_points = [] 43 | for point in self.orbit: 44 | x, y = point 45 | x = x *self.SCALE + WIDTH/2 46 | y = y *self.SCALE + HEIGHT/2 47 | Updated_points.append((x,y)) 48 | 49 | pygame.draw.lines(win, self.color, False, Updated_points, 2) 50 | 51 | pygame.draw.circle(win, self.color, (x, y), self.radius) 52 | 53 | if not self.sun: 54 | distance_text = FONT.render(f"{round(self.distance_to_sun/1000, 1)} km", 1, white ) 55 | win.blit(distance_text,(x - distance_text.get_width()/2, y - distance_text.get_width()/2)) 56 | 57 | def attraction(self, other): 58 | other_x, other_y = other.x, other.y 59 | distance_x = other_x - self.x 60 | distance_y = other_y - self.y 61 | distance = math.sqrt(distance_x ** 2 + distance_y ** 2) 62 | 63 | if other.sun : 64 | self.distance_to_sun = distance 65 | 66 | force = self.G * self.mass * other.mass / distance**2 67 | theta = math.atan2(distance_y, distance_x) 68 | force_X = math.cos(theta) * force 69 | force_Y = math.sin(theta) * force 70 | return force_X, force_Y 71 | 72 | def update_position(self,planets): 73 | total_fx = total_fy = 0 74 | for planet in planets: 75 | 76 | if self == planet: 77 | continue 78 | 79 | fx , fy = self.attraction(planet) 80 | total_fx += fx 81 | total_fy += fy 82 | 83 | self.x_vel += total_fx / self.mass * self.timestep 84 | self.y_vel += total_fy / self.mass * self.timestep 85 | 86 | self.x += self.x_vel * self.timestep 87 | self.y += self.y_vel * self.timestep 88 | self.orbit.append((self.x,self.y)) 89 | 90 | 91 | def main(): 92 | run = True 93 | clock = pygame.time.Clock() 94 | 95 | sun = Planet(0, 0, 30, yellow, 1.98892 * 10**30) 96 | sun.sun = True 97 | 98 | earth = Planet(-1 * Planet.AU, 0, 16, blue, 5.9742 * 10**24) 99 | earth.y_vel = 29.738 * 1000 100 | 101 | mars = Planet(-1.524 * Planet.AU, 0, 12, red, 6.39 * 10**23) 102 | mars.y_vel = 24.077 *1000 103 | 104 | mercury = Planet(0.387 * Planet.AU, 0, 8, dark_grey, 3.30 * 10**23) 105 | mercury.y_vel = -47.4 * 1000 106 | 107 | venus = Planet(0.732 * Planet.AU, 0, 14, white, 4.8685 * 10**24 ) 108 | venus.y_vel = -35.02 * 1000 109 | 110 | planets = [sun,earth,mars,mercury,venus] 111 | 112 | while run: 113 | clock.tick(60) 114 | WIN.fill((0,0,0)) 115 | 116 | for event in pygame.event.get(): 117 | if event.type == pygame.QUIT: 118 | run = False 119 | 120 | for planet in planets: 121 | planet.update_position(planets) 122 | planet.draw(WIN) 123 | 124 | pygame.display.update() 125 | 126 | pygame.quit() 127 | 128 | main() -------------------------------------------------------------------------------- /Playlist Exchange/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Spotify-Youtube-Music-Exchange 8 | 9 | 10 | 11 | 12 |

Spotify-Youtube-Music-Exchange

13 | 14 |

This Python script allows you to exchange songs and playlists between Spotify and YouTube Music.

15 | 16 |

Requirements

17 | 18 |

Make sure you have the following libraries installed:

19 | 20 | 27 | 28 |

You can install these libraries using the following command:

29 | 30 |
pip install fuzzywuzzy==0.18.0 pandas==1.3.2 requests==2.31.0 spotipy==2.23.0 ytmusicapi==1.3.2
31 | 32 |

Setup "header_auth.json" (Browser Authentication) on local system:

33 | 34 |
    35 |
  1. Follow the documentation link to set up "header_auth.json" for Browser Authentication.
  2. 36 |
  3. Save the generated "header_auth.json" file in the root directory of this project.
  4. 37 |
38 | 39 |

Usage

40 | 41 |
    42 |
  1. Clone the repository:
  2. 43 |
44 | 45 |
git clone https://github.com/yourusername/Spotify-Youtube-Music-Exchange.git
46 | cd Spotify-Youtube-Music-Exchange
47 | 48 |
    49 |
  1. Install the required libraries:
  2. 50 |
51 | 52 |
pip install -r requirements.txt
53 | 54 |
    55 |
  1. Run the script:
  2. 56 |
57 | 58 |
python playlistexchange.py
59 | 60 |

Follow the on-screen instructions to exchange songs and playlists between Spotify and YouTube Music.

61 | 62 |

Contributing

63 | 64 |

If you'd like to contribute to this project, please fork the repository and submit a pull request. Issues and feature requests are welcome!

65 | 66 |

License

67 | 68 |

This project is licensed under the MIT License - see the LICENSE file for details.

69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Playlist Exchange/playlistexchange.py: -------------------------------------------------------------------------------- 1 | from ytmusicapi import YTMusic as yt 2 | import re 3 | import pandas as pd 4 | import requests as rq 5 | import json 6 | import spotipy 7 | import spotipy.oauth2 as oauth2 8 | from spotipy.oauth2 import SpotifyOAuth 9 | from spotipy.oauth2 import SpotifyClientCredentials 10 | import time 11 | import spotipy.util as util 12 | import fuzzywuzzy as fw 13 | from fuzzywuzzy import fuzz 14 | 15 | 16 | ytmusic = yt('headers_auth.json') 17 | 18 | def yt_tracks(ytmusic,playlist_yt): 19 | list_yt_tracks = [] 20 | playlist_yt_details = ytmusic.get_playlist(playlist_yt, limit = 1000) 21 | tracks_yt = playlist_yt_details['tracks'] 22 | for tracks in tracks_yt: 23 | list_yt_tracks.append({'title':tracks['title'],'artist':tracks['artists'][0]['name'],'album':('None' if tracks['album'] is None else tracks['album']['name']),'duration':(tracks['duration'] if 'duration' in tracks else 'None')}) 24 | df_yt_tracks = pd.DataFrame(list_yt_tracks) 25 | df_yt_tracks['title'] = df_yt_tracks['title'].apply(lambda x:(re.sub(r'\([^()]*\)','',x)).strip()) 26 | return df_yt_tracks 27 | 28 | def spotify_authorization(spotify_username,client_id,client_secret,scope): 29 | auth_mgr = util.prompt_for_user_token(spotify_username,scope,client_id=client_id,client_secret=client_secret,redirect_uri='http://localhost:8080') 30 | sp = spotipy.Spotify(auth = auth_mgr) 31 | return sp 32 | 33 | def new_playlist(spotify_username,sp,playlist_name,des): 34 | # playlist_name = 'Test Playlist' 35 | # des = "Testing Purpose" 36 | new_playlist_info = sp.user_playlist_create(spotify_username,playlist_name,description = des) 37 | print("Playlist Created") 38 | return new_playlist_info['id'] 39 | 40 | def get_spotify_song_list(df_yt_tracks): 41 | spotify_track_ids = [] 42 | for track in df_yt_tracks.index: 43 | results = sp.search(q= '{} {}'.format(df_yt_tracks['title'].iloc[track], df_yt_tracks['artist'].iloc[track]) ,limit=5, type ='track') 44 | if results['tracks']['total']>0: 45 | for i in results['tracks']['items']: 46 | i['name'] = re.sub(r'\([^()]*\)','',i['name']).strip() 47 | if fuzz.partial_ratio(i['name'], df_yt_tracks['title'].iloc[track]) >90 and fuzz.partial_ratio(i['artists'][0]['name'],df_yt_tracks['artist'].iloc[track])>60: 48 | spotify_track_ids.append(i['id']) 49 | # track_names.append(df_yt_tracks['title'].iloc[track]) 50 | break 51 | print("Found suitable match of "+str(len(spotify_track_ids))+ " songs in Spotify Library!") 52 | return spotify_track_ids 53 | 54 | def add_to_spotify(sp,newly_spotify_playlist_id, spotify_songs_list,spotify_username): 55 | while spotify_songs_list: 56 | sp.user_playlist_add_tracks(spotify_username, newly_spotify_playlist_id, spotify_songs_list[:90]) 57 | spotify_songs_list = spotify_songs_list[99:] 58 | print("Songs added sucessfully! :)") 59 | 60 | user_profile = input("Enter the Library link of your profile: \n") 61 | user_yt = user_profile.split('/')[-1] 62 | 63 | playlist_link = input("Enter the Playlist link of your profile: \n") 64 | playlist_yt = playlist_link.split("=")[-1] 65 | 66 | df_yt_tracks = yt_tracks(ytmusic,playlist_yt) 67 | 68 | # https://open.spotify.com/user/v52avba3w6pkkxosgeglngh2c 69 | spotify_username = input("Please enter your spotify username url/uri/shareable link:\n") 70 | spotify_username = spotify_username.split('/')[-1] 71 | 72 | client_id = "f23579cc015b4e518158755fd63d46fc" 73 | client_secret = "9dd9fb72962e4c3f9d42474c0142313a" 74 | scope = 'playlist-modify-public' 75 | 76 | sp = spotify_authorization(spotify_username,client_id,client_secret,scope) 77 | 78 | playlist_name = input("Give a name to your newly created playlist:\n") 79 | des = input("Please Provide the description if any:\n") 80 | 81 | newly_spotify_playlist_id = new_playlist(spotify_username,sp,playlist_name,des) 82 | 83 | print("Finding the most accurate songs in Spotify Library\n It might take few minutes...Please Wait :)") 84 | spotify_songs_list = get_spotify_song_list(df_yt_tracks) 85 | 86 | add_to_spotify(sp,newly_spotify_playlist_id, spotify_songs_list,spotify_username) 87 | 88 | # https://music.youtube.com/channel/UCLcvWDLANmp4g4dWOdMCoVg 89 | # https://music.youtube.com/playlist?list=PLLT7phSFVy-lfNrRTXR_A_HiIpjL5IAEz 90 | -------------------------------------------------------------------------------- /Playlist Exchange/requirements.txt: -------------------------------------------------------------------------------- 1 | fuzzywuzzy==0.18.0 2 | pandas==2.1.3 3 | Requests==2.31.0 4 | spotipy==2.23.0 5 | ytmusicapi==1.3.2 6 | -------------------------------------------------------------------------------- /Profanity Checker/ProfanityChecker.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | import requests 3 | import nltk 4 | import csv 5 | from nltk.tokenize import word_tokenize 6 | from nltk.corpus import stopwords 7 | from nltk.stem import WordNetLemmatizer 8 | from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer 9 | import tkinter as tk 10 | from tkinter import filedialog 11 | 12 | nltk.download('wordnet') 13 | 14 | nltk.download('punkt') 15 | nltk.download('stopwords') 16 | 17 | # Initialize the recognizer 18 | r = sr.Recognizer() 19 | 20 | # Ask the user whether to record from the microphone or select a file 21 | root = tk.Tk() 22 | root.withdraw() 23 | mode = input("Enter 'mic' to record from microphone or 'file' to select a file: ") 24 | 25 | if mode == 'mic': 26 | # Record audio from the user 27 | with sr.Microphone() as source: 28 | print("Say something!") 29 | audio = r.listen(source) 30 | 31 | # Use Google Speech Recognition to convert audio to text 32 | try: 33 | text = r.recognize_google(audio) 34 | print("You said: " + text) 35 | 36 | except sr.UnknownValueError: 37 | print("Google Speech Recognition could not understand audio") 38 | except sr.RequestError as e: 39 | print("Could not request results from Google Speech Recognition service; {0}".format(e)) 40 | 41 | elif mode == 'file': 42 | # Select a file using a dialog box 43 | file_path = filedialog.askopenfilename() 44 | print("Selected file:", file_path) 45 | 46 | # Convert audio file to audio data 47 | with sr.AudioFile(file_path) as source: 48 | audio = r.record(source) 49 | 50 | # Use Google Speech Recognition to convert audio to text 51 | try: 52 | text = r.recognize_google(audio) 53 | print("Transcription: " + text) 54 | 55 | 56 | except sr.UnknownValueError: 57 | print("Google Speech Recognition could not understand audio") 58 | except sr.RequestError as e: 59 | print("Could not request results from Google Speech Recognition service; {0}".format(e)) 60 | 61 | else: 62 | print("Invalid mode selected.") 63 | 64 | # Preprocess the text 65 | stop_words = set(stopwords.words('english')) 66 | lemmatizer = WordNetLemmatizer() 67 | tokens = word_tokenize(text) 68 | filtered_tokens = [lemmatizer.lemmatize(w.lower()) for w in tokens if not w.lower() in stop_words] 69 | filtered_text = ' '.join(filtered_tokens) 70 | 71 | # Check for profanity in the text using the API 72 | response = requests.get("https://www.purgomalum.com/service/json?text=" + filtered_text) 73 | result = response.json() 74 | 75 | if result['result'] == filtered_text: 76 | print("No profanity detected!") 77 | else: 78 | print("Profanity detected!") 79 | print("Censored text: " + result['result']) 80 | 81 | # Analyze sentiment of the text using VADER 82 | analyzer = SentimentIntensityAnalyzer() 83 | sentiment_scores = analyzer.polarity_scores(text) 84 | 85 | # Print sentiment scores 86 | print("\nSentiment Scores:") 87 | for key, value in sentiment_scores.items(): 88 | print(key, ': ', value) 89 | 90 | # Print sentiment label based on compound score 91 | sentiment_label = '' 92 | if sentiment_scores['compound'] > 0.5: 93 | sentiment_label = 'Very Positive' 94 | elif sentiment_scores['compound'] > 0: 95 | sentiment_label = 'Positive' 96 | elif sentiment_scores['compound'] == 0: 97 | sentiment_label = 'Neutral' 98 | elif sentiment_scores['compound'] < -0.5: 99 | sentiment_label = 'Very Negative' 100 | else: 101 | sentiment_label = 'Negative' 102 | 103 | print("\nSentiment Label: " + sentiment_label) 104 | 105 | # Write input and output to CSV file 106 | with open('profanitycheckeroutput.csv', 'a', newline='') as file: 107 | writer = csv.writer(file) 108 | #name the columns 109 | writer.writerow(['Input Text', 'Filtered Text', 'Positive Score', 'Negative Score', 'Neutral Score', 'Compound Score', 'Sentiment Label']) 110 | #write the data 111 | 112 | 113 | writer.writerow([text, filtered_text, sentiment_scores['pos'], sentiment_scores['neg'], sentiment_scores['neu'], sentiment_scores['compound'], sentiment_label]) 114 | 115 | -------------------------------------------------------------------------------- /QR Code Generator/QRcode.py: -------------------------------------------------------------------------------- 1 | import qrcode 2 | 3 | qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L) 4 | qr.add_data("INSERT YOUR LINK HERE") 5 | qr.make(fit=True) 6 | 7 | img = qr.make_image(fill_color="black", back_color="white") 8 | img.save("qrcode.png") 9 | -------------------------------------------------------------------------------- /QR Code Generator/qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/QR Code Generator/qrcode.png -------------------------------------------------------------------------------- /QR Ticket Generator/README.md: -------------------------------------------------------------------------------- 1 | #QR Ticket Generator from Excel File 2 | 3 | This project is a QR ticket generator that converts data from an Excel file into QR codes for ticket generation. 4 | 5 | 6 | ###Features 7 | 8 | 9 | 1. Read data from an Excel file. 10 | 11 | 2. Generate QR codes based on the data. 12 | 13 | 3. Save QR codes as image files. 14 | 15 | 4. Print tickets with QR codes. 16 | 17 | ###Contributing 18 | 19 | Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request. 20 | 21 | -------------------------------------------------------------------------------- /QR Ticket Generator/requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/QR Ticket Generator/requirements.txt -------------------------------------------------------------------------------- /Random Color Generator/README.md: -------------------------------------------------------------------------------- 1 | # How to Run 2 | - Make sure you have python 3.8.10 installed 3 | - Make sure you have pygame installed \(How to install [Pygame](#how-to-install-pygame)\) 4 | - Extract Random Color Generator.zip 5 | - Run the program with 6 | ```markdown 7 | ./Random Color Generator> python RandColorGen.py 8 | ``` 9 | 10 | # How to use 11 | - Click on the window to change colors 12 | - The color values are logged in the console and shown on screen 13 | 14 | # How to Install Pygame 15 | - After installing python 16 | - Use pip to install Pygame 17 | ```markdown 18 | ./wherever> pip install pygame 19 | ``` 20 | 21 | ## Dependencies: 22 | - random library 23 | - math library 24 | - pygame library 25 | 26 | -------------------------------------------------------------------------------- /Random Color Generator/RandColorGen.py: -------------------------------------------------------------------------------- 1 | import pygame 2 | import random 3 | import math 4 | 5 | 6 | def GenerateRandomColorValue(): 7 | r = random.randint(0, 255) 8 | g = random.randint(0, 255) 9 | b = random.randint(0, 255) 10 | 11 | return (r, g, b) 12 | 13 | 14 | def ReturnTextColor(colorValue): 15 | r = colorValue[0] 16 | g = colorValue[1] 17 | b = colorValue[2] 18 | colors = [r, g, b] 19 | 20 | i = 0 21 | for c in colors: 22 | c = c / 255.0 23 | if c <= 0.04045: 24 | c = c / 12.92 25 | else: 26 | c = math.pow(((c + 0.055) / 1.055), 2.4) 27 | colors[i] = c 28 | i += 1 29 | 30 | r = colors[0] 31 | g = colors[1] 32 | b = colors[2] 33 | 34 | L = 0.2126 * r + 0.7152 * g + 0.0722 * b 35 | 36 | shouldBeWhite = L > 0.179 37 | # shouldBeWhite = (r * 0.299 + g * 0.587 + b * 0.114) > 186 38 | 39 | if shouldBeWhite: 40 | return (0, 0, 0) 41 | else: 42 | return (255, 255, 255) 43 | 44 | 45 | pygame.init() 46 | 47 | height = 500 48 | width = 500 49 | 50 | canvas = pygame.display.set_mode((width, height)) 51 | pygame.display.set_caption("Random Color Generator!") 52 | isExit = False 53 | canvas.fill((255, 255, 255)) 54 | 55 | font = pygame.font.Font(pygame.font.get_default_font(), 32) 56 | 57 | # RGB Value 58 | RGBText = font.render("RGB Value: (255, 255, 255)", True, (0, 0, 0)) 59 | RGBTextRect = RGBText.get_rect() 60 | RGBTextRect.center = (width // 2, height // 2 - 20) 61 | 62 | # Hex Value 63 | hexText = font.render("Hex Value: #ffffff", True, (0, 0, 0)) 64 | hexTextRect = hexText.get_rect() 65 | hexTextRect.center = (width // 2, height // 2 + 20) 66 | hexTextRect.left = RGBTextRect.left 67 | 68 | 69 | while not isExit: 70 | canvas.blit(RGBText, RGBTextRect) 71 | canvas.blit(hexText, hexTextRect) 72 | 73 | for event in pygame.event.get(): 74 | if event.type == pygame.QUIT: 75 | isExit = True 76 | if event.type == pygame.MOUSEBUTTONUP: 77 | color = GenerateRandomColorValue() 78 | RGBString = "RGB Value: " + str(color) 79 | hexString = "Hex Value: " + str("#%02x%02x%02x" % color) 80 | TextColor = ReturnTextColor(color) 81 | RGBText = font.render(RGBString, True, TextColor) 82 | hexText = font.render(hexString, True, TextColor) 83 | print(RGBString + "; " + hexString) 84 | 85 | canvas.fill(color) 86 | 87 | pygame.display.flip() 88 | -------------------------------------------------------------------------------- /Random Color Generator/Random Color Generator.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Random Color Generator/Random Color Generator.zip -------------------------------------------------------------------------------- /Remove Background/README.md: -------------------------------------------------------------------------------- 1 | ## REMOVE BACKGROUND OF AN IMAGE 2 | This script removes bacckground of images. 3 | 4 | #### steps : 5 | Read the input 6 | Convert to gray 7 | Threshold and invert as a mask 8 | Optionally apply morphology to clean up any extraneous spots 9 | Anti-alias the edges 10 | Convert a copy of the input to BGRA and insert the mask as the alpha channel 11 | Save the results -------------------------------------------------------------------------------- /Remove Background/code.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | 4 | # import image 5 | img = cv2.imread('person.png') 6 | 7 | # convert to graky 8 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 9 | 10 | # threshold input image as mask 11 | mask = cv2.threshold(gray, 250, 255, cv2.THRESH_BINARY)[1] 12 | 13 | # negate mask 14 | mask = 255 - mask 15 | 16 | # apply morphology to remove isolated extraneous noise 17 | # use borderconstant of black since foreground touches the edges 18 | kernel = np.ones((3,3), np.uint8) 19 | mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel) 20 | mask = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel) 21 | 22 | # anti-alias the mask -- blur then stretch 23 | # blur alpha channel 24 | mask = cv2.GaussianBlur(mask, (0,0), sigmaX=2, sigmaY=2, borderType = cv2.BORDER_DEFAULT) 25 | 26 | # linear stretch so that 127.5 goes to 0, but 255 stays 255 27 | mask = (2*(mask.astype(np.float32))-255.0).clip(0,255).astype(np.uint8) 28 | 29 | # put mask into alpha channel 30 | result = img.copy() 31 | result = cv2.cvtColor(result, cv2.COLOR_BGR2BGRA) 32 | result[:, :, 3] = mask 33 | 34 | # save resulting masked image 35 | cv2.imwrite('person_transp_bckgrnd.png', result) 36 | 37 | # display result, though it won't show transparency 38 | cv2.imshow("INPUT", img) 39 | cv2.imshow("GRAY", gray) 40 | cv2.imshow("MASK", mask) 41 | cv2.imshow("RESULT", result) 42 | cv2.waitKey(0) 43 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Rock Paper Scissor/README.md: -------------------------------------------------------------------------------- 1 | # ROCK-✊-PAPER-🖐-SCISSOR✌️ 2 | # JUST PLAY ON WITH console-game 3 | ## ✊ ROCK ✊ 4 | ## 🖐 PAPER 🖐 5 | ## ✌️ SCISSOR ✌️ 6 | -------------------------------------------------------------------------------- /Rock Paper Scissor/rps.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | # Print multiline instruction 4 | # performstring concatenation of string 5 | print("Winning Rules of the Rock paper scissor game as follows: \n" 6 | +"Rock vs paper->paper wins \n" 7 | + "Rock vs scissor->Rock wins \n" 8 | +"paper vs scissor->scissor wins \n") 9 | 10 | while True: 11 | print("Enter choice by entering the appropiate number \n 1. Rock \n 2. paper \n 3. scissor \n") 12 | 13 | # take the input from user 14 | choice = int(input("User turn: ")) 15 | 16 | # OR is the short-circuit operator 17 | # if any one of the condition is true 18 | # then it return True value 19 | 20 | # looping until user enter invalid input 21 | while choice > 3 or choice < 1: 22 | choice = int(input("enter valid input: ")) 23 | 24 | 25 | # initialize value of choice_name variable 26 | # corresponding to the choice value 27 | if choice == 1: 28 | choice_name = 'Rock' 29 | elif choice == 2: 30 | choice_name = 'paper' 31 | else: 32 | choice_name = 'scissor' 33 | 34 | # print user choice 35 | print("user choice is: " + choice_name) 36 | print("\nNow its computer turn.......") 37 | 38 | # Computer chooses randomly any number 39 | # among 1 , 2 and 3. Using randint method 40 | # of random module 41 | comp_choice = random.randint(1, 3) 42 | 43 | # looping until comp_choice value 44 | # is equal to the choice value 45 | while comp_choice == choice: 46 | comp_choice = random.randint(1, 3) 47 | 48 | # initialize value of comp_choice_name 49 | # variable corresponding to the choice value 50 | if comp_choice == 1: 51 | comp_choice_name = 'Rock' 52 | elif comp_choice == 2: 53 | comp_choice_name = 'paper' 54 | else: 55 | comp_choice_name = 'scissor' 56 | 57 | print("Computer choice is: " + comp_choice_name) 58 | 59 | print(choice_name + " V/s " + comp_choice_name) 60 | 61 | # condition for winning 62 | if((choice == 1 and comp_choice == 2) or 63 | (choice == 2 and comp_choice ==1 )): 64 | print("paper wins => ", end = "") 65 | result = "paper" 66 | 67 | elif((choice == 1 and comp_choice == 3) or 68 | (choice == 3 and comp_choice == 1)): 69 | print("Rock wins =>", end = "") 70 | result = "Rock" 71 | else: 72 | print("scissor wins =>", end = "") 73 | result = "scissor" 74 | 75 | # Printing either user or computer wins 76 | if result == choice_name: 77 | print("<== User wins ==>") 78 | else: 79 | print("<== Computer wins ==>") 80 | 81 | print("Do you want to play again? (Y/N)") 82 | ans = input() 83 | 84 | 85 | # if user input n or N then condition is True 86 | if ans == 'n' or ans == 'N': 87 | break 88 | 89 | # after coming out of the while loop 90 | # we print thanks for playing 91 | print("\nThanks for playing") 92 | -------------------------------------------------------------------------------- /Run Then Notify/README.md: -------------------------------------------------------------------------------- 1 | # Run then Notify 2 | 3 | This is a python script that will run any terminal command on a system and once the command successfully runs, it will notify you via email of its time taken and the exit code. 4 | 5 | This can be useful in case of long running commands. 6 | 7 | Please enter your email and password when prompted. These values are _not_ stored anywhere and are only used for the SMTP connection. 8 | 9 | > This system has a hardcoded gmail smtp server specified. In case of any other smtp server, please update the value in code. 10 | > 11 | > **Note**: You may have to enable `less secure app access` in your gmail account. -------------------------------------------------------------------------------- /Run Then Notify/run_then_notify.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | import time 4 | import socket 5 | from getpass import getpass 6 | import smtplib 7 | from email.mime.text import MIMEText 8 | from email.mime.multipart import MIMEMultipart 9 | 10 | 11 | user_email = input("Enter your email: ") 12 | user_password = getpass() 13 | smtp_server = "smtp.gmail.com" 14 | smtp_port = 587 # Port 587 for TLS 15 | 16 | 17 | def send_text_email(subject, message, recipient_email, sender_email, sender_password, smtp_server, smtp_port): 18 | # Create a text/plain message 19 | msg = MIMEMultipart() 20 | msg['From'] = sender_email 21 | msg['To'] = recipient_email 22 | msg['Subject'] = subject 23 | 24 | # Attach the text message 25 | msg.attach(MIMEText(message, 'plain')) 26 | 27 | # Connect to the SMTP server 28 | try: 29 | server = smtplib.SMTP(smtp_server, smtp_port) 30 | server.starttls() 31 | server.login(sender_email, sender_password) 32 | text = msg.as_string() 33 | server.sendmail(sender_email, recipient_email, text) 34 | server.quit() 35 | except Exception as e: 36 | print(f"Email could not be sent: {str(e)}") 37 | 38 | 39 | def run_then_notify(command): 40 | try: 41 | start_time = time.time() 42 | completed_process = subprocess.run( 43 | command, 44 | text=True, 45 | shell=True, 46 | stdout=sys.stdout, 47 | stderr=subprocess.STDOUT, 48 | stdin=sys.stdin 49 | ) 50 | 51 | end_time = time.time() 52 | execution_time = end_time - start_time 53 | 54 | notif_subject = '[Run completed] Your command finished execution' 55 | notif_message = f"Command '{command}' completed\n\ 56 | \twith exit code {completed_process.returncode}\n\ 57 | \tin {execution_time:.2f} seconds\n\ 58 | \n\ 59 | This is an automated message sent from your device {socket.gethostname()}" 60 | 61 | send_text_email( 62 | subject=notif_subject, 63 | message=notif_message, 64 | recipient_email=user_email, 65 | sender_email=user_email, 66 | sender_password=user_password, 67 | smtp_server=smtp_server, 68 | smtp_port=smtp_port 69 | ) 70 | 71 | except Exception as e: 72 | print(f"Error: {e}") 73 | 74 | 75 | if __name__ == "__main__": 76 | if len(sys.argv) != 2: 77 | print("Usage: python run_then_notify.py 'your_command_here'") 78 | sys.exit(1) 79 | 80 | command = sys.argv[1] 81 | run_then_notify(command) 82 | -------------------------------------------------------------------------------- /Selfie with Python/Selfie_with_Python.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import time 3 | print("Press Space-bar to click Selfie") 4 | print("Press Escape key to terminate the window") 5 | time.sleep(5) 6 | cam = cv2.VideoCapture(0) 7 | cv2.namedWindow("Take selfie with python") 8 | img=0 9 | while True: 10 | ret, frame = cam.read() 11 | 12 | if not ret: 13 | print("Failed to grab frame") 14 | break 15 | 16 | cv2.imshow("Take selfie with python",frame) 17 | k = cv2.waitKey(1) 18 | if k%256 == 27: 19 | print("Escape hit, closing the window") 20 | break 21 | if k%256 == 32: 22 | img_name = f"Selfie_{img}.jpg" 23 | cv2.imwrite(img_name,frame) 24 | print("Selfie taken!") 25 | img+=1 26 | cam.release 27 | cv2.destroyAllWindows() 28 | -------------------------------------------------------------------------------- /Snake Water Gun/snake-water-gun.py: -------------------------------------------------------------------------------- 1 | import random 2 | user = 0 3 | computer = 0 4 | turn = 0 5 | rounds=int(input('enter the number of rounds: ')) 6 | while (turn arr[j + 1]: 6 | arr[j], arr[j + 1] = arr[j + 1], arr[j] 7 | arr = [ 2, 1, 10, 23 ] 8 | bubbleSort(arr) 9 | print("Sorted array is:") 10 | for i in range(len(arr)): 11 | print("%d" % arr[i]) 12 | -------------------------------------------------------------------------------- /Sorting/insertionsort.py: -------------------------------------------------------------------------------- 1 | def insertionSort(arr): 2 | n = len(arr) # Get the length of the array 3 | 4 | if n <= 1: 5 | return # If the array has 0 or 1 element, it is already sorted, so return 6 | 7 | for i in range(1, n): # Iterate over the array starting from the second element 8 | key = arr[i] # Store the current element as the key to be inserted in the right position 9 | j = i-1 10 | while j >= 0 and key < arr[j]: # Move elements greater than key one position ahead 11 | arr[j+1] = arr[j] # Shift elements to the right 12 | j -= 1 13 | arr[j+1] = key # Insert the key in the correct position 14 | 15 | # Sorting the array [12, 11, 13, 5, 6] using insertionSort 16 | arr = [12, 11, 13, 5, 6] 17 | insertionSort(arr) 18 | print(arr) 19 | -------------------------------------------------------------------------------- /Sorting/selectionsort.py: -------------------------------------------------------------------------------- 1 | """ 2 | Intuition is to pick smallest element every times loop proceeds 3 | """ 4 | 5 | def selectionSort(arr): 6 | """ 7 | The selectionSort function implements the selection sort algorithm to sort an array in ascending 8 | order. 9 | 10 | :param arr: The parameter `arr` is a list of elements that you want to sort using the selection sort 11 | algorithm 12 | 13 | Time complexity: O(N^2), (where N = size of the array), for the best, worst, and average cases. 14 | Space Complexity: O(1) 15 | """ 16 | n = len(arr) 17 | 18 | for i in range(0,n-1): 19 | min_idx = i 20 | for j in range(i,n): 21 | if arr[j] < arr[min_idx]: 22 | min_idx = j 23 | # at this point we have collected information which element is smallest (between i and n-1)and its index is stored in min_idx 24 | arr[i], arr[min_idx] = arr[min_idx], arr[i] 25 | 26 | 27 | temp = input("Enter numbers separated by a comma:\n").strip() 28 | arr = [int(item) for item in temp.split(",")] 29 | selectionSort(arr) 30 | print(arr) -------------------------------------------------------------------------------- /Star Pattern/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | ## Script - Star Pattern 10 | 11 | Code to create star pattern 12 | starPattern.py 13 | 14 | -------------------------------------------------------------------------------- /Star Pattern/starPattern.py: -------------------------------------------------------------------------------- 1 | def starPattern(n): 2 | for i in range(1, n+1): 3 | for j in range(1, i+1): 4 | print("* ", end="") 5 | print() 6 | 7 | 8 | n = int(input("Enter the number of rows: ")) 9 | starPattern(n) 10 | 11 | -------------------------------------------------------------------------------- /TCP Chat Server/server.py: -------------------------------------------------------------------------------- 1 | import socket 2 | 3 | IP = '0.0.0.0' 4 | PORT = 3000 5 | 6 | def main(): 7 | server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 8 | server.bind((IP, PORT)) 9 | 10 | server.listen(5) 11 | print(f'Server is listening on {IP}:{PORT}') 12 | 13 | while True: 14 | client, address = server.accept() 15 | print(f'Received a connection from {address[0]}:{address[1]}') 16 | 17 | data = client.recv(4096) 18 | decoded_data = data.decode() 19 | print(decoded_data) 20 | 21 | send = input('Send message> ') 22 | client.send(send.encode()) 23 | 24 | 25 | if __name__ == '__main__': 26 | main() 27 | -------------------------------------------------------------------------------- /Take A Break/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | ## Script - Take a break 10 | 11 | Python code to take a break while working long hours 12 | TakeABreak.py 13 | 14 | -------------------------------------------------------------------------------- /Take A Break/TakeABreak.py: -------------------------------------------------------------------------------- 1 | #This program will take a break in your computer. 2 | #For every two hours youtube.com will open in your browser for a period of 3 breaks 3 | import webbrowser 4 | import time 5 | total_breaks = 3 6 | break_count = 0 7 | print("This program started on"+time.ctime()) 8 | while(break_count < total_breaks): 9 | time.sleep(2*60*60) 10 | webbrowser.open("http://www.youtube.com") 11 | break_count+=1; 12 | -------------------------------------------------------------------------------- /Text Recognition/README.md: -------------------------------------------------------------------------------- 1 | # Image Text Recognition ML Model 2 | 3 | - To run, you need to install transformers to install type `!pip install transformers` in terminal. 4 | - load image link into `url`. -------------------------------------------------------------------------------- /Text to Image/README.md: -------------------------------------------------------------------------------- 1 | # Text-to-Image 2 | 3 | ## Usage 4 | Run the text2image.py file from the directory where the Python-Scripts folder is located in and it will prompt you will all the required inputs 5 | 6 | ### Example 7 | ```bash 8 | cd code 9 | python3 code/Python-Scripts/Text-To-Image/text2image.py 10 | ``` 11 | 12 | ## Output 13 | The saved JPEG file will be located in the directory -------------------------------------------------------------------------------- /Text to Image/fonts/Roboto-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Text to Image/fonts/Roboto-Black.ttf -------------------------------------------------------------------------------- /Text to Image/text2image.py: -------------------------------------------------------------------------------- 1 | from PIL import Image, ImageDraw, ImageFont 2 | 3 | def main(): 4 | # Get filename for image 5 | filename = input("What would you like your image to be called?") 6 | # Create white background image 7 | img = Image.new(mode="RGB", size=(1920,1080), color='#FFFFFF') 8 | d1 = ImageDraw.Draw(img) 9 | # Get text for the image 10 | writing = input("Write your text here: ") 11 | # Choose the font 12 | fnt = ImageFont.truetype("Python-Scripts/Text-to-Image/fonts/Roboto-Black.ttf", 40) 13 | # Write the text 14 | d1.text((65, 10), writing, fill=(255,0,0), font=fnt) 15 | # Show & save the image 16 | img.show() 17 | img.save(filename + ".jpeg") 18 | 19 | if __name__ == '__main__': 20 | main() -------------------------------------------------------------------------------- /Tic-Tac-Toe/tic_tac_toe.py: -------------------------------------------------------------------------------- 1 | import random 2 | import sys 3 | board=[i for i in range(0,9)] 4 | player, computer = '','' 5 | 6 | moves=((1,7,3,9),(5,),(2,4,6,8)) 7 | 8 | winners=((0,1,2),(3,4,5),(6,7,8),(0,3,6),(1,4,7),(2,5,8),(0,4,8),(2,4,6)) 9 | 10 | tab=range(1,10) 11 | def print_board(): 12 | x=1 13 | for i in board: 14 | end = ' | ' 15 | if x%3 == 0: 16 | end = ' \n' 17 | if i != 1: end+='---------\n' 18 | char=' ' 19 | if i in ('X','O'): char=i 20 | x+=1 21 | print(char,end=end) 22 | def select_char(): 23 | chars=('X','O') 24 | if random.randint(0,1) == 0: 25 | return chars[::-1] 26 | return chars 27 | def can_move(brd, player, move): 28 | if move in tab and brd[move-1] == move-1: 29 | return True 30 | return False 31 | def can_win(brd, player, move): 32 | places=[] 33 | x=0 34 | for i in brd: 35 | if i == player: places.append(x) 36 | x+=1 37 | win=True 38 | for tup in winners: 39 | win=True 40 | for ix in tup: 41 | if brd[ix] != player: 42 | win=False 43 | break 44 | if win == True: 45 | break 46 | return win 47 | def make_move(brd, player, move, undo=False): 48 | if can_move(brd, player, move): 49 | brd[move-1] = player 50 | win=can_win(brd, player, move) 51 | if undo: 52 | brd[move-1] = move-1 53 | return (True, win) 54 | return (False, False) 55 | 56 | def computer_move(): 57 | move=-1 58 | # If I can win, others do not matter. 59 | for i in range(1,10): 60 | if make_move(board, computer, i, True)[1]: 61 | move=i 62 | break 63 | if move == -1: 64 | # If player can win,I can try to block him. 65 | for i in range(1,10): 66 | if make_move(board, player, i, True)[1]: 67 | move=i 68 | break 69 | if move == -1: 70 | # Otherwise, try to take one of desired places. 71 | for tup in moves: 72 | for mv in tup: 73 | if move == -1 and can_move(board, computer, mv): 74 | move=mv 75 | break 76 | return make_move(board, computer, move) 77 | def space_exist(): 78 | return board.count('X') + board.count('O') != 9 79 | player, computer = select_char() 80 | print('Player is [%s] and computer is [%s]' % (player, computer)) 81 | result='%%% Deuce ! %%%' 82 | while space_exist(): 83 | print_board() 84 | print('#Make your move ! [1-9] : ', end='') 85 | move = int(input()) 86 | moved, won = make_move(board, player, move) 87 | if not moved: 88 | print(' Invalid number ! Try again !') 89 | continue 90 | if won: 91 | result='*** Congratulations ! You won ! ***' 92 | break 93 | elif computer_move()[1]: 94 | result='=== You lose ! ==' 95 | break 96 | print_board() 97 | print(result) -------------------------------------------------------------------------------- /Turtle Art/Prompt_Based/benzene.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | from tkinter import * 3 | from tkinter import ttk 4 | win=Tk() 5 | win.geometry('300x120') 6 | win.title('BENZENE STRUCTURES') 7 | a=Label(win,text='BENZENE STRUCTURES \n Click on the option you want to see') 8 | a.grid(column=0,row=0) 9 | selected = IntVar() 10 | rad1 = ttk.Radiobutton(win,text='Simple structure', value=1, variable=selected) 11 | rad2 = ttk.Radiobutton(win,text='Resonating structure', value=2, variable=selected) 12 | rad1.grid(column=0, row=1) 13 | rad2.grid(column=0, row=2) 14 | def hexi(): 15 | speed(-1) 16 | for i in range (6): 17 | width(5) 18 | rt(60) 19 | fd(100) 20 | width(2) 21 | def pi(): 22 | goto(0,0) 23 | rt(180) 24 | up() 25 | lt(60) 26 | fd(10) 27 | lt(60) 28 | down() 29 | fd(80) 30 | lt(-60) 31 | up() 32 | fd(100) 33 | down() 34 | rt(60) 35 | fd(80) 36 | rt(60) 37 | up() 38 | fd(90) 39 | down() 40 | rt(60) 41 | fd(80) 42 | def reso(): 43 | up() 44 | goto(-48,-19) 45 | down() 46 | rt(180) 47 | circle(65) 48 | def main(): 49 | reset() 50 | if selected.get()==1: 51 | hexi() 52 | pi() 53 | elif selected.get()==2: 54 | hexi() 55 | reso() 56 | ht() 57 | b=Button(win,text='Enter',bg='black',fg='white',command=main) 58 | b.grid(column=0,row=3) 59 | if __name__=='__main__': 60 | main() 61 | mainloop() 62 | win.mainloop() 63 | -------------------------------------------------------------------------------- /Turtle Art/Prompt_Based/windowsLogo.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | import turtle 3 | from tkinter import messagebox 4 | from tkinter.ttk import * 5 | import time 6 | win=Tk() 7 | win.title('Windows Logo') 8 | win.geometry('250x150') 9 | a= Label(win,text='Do u want old windows logo?') 10 | a.grid(column=0,row=0) 11 | selected = IntVar() 12 | rad1 = Radiobutton(win,text=' Yes', value=1, variable=selected) 13 | rad2 = Radiobutton(win,text=' No', value=2, variable=selected) 14 | rad1.grid(column=0,row=1) 15 | rad2.grid(column=0,row=2) 16 | def click(): 17 | if selected.get()==1: 18 | g,b='green','blue' 19 | elif selected.get()==2: 20 | g,b='light green','light blue' 21 | else: 22 | messagebox.showinfo('ERROR', 'Enter yes or no') 23 | win.mainloop() 24 | start=time.time() 25 | t=turtle.Turtle() 26 | t.shape('square') 27 | t.resizemode('user') 28 | t.shapesize(0.1,0.1,0.1) 29 | t.speed(-1) 30 | t.pensize(5) 31 | t.fillcolor('yellow') 32 | t.begin_fill() 33 | for p in range(7): 34 | t.forward(50) 35 | t.right(90) 36 | t.end_fill() 37 | t.penup() 38 | t.forward(60) 39 | t.pendown() 40 | t.fillcolor(g) 41 | t.begin_fill() 42 | for h in range(7): 43 | t.forward(50) 44 | t.right(90) 45 | t.end_fill() 46 | t.penup() 47 | t.forward(60) 48 | t.pendown() 49 | t.fillcolor('red') 50 | t.begin_fill() 51 | for v in range(7): 52 | t.forward(50) 53 | t.right(90) 54 | t.end_fill() 55 | t.penup() 56 | t.forward(60) 57 | t.pendown() 58 | t.fillcolor(b) 59 | t.begin_fill() 60 | for k in range(5): 61 | t.forward(50) 62 | t.right(90) 63 | t.end_fill() 64 | t.hideturtle() 65 | end=time.time() 66 | value=str(end-start) 67 | r.config(text='Completd in '+value+' seconds') 68 | h= Button(win,text='Enter',command=click) 69 | h.grid(column=0,row=4) 70 | r=Label(win,text='') 71 | r.grid(column=0,row=3) 72 | #quit 73 | quit1 = Button(win, text="QUIT",command=win.destroy) 74 | quit1.grid(sticky=S) 75 | 76 | win.mainloop() 77 | 78 | -------------------------------------------------------------------------------- /Turtle Art/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Turtle Scripts 3 | 4 | This folder contains a few python scripts using 5 | `tutle` and `tkinter` in some. 6 | 7 | Here we have some cool looking turtle art. 8 | * In order to run these, no packages need to be installed. Turtle and tkinter are already included in python. 9 | 10 | ## Prompt Based 11 | This include some scripts where based upon user's choice 12 | output would be displayed. Feel free to select your choice. -------------------------------------------------------------------------------- /Turtle Art/Xsquare.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | turtle.speed(-1) 3 | for l in range(300): 4 | turtle.pencolor('red') 5 | turtle.penup() 6 | turtle.forward(60) 7 | turtle.pendown() 8 | turtle.forward(l) 9 | turtle.left(90) 10 | turtle.hideturtle() 11 | -------------------------------------------------------------------------------- /Turtle Art/art2.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | import random 3 | speed(-1) 4 | width(3) 5 | colors = ['sky blue', 'navy', "steel blue", 'cyan'] 6 | 7 | def main(): 8 | for i in range(0, 204, 2): 9 | random.shuffle(colors) 10 | color(colors[0]) 11 | circle(10+i, 100, 2) 12 | 13 | if __name__ == '__main__': 14 | ht() 15 | main() 16 | mainloop() 17 | -------------------------------------------------------------------------------- /Turtle Art/art4.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | speed(-1) 3 | width(3) 4 | colors = ['red', '', 'purple', 'blue', '', 'green', 'yellow', '', 'orange'] 5 | #color('sky blue') 6 | 7 | def main(): 8 | for ola in range(10): 9 | for i in range(0, 200, 10): 10 | color(colors[i%8]) 11 | #up() 12 | circle(1+i, 20, 10) 13 | #down() 14 | circle(1) 15 | up() 16 | goto(0, 0) 17 | down() 18 | 19 | 20 | if __name__ == '__main__': 21 | ht() 22 | main() 23 | mainloop() 24 | -------------------------------------------------------------------------------- /Turtle Art/art5.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | speed(-1) 3 | width(3) 4 | color('sky blue') 5 | 6 | def main(): 7 | for ola in range(20): 8 | for i in range(0, 100, 10): 9 | up() 10 | circle(2+i, 50, 2) 11 | down() 12 | circle(1) 13 | up() 14 | goto(0, 0) 15 | down() 16 | 17 | 18 | if __name__ == '__main__': 19 | ht() 20 | main() 21 | mainloop() 22 | -------------------------------------------------------------------------------- /Turtle Art/happy_birthday.py: -------------------------------------------------------------------------------- 1 | # python code to draw a happy birthday using turtle 2 | import turtle 3 | 4 | name = input("Enter your name: ") 5 | 6 | bg = turtle.Screen() 7 | bg.bgcolor("black") 8 | 9 | hbd = turtle.Turtle() 10 | hbd.shape("turtle") 11 | hbd.speed(8) 12 | 13 | hbd.penup() 14 | hbd.goto(-220, -210) 15 | hbd.color("#d6291a") 16 | hbd.pensize(6) 17 | hbd.pendown() 18 | hbd.goto(220, -210) 19 | hbd.penup() 20 | 21 | hbd.penup() 22 | hbd.goto(-190, -180) 23 | hbd.color("#22d6b8") 24 | hbd.pensize(6) 25 | hbd.pendown() 26 | hbd.goto(190, -180) 27 | hbd.penup() 28 | 29 | hbd.penup() 30 | hbd.goto(-160, -150) 31 | hbd.color("#f0b222") 32 | hbd.pensize(6) 33 | hbd.pendown() 34 | hbd.goto(160, -150) 35 | hbd.penup() 36 | 37 | hbd.penup() 38 | hbd.goto(-130, -120) 39 | hbd.color("#6fde50") 40 | hbd.pensize(6) 41 | hbd.pendown() 42 | hbd.goto(130, -120) 43 | hbd.penup() 44 | 45 | hbd.goto(-74, -110) 46 | hbd.pendown() 47 | hbd.color("white") 48 | hbd.goto(50, -110) 49 | hbd.left(90) 50 | hbd.forward(60) 51 | hbd.left(90) 52 | hbd.forward(125) 53 | hbd.left(90) 54 | hbd.forward(60) 55 | hbd.penup() 56 | 57 | hbd.goto(-20, -40) 58 | hbd.color("#40f533") 59 | hbd.pendown() 60 | hbd.pensize(3) 61 | hbd.goto(-20, -20) 62 | hbd.penup() 63 | 64 | hbd.goto(-40, -40) 65 | hbd.color("#fcdc3d") 66 | hbd.pendown() 67 | hbd.pensize(3) 68 | hbd.goto(-40, -20) 69 | hbd.penup() 70 | 71 | hbd.goto(20, -40) 72 | hbd.color("#244ea3") 73 | hbd.pendown() 74 | hbd.pensize(3) 75 | hbd.goto(20, -20) 76 | hbd.penup() 77 | 78 | hbd.goto(0, -40) 79 | hbd.color("#ed39bd") 80 | hbd.pendown() 81 | hbd.pensize(3) 82 | hbd.goto(0, -20) 83 | hbd.penup() 84 | 85 | hbd.goto(-200, 50) 86 | hbd.color("white") 87 | hbd.pendown() 88 | design = ("Pristina", 30) 89 | 90 | hbd.write(f" Happy Birthday {name}", font=design) 91 | 92 | hbd.color("black") 93 | hbd.goto(-100, 9) 94 | hbd.color("#d6291a") 95 | hbd.pendown() 96 | layout = (19) 97 | 98 | while True: 99 | hbd.penup() 100 | hbd.goto(-220, -210) 101 | hbd.color("#d6291a") 102 | hbd.pensize(6) 103 | hbd.pendown() 104 | hbd.goto(220, -210) 105 | hbd.penup() 106 | -------------------------------------------------------------------------------- /Turtle Art/rainbow_hexagon.py: -------------------------------------------------------------------------------- 1 | # python code to draw rainbow hexagon using turtle 2 | import turtle 3 | 4 | # colors to be used in hexagon 5 | colors = ("red", "yellow", "cyan", "green", "pink", "white") 6 | 7 | t = turtle.Turtle() 8 | 9 | # creating tutle GUI screen 10 | screen = turtle.Screen() 11 | screen.bgcolor("black") 12 | 13 | # setting the speed of the turtle 14 | t.speed(15) 15 | 16 | for i in range(400): 17 | t.color(colors[i%6]) 18 | t.forward(i*1.5) 19 | t.left(59) 20 | t.width(3) -------------------------------------------------------------------------------- /Turtle Art/rainbow_triangle.py: -------------------------------------------------------------------------------- 1 | # python code to draw rainbow triangle using turtle 2 | import turtle 3 | 4 | # colors to be used in hexagon 5 | colors = ("red", "yellow", "cyan", "green") 6 | 7 | t = turtle.Turtle() 8 | 9 | # creating tutle GUI screen 10 | screen = turtle.Screen() 11 | screen.bgcolor("black") 12 | 13 | # setting the speed of the turtle 14 | t.speed(10) 15 | 16 | c = 0 17 | for i in range(100): 18 | t.forward(i*10) 19 | t.right(114) 20 | t.color(colors[c]) 21 | if c == 3: 22 | c = 0 23 | else: 24 | c += 1 -------------------------------------------------------------------------------- /Turtle Art/scenery.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | import random 3 | from tkinter import messagebox 4 | import time 5 | setup(1350,750) 6 | def sun_sky(): 7 | start=time.time() 8 | colors=['orange','tomato'] 9 | getscreen() 10 | title('Scenery') 11 | bgcolor('light sky blue') 12 | width(3) 13 | up() 14 | goto(-250,200) 15 | down() 16 | for i in range(25): 17 | random.shuffle(colors) 18 | color(colors[0]) 19 | speed(-1) 20 | circle(40,100) 21 | rt(-180) 22 | up() 23 | fd(45) 24 | rt(95) 25 | fd(50) 26 | down() 27 | circle(40,100) 28 | up() 29 | goto(200,120) 30 | rt(-75) 31 | down() 32 | width(2) 33 | color('white') 34 | fillcolor('white') 35 | begin_fill() 36 | fd(-160) 37 | fd(260) 38 | circle(50,150) 39 | circle(50,50) 40 | for i in range(3): 41 | rt(100) 42 | circle(50,100+i*10) 43 | lt(30) 44 | rt(150) 45 | circle(40,136) 46 | ht() 47 | end_fill() 48 | width(3) 49 | color('black') 50 | up() 51 | goto(180,200) 52 | down() 53 | rt(140) 54 | circle(50,70) 55 | rt(145) 56 | up() 57 | goto(180,200) 58 | down() 59 | circle(-50,70) 60 | up() 61 | goto(270,210) 62 | down() 63 | rt(-142) 64 | circle(50,70) 65 | rt(147) 66 | up() 67 | goto(270,210) 68 | down() 69 | circle(-50,70) 70 | up() 71 | goto(-650,-100) 72 | rt(16) 73 | down() 74 | color('brown') 75 | fillcolor('brown') 76 | fd(-25) 77 | fd(1345) 78 | begin_fill() 79 | for p in range(9): 80 | lt(120) 81 | fd(150) 82 | lt(120) 83 | fd(150) 84 | lt(120) 85 | end_fill() 86 | color('light green') 87 | fillcolor('light green') 88 | begin_fill() 89 | rt(90) 90 | fd(250) 91 | rt(-90) 92 | fd(1355) 93 | rt(-90) 94 | fd(250) 95 | rt(-90) 96 | fd(1355) 97 | end_fill() 98 | rt(-90) 99 | up() 100 | goto(230,-150) 101 | down() 102 | color('brown') 103 | fillcolor('brown') 104 | begin_fill() 105 | for i in range(2): 106 | fd(50) 107 | lt(90) 108 | fd(10) 109 | lt(90) 110 | end_fill() 111 | up() 112 | goto(215,-142) 113 | down() 114 | color('forest green') 115 | fillcolor('forest green') 116 | begin_fill() 117 | for c in range(6): 118 | circle(10,180) 119 | rt(180) 120 | circle(10,180) 121 | rt(120) 122 | end_fill() 123 | end=time.time() 124 | d=end-start 125 | title('Scenery completed in '+str(d)+' seconds') 126 | messagebox.showinfo('Execution Time',f"Runtime of the program is {end - start} seconds") 127 | def main(): 128 | reset() 129 | sun_sky() 130 | ht() 131 | if __name__=='__main__': 132 | main() 133 | mainloop() 134 | -------------------------------------------------------------------------------- /Turtle Art/sunflowerGood.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | def flower(): 3 | speed(-1) 4 | color('orange') 5 | begin_fill() 6 | fillcolor('yellow') 7 | for i in range(40): 8 | lt(210) 9 | lt(180) 10 | circle(40,100) 11 | lt(180) 12 | circle(40,100) 13 | end_fill() 14 | color('brown') 15 | begin_fill() 16 | fillcolor('brown') 17 | up() 18 | goto(-49,163) 19 | down() 20 | circle(60) 21 | end_fill() 22 | def stick(): 23 | width(5) 24 | color('green') 25 | up() 26 | goto(-28,0) 27 | down() 28 | rt(-70) 29 | fd(300) 30 | def leaf(): 31 | width(2) 32 | rt(180) 33 | up() 34 | fd(170) 35 | down() 36 | color('light green') 37 | begin_fill() 38 | fillcolor('light green') 39 | circle(50,100) 40 | lt(80) 41 | circle(50,100) 42 | end_fill() 43 | def leaf2(): 44 | begin_fill() 45 | fillcolor('light green') 46 | rt(20) 47 | circle(50,100) 48 | lt(80) 49 | circle(50,100) 50 | end_fill() 51 | def main(): 52 | reset() 53 | flower() 54 | stick() 55 | leaf() 56 | leaf2() 57 | ht() 58 | if __name__=='__main__': 59 | main() 60 | mainloop() 61 | -------------------------------------------------------------------------------- /Turtle Graphics/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | ## Script - Turtle Graphics 10 | 11 | Code using turtle graphics 12 | TurtleGraphics.py 13 | 14 | -------------------------------------------------------------------------------- /Turtle Graphics/TurtleGraphics.py: -------------------------------------------------------------------------------- 1 | #Python Turtle Graphics 2 | import turtle 3 | window=turtle.Screen() 4 | 5 | window.bgcolor("pink") 6 | dhanush=turtle.Turtle() 7 | dhanush.shape("turtle") 8 | dhanush.color("green") 9 | dhanush.speed(5) 10 | def draw_square(dhanush): 11 | for i in range(1,5): 12 | dhanush.forward(100) 13 | dhanush.left(90) 14 | for i in range(1,38): 15 | draw_square(dhanush) 16 | dhanush.right(10) 17 | dhanush.forward(300) 18 | -------------------------------------------------------------------------------- /Twitter Selenium Bot/README.md: -------------------------------------------------------------------------------- 1 | # selenium-twitter-bot 2 | Selenium based solution for creating a twitter bot. Selenium is a very powerful tool for web automation and scraping. For making Twitter bot, one can use Twitter api, but its paid. This solution on the other hand is not but does require much more work to get things right. 3 | 4 | ## Features: 5 | - Logging into your Twitter account 6 | - Liking tweets of your homepage 7 | - Searching for some keyword or hashtag 8 | - Liking tweets of the search results 9 | - Posting tweets 10 | - Logging out of your account 11 | 12 | ## Running project locally: 13 | 14 | 1. Have `python` environment setup 15 | 2. Clone the repo and go to the cloned directory 16 | 3. Run `pip3 install selenium` 17 | 4. Now you may run any of the given example scripts or write and execute your own scripts 18 | 19 | ## Examples: 20 | 21 | All the following tasks are completely automated without any manual user input. The script launches Firefox instance and carrys out the tasks provided. 22 | #### Posting Tweets 23 | ![tweet2gif](https://user-images.githubusercontent.com/44807945/87979619-f7b43b80-caef-11ea-8f63-266c8ed9c481.gif) 24 | 25 | #### Adding likes to tweets on homepage 26 | ![tweet1gif](https://user-images.githubusercontent.com/44807945/87979792-3a761380-caf0-11ea-8a8f-433fe46f8526.gif) 27 | 28 | #### Adding likes to tweets on search results of some query 29 | ![tweet3gif](https://user-images.githubusercontent.com/44807945/87979877-5aa5d280-caf0-11ea-8738-f2c29a37edca.gif) 30 | 31 | -------------------------------------------------------------------------------- /Twitter Selenium Bot/like_tweets_homepage.py: -------------------------------------------------------------------------------- 1 | import os 2 | from twitter_bot_class import TwitterBot 3 | 4 | # writing this sample comment on my github codespace beta access 5 | 6 | if __name__ == "__main__": 7 | try: 8 | pj = TwitterBot(os.environ['EMAIL'], os.environ['PASSWORD']) 9 | pj.login() 10 | pj.like_tweets(10) 11 | pj.logout() 12 | except Exception as e: 13 | pj.logout() 14 | print(e) 15 | 16 | -------------------------------------------------------------------------------- /Twitter Selenium Bot/like_tweets_keyword.py: -------------------------------------------------------------------------------- 1 | import os 2 | from twitter_bot_class import TwitterBot 3 | 4 | if __name__ == "__main__": 5 | try: 6 | pj = TwitterBot(os.environ['EMAIL'], os.environ['PASSWORD']) 7 | pj.login() 8 | pj.search('100DaysOfCode') 9 | pj.like_tweets(10) 10 | pj.logout() 11 | except Exception as e: 12 | pj.logout() 13 | print(e) 14 | -------------------------------------------------------------------------------- /Twitter Selenium Bot/post_tweet.py: -------------------------------------------------------------------------------- 1 | import os 2 | from twitter_bot_class import TwitterBot 3 | 4 | if __name__ == "__main__": 5 | try: 6 | pj = TwitterBot(os.environ['EMAIL'], os.environ['PASSWORD']) 7 | pj.login() 8 | pj.post_tweets("My bot's first tweet!") 9 | pj.logout() 10 | except Exception as e: 11 | pj.logout() 12 | print(e) 13 | 14 | -------------------------------------------------------------------------------- /URL Shortener/urlshortener.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def shorten_url_with_tinyurl(long_url): 4 | url = f'http://tinyurl.com/api-create.php?url={long_url}' 5 | response = requests.get(url) 6 | if response.status_code == 200: 7 | return response.text 8 | else: 9 | return None 10 | 11 | long_url = r"INSERT YOUR LONG URL HERE" 12 | short_url = shorten_url_with_tinyurl(long_url) 13 | 14 | if short_url: 15 | print(f'Shortened URL: {short_url}') 16 | else: 17 | print('Error shortening URL') -------------------------------------------------------------------------------- /Umbrella Reminder/umbrellaReminder.py: -------------------------------------------------------------------------------- 1 | import schedule 2 | import smtplib 3 | import requests 4 | from bs4 import BeautifulSoup 5 | 6 | 7 | def umbrellaReminder(): 8 | city = "Hyderabad" 9 | 10 | # creating url and requests instance 11 | url = "https://www.google.com/search?q=" + "weather" + city 12 | html = requests.get(url).content 13 | 14 | # getting raw data 15 | soup = BeautifulSoup(html, 'html.parser') 16 | temperature = soup.find('div', 17 | attrs={'class': 'BNeawe iBp4i AP7Wnd'}).text 18 | time_sky = soup.find('div', 19 | attrs={'class': 'BNeawe tAd8D AP7Wnd'}).text 20 | 21 | # formatting data 22 | sky = time_sky.split('\n')[1] 23 | 24 | if sky == "Rainy" or sky == "Rain And Snow" or sky == "Showers" or sky == "Haze" or sky == "Cloudy": 25 | smtp_object = smtplib.SMTP('smtp.gmail.com', 587) 26 | 27 | # start TLS for security 28 | smtp_object.starttls() 29 | 30 | # Authentication 31 | smtp_object.login("YOUR EMAIL", "PASSWORD") 32 | subject = "GeeksforGeeks Umbrella Reminder" 33 | body = f"Take an umbrella before leaving the house.\ 34 | Weather condition for today is {sky} and temperature is\ 35 | {temperature} in {city}." 36 | msg = f"Subject:{subject}\n\n{body}\n\nRegards,\nGeeksforGeeks".encode( 37 | 'utf-8') 38 | 39 | # sending the mail 40 | smtp_object.sendmail("FROM EMAIL", 41 | "TO EMAIL", msg) 42 | 43 | # terminating the session 44 | smtp_object.quit() 45 | print("Email Sent!") 46 | 47 | 48 | # Every day at 06:00AM time umbrellaReminder() is called. 49 | schedule.every().day.at("06:00").do(umbrellaReminder) 50 | 51 | while True: 52 | schedule.run_pending() 53 | -------------------------------------------------------------------------------- /Video Downloader/README.md: -------------------------------------------------------------------------------- 1 | This repository consists of a list of python scripts to automate few tasks. 2 | 3 | You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. 4 | Incase you have anything to be followed while executing the python script mention it as well 5 | 6 | 7 | # Python Script 8 | 9 | ## Script - Video Downloader 10 | 11 | VideoDownloader.py 12 | 13 | -------------------------------------------------------------------------------- /Video Downloader/VideoDownloader.py: -------------------------------------------------------------------------------- 1 | from pytube import YouTube 2 | link = input("Enter the link: ") 3 | video = YouTube(link) 4 | stream = video.streams.get_highest_resolution() 5 | stream.download() -------------------------------------------------------------------------------- /Video Watermarker/VideoWatermarker.py: -------------------------------------------------------------------------------- 1 | # Video Watermark with Python 2 | # pip install moviepy 3 | from moviepy.editor import * 4 | clip = VideoFileClip("myvideo.mp4", audio=True) 5 | width,height = clip.size 6 | text = TextClip("WaterMark", font='Arial', color='white', fontsize=28) 7 | set_color = text.on_color(size=(clip.w + text.w, text.h-10), color=(0,0,0), pos=(6,'center'), col_opacity=0.6) 8 | set_textPos = set_color.set_pos( lambda pos: (max(width/30,int(width-0.5* width* pos)),max(5*height/6,int(100* pos))) ) 9 | Output = CompositeVideoClip([clip, set_textPos]) 10 | Output.duration = clip.duration 11 | Output.write_videofile("output.mp4", fps=30, codec='libx264') 12 | -------------------------------------------------------------------------------- /Virtual Painter/tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/Virtual Painter/tools.png -------------------------------------------------------------------------------- /Wallpaper Changer/wallpaperchanger.py: -------------------------------------------------------------------------------- 1 | import requests,ctypes,os,numpy as np 2 | from PIL import Image,ImageFont,ImageDraw 3 | import yfinance as yf 4 | from datetime import datetime 5 | 6 | #enable or disable any functionality 7 | enable_time=True 8 | enable_tickers=True 9 | enable_quote=True 10 | 11 | now = datetime.now() 12 | current_time = now.strftime("%H:%M:%S") 13 | 14 | tickers=[ 15 | ("^GSPC","s&p500"), 16 | ("aapl","aapl"), 17 | ("msft","msft"), 18 | ("goog","googl"), 19 | ("amzn","amzn"), 20 | ("tsla","tsla"), 21 | ("BTC-USD","btc"), 22 | ("ETH-USD","eth") 23 | ] 24 | 25 | def add_margin(img,top,left,bottom,right,color): 26 | width, height = img.size 27 | new_width = width + right + left 28 | new_height = height + top + bottom 29 | result = Image.new(img.mode, (new_width, new_height),color) 30 | result.paste(img, (left, top)) 31 | return result 32 | def conv_to_size(path,path_to_save=None): 33 | z=Image.open(path) 34 | if z.size[0]/1920>z.size[1]/1080: 35 | vres=z.size[0]*1080/1920 36 | vres=vres-z.size[1] 37 | vres=int(vres/2) 38 | res=add_margin(z,vres,0,vres,0,(0,0,0)) 39 | else: 40 | hres=z.size[1]*1920/1080 41 | hres=hres-z.size[0] 42 | hres=int(hres/2) 43 | res=add_margin(z,0,hres,0,hres,(0,0,0)) 44 | if path_to_save is not None: 45 | res.save(path_to_save) 46 | else: 47 | res.save(path) 48 | def ret_change(ticker): 49 | x= yf.Ticker(ticker) 50 | z=x.history(period="3d") 51 | return (((z.iloc[-1]["Close"]-z.iloc[-2]["Close"])/z.iloc[-2]["Close"])*100).round(2),z.iloc[-1]["Close"].round(2) 52 | 53 | z=os.listdir("path/to/folder/containing/images") 54 | 55 | #opening random image 56 | path="path/to/folder/containing/images"+z[np.random.randint(len(z))] 57 | z=Image.open(path) 58 | 59 | #check if in correct proportion, pad if it isnt 60 | if z.size[0]/z.size[1]>1.78 or z.size[0]/z.size[1]<1.76: 61 | conv_to_size(path) 62 | z=Image.open(path) 63 | 64 | #resizing to perfect resolution 65 | z=z.resize((1920,1080)) 66 | 67 | 68 | #start drawing 69 | I1 = ImageDraw.Draw(z) 70 | if enable_quote: 71 | try:#write a quote on the image if it is fetched succesfully 72 | 73 | myFont = ImageFont.truetype("path/to/.ttf/font/file",20) 74 | l="http://api.quotable.io/random" 75 | r=requests.get(l) 76 | r=r.json() 77 | text=r["content"]+" - "+r["author"] 78 | 79 | I1.text((10,1050), text, font=myFont, fill =(255, 255, 255)) 80 | except: 81 | pass 82 | if enable_time: 83 | try: 84 | I1.text((1830,1050), current_time, font=myFont, fill =(255, 255, 255)) 85 | except: 86 | pass 87 | if enable_tickers: 88 | try: 89 | ticpos=10 90 | for i,j in tickers: 91 | chn,pc=ret_change(i) 92 | I1.text((1670,ticpos),j, font=myFont, fill =(255,255,255)) 93 | if chn>=0: 94 | I1.text((1750,ticpos),str(chn)+"%", font=myFont, fill =(0,255,0)) 95 | I1.text((1830,ticpos),str(pc), font=myFont, fill =(0,255,0)) 96 | else: 97 | I1.text((1750,ticpos),str(abs(chn))+"%", font=myFont, fill =(255,0,0)) 98 | I1.text((1830,ticpos),str(pc), font=myFont, fill =(255,0,0)) 99 | 100 | ticpos+=25 101 | except: 102 | pass 103 | 104 | try:#save as jpg 105 | save_path="path/to/save/temp/wallpaper/in/.jpg/format" 106 | z.save(save_path,quality="high") 107 | ctypes.windll.user32.SystemParametersInfoW(20, 0, save_path, 0) 108 | except:#or save as png 109 | save_path="path/to/save/temp/wallpaper/in/.png/format" 110 | z.save("D:/Pictures/temp.png",quality="high") 111 | ctypes.windll.user32.SystemParametersInfoW(20, 0, save_path , 0) -------------------------------------------------------------------------------- /Weather GUI/weather.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | import requests 3 | import time 4 | 5 | 6 | def getWeather(canvas): 7 | city = textField.get() 8 | api = "https://api.openweathermap.org/data/2.5/weather?q="+city+"&appid=06c921750b9a82d8f5d1294e1586276f" 9 | 10 | json_data = requests.get(api).json() 11 | condition = json_data['weather'][0]['main'] 12 | temp = int(json_data['main']['temp'] - 273.15) 13 | min_temp = int(json_data['main']['temp_min'] - 273.15) 14 | max_temp = int(json_data['main']['temp_max'] - 273.15) 15 | pressure = json_data['main']['pressure'] 16 | humidity = json_data['main']['humidity'] 17 | wind = json_data['wind']['speed'] 18 | sunrise = time.strftime('%I:%M:%S', time.gmtime(json_data['sys']['sunrise'] - 21600)) 19 | sunset = time.strftime('%I:%M:%S', time.gmtime(json_data['sys']['sunset'] - 21600)) 20 | 21 | final_info = condition + "\n" + str(temp) + "°C" 22 | final_data = "\n"+ "Min Temp: " + str(min_temp) + "°C" + "\n" + "Max Temp: " + str(max_temp) + "°C" +"\n" + "Pressure: " + str(pressure) + "\n" +"Humidity: " + str(humidity) + "\n" +"Wind Speed: " + str(wind) + "\n" + "Sunrise: " + sunrise + "\n" + "Sunset: " + sunset 23 | label1.config(text = final_info) 24 | label2.config(text = final_data) 25 | 26 | 27 | canvas = tk.Tk() 28 | canvas.geometry("600x500") 29 | canvas.title("Weather App") 30 | f = ("poppins", 15, "bold") 31 | t = ("poppins", 35, "bold") 32 | 33 | textField = tk.Entry(canvas, justify='center', width = 20, font = t) 34 | textField.pack(pady = 20) 35 | textField.focus() 36 | textField.bind('', getWeather) 37 | 38 | label1 = tk.Label(canvas, font=t) 39 | label1.pack() 40 | label2 = tk.Label(canvas, font=f) 41 | label2.pack() 42 | canvas.mainloop() 43 | -------------------------------------------------------------------------------- /Website Blocker/mac/Website_Blocker.py: -------------------------------------------------------------------------------- 1 | Run this script as root 2 | 3 | import time 4 | from datetime import datetime as dt 5 | 6 | # change hosts path according to your OS 7 | hosts_path = " 8 | /etc/hosts & quot 9 | # localhost's IP 10 | redirect = " 11 | 127.0.0.1 & quot 12 | 13 | # websites That you want to block 14 | website_list = 15 | [ & quot 16 | www.facebook.com & quot, & quot 17 | facebook.com" 18 | , 19 | & quot 20 | dub119.mail.live.com" 21 | , & quot 22 | www.dub119.mail.live.com" 23 | , 24 | & quot 25 | www.gmail.com" 26 | , & quot 27 | gmail.com" 28 | ] 29 | 30 | while True: 31 | 32 | # time of your work 33 | if dt(dt.now().year, dt.now().month, dt.now().day, 8) 34 | < 35 | dt.now() & lt 36 | dt(dt.now().year, dt.now().month, dt.now().day, 16): 37 | print( & quot 38 | Working hours... & quot 39 | ) 40 | with open(hosts_path, 'r+') as file: 41 | content = file.read() 42 | for website in website_list: 43 | if website in content: 44 | pass 45 | else: 46 | # mapping hostnames to your localhost IP address 47 | file.write(redirect + " 48 | & quot 49 | + website + " 50 | \n & quot 51 | ) 52 | else: 53 | with open(hosts_path, 'r+') as file: 54 | content = file.readlines() 55 | file.seek(0) 56 | for line in content: 57 | if not any(website in line for website in website_list): 58 | file.write(line) 59 | 60 | # removing hostnmes from host file 61 | file.truncate() 62 | -------------------------------------------------------------------------------- /Website Blocker/read.me: -------------------------------------------------------------------------------- 1 | This is real world program which blocks certain distracting website like Facebook, 2 | Youtube etc during your work hours. About the program : What we are going to in this 3 | program is that we will pass the link of websites which you think is distracting and the 4 | time that you are working on your computer and program will block those website. 5 | Program Architecture: 6 | for mac:- 7 | 1. Every system have host file whether it is Mac, Windows or Linux. 8 | Host file in Mac and Linux : "/etc/hosts"\ 9 | 10 | 11 | for windows:- 12 | C:\Windows\System32\drivers\etc 13 | -------------------------------------------------------------------------------- /Website Cloner/README.md: -------------------------------------------------------------------------------- 1 | # Python Script 2 | 3 | ## Script - Website Cloner 4 | 5 | ### Run server 6 | python sever.py 7 | 8 | ### Open local site in browser 9 | http://127.0.0.1:7000/ 10 | 11 | Enter a website link and click Clone Now 12 | It downloads the website and loads the home page of the website in your local IP 13 | -------------------------------------------------------------------------------- /Website Cloner/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PROXY SERVER 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |
14 |
15 |
16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 27 |
28 |
29 |
30 |
31 |
32 | 33 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Website Cloner/server.py: -------------------------------------------------------------------------------- 1 | import cgi 2 | import http.server 3 | import socketserver 4 | import os 5 | from pywebcopy import save_webpage 6 | 7 | class RequestHandler(http.server.SimpleHTTPRequestHandler): 8 | def do_GET(self): 9 | if self.path == "/": 10 | self.path = "index.html" 11 | return http.server.SimpleHTTPRequestHandler.do_GET(self) 12 | def do_POST(self): 13 | form = cgi.FieldStorage( 14 | fp=self.rfile, 15 | headers=self.headers, 16 | environ={ 17 | 'REQUEST_METHOD': 'POST', 18 | 'CONTENT_TYPE': self.headers['Content-Type'], 19 | }) 20 | url = form.getvalue('submitButton') 21 | urlN = 'https://' + str(url) +'/' 22 | isdir = os.path.isdir(url) 23 | if not isdir: 24 | kwargs = {'project_name': url} 25 | save_webpage( 26 | url=urlN, 27 | project_folder='./', 28 | **kwargs 29 | ) 30 | path = url + "/" + url + "/index.html" 31 | self.send_response(301) 32 | self.send_header('Location', path) 33 | self.end_headers() 34 | return http.server.SimpleHTTPRequestHandler.do_GET(self) 35 | 36 | PORT = 7000 37 | s = socketserver.TCPServer(("127.0.0.1", PORT), RequestHandler) 38 | s.serve_forever() -------------------------------------------------------------------------------- /Weight Converter/readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Weight Converter 3 | 4 | A simple GUI script that let you convert wieght in different measurement units. 5 | 6 | Made with Python using Tkinter module. 7 | 8 | 9 | 10 | 11 | # Modules 12 | 13 | If not pre-installed, install tkinter with the following command: 14 | (Clone and move to the directory before installation) 15 | 16 | ``` 17 | 18 | pip install -r requirements.txt 19 | ``` 20 | 21 | # Use 22 | 23 | Simply run the script via terminal and use the GUI. 24 | 25 | 26 | ## Demo 27 | 28 | ![Demo](https://i.imgur.com/cgoSfWP.png) 29 | 30 | -------------------------------------------------------------------------------- /Weight Converter/requirements.txt: -------------------------------------------------------------------------------- 1 | tkinter 2 | -------------------------------------------------------------------------------- /Weight Converter/weight.py: -------------------------------------------------------------------------------- 1 | #A simple gui script to convert weight in different measurement units 2 | #Author: Siddhant N. 3 | 4 | #modules 5 | import tkinter 6 | from tkinter import Label, StringVar, Entry, Text, Button, END 7 | 8 | 9 | #initialize window 10 | 11 | main = tkinter.Tk() 12 | main.title("WeightTable") 13 | main.resizable(0, 0) 14 | main.configure(bg='#0492C2') 15 | 16 | 17 | def val_kg(): 18 | #kilograms to grams 19 | gram = float(e2_value.get()) * 1000 20 | #kilograms to pound 21 | pound = float(e2_value.get()) * 2.20462 22 | #kilograms to ounce 23 | ounce = float(e2_value.get()) * 35.274 24 | 25 | #converted text to text widget 26 | t1.delete("1.0", END) 27 | t1.insert(END, gram) 28 | 29 | t2.delete("1.0", END) 30 | t2.insert(END, pound) 31 | 32 | t3.delete("1.0", END) 33 | t3.insert(END, ounce) 34 | 35 | #label widgets 36 | e1 = Label(main, text="Enter Weight In Kilograms") 37 | e2_value = StringVar() 38 | e2 = Entry(main, textvariable=e2_value) 39 | e3 = Label(main, text="Gram") 40 | e4 = Label(main, text="Pound") 41 | e5 = Label(main, text="Ounce") 42 | 43 | #Text Widgets 44 | 45 | t1 = Text(main, height=1, width=20) 46 | t2 = Text(main, height=1, width=20) 47 | t3 = Text(main, height=1, width=20) 48 | 49 | #Convert Button 50 | convert_btn = Button(main, text='Covert', command=val_kg) 51 | 52 | #geometry specifiers; grid method. 53 | 54 | e1.grid(row=0, column=0) 55 | e2.grid(row=0, column=1) 56 | e3.grid(row=1, column=0) 57 | e4.grid(row=1, column=1) 58 | e5.grid(row=1, column=2) 59 | t1.grid(row=2, column=0) 60 | t2.grid(row=2, column=1) 61 | t3.grid(row=2, column=2) 62 | convert_btn.grid(row=0, column=2) 63 | 64 | #run main 65 | 66 | main.mainloop() 67 | -------------------------------------------------------------------------------- /Wikipedia Data Extractor/README.md: -------------------------------------------------------------------------------- 1 | # To Run This Wikipedia Extractor Code Using Python 2 | 3 | ### **You need to install 'wikipedia' library using pip** 4 | 5 | #### Steps to Install 'wikipedia' 6 | 7 | 8 | 9 | **First create virtual env in your IDE and set it by using given commands** 10 | 11 | ##### macOS 12 | ``` 13 | python3 -m venv .venv 14 | source .venv/bin/activate 15 | ``` 16 | 17 | 18 | ##### Linux 19 | 20 | ``` 21 | sudo apt-get install python3-venv #If needed 22 | python3 -m venv .venv 23 | source .venv/bin/activate 24 | ``` 25 | 26 | ##### Windows 27 | ``` 28 | py -3 -m venv .venv 29 | .venv\scripts\activate 30 | ``` 31 | 32 | use this command in your virtual env to install wikipedia 33 | 34 | ``` 35 | pip install wikipedia 36 | ``` 37 | 38 | 39 | ------- 40 | **Now you can run this in your IDE** 41 | 42 | ###### **You can change "language = jp" to another language you wish to translate to as well.** 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Wikipedia Data Extractor/wikipedia_extractor.py: -------------------------------------------------------------------------------- 1 | import wikipedia 2 | 3 | search=input("Enter the topic you want: ") 4 | print(wikipedia.summary(search)) 5 | 6 | language = "jp" 7 | wikipedia.set_lang(language) 8 | 9 | print(f"Summary of Open source in {language}:", wikipedia.page("Open Source").summary) -------------------------------------------------------------------------------- /Word to PDF converter/wordToPDF.py: -------------------------------------------------------------------------------- 1 | import os 2 | from docx2pdf import convert 3 | 4 | def convert_word_to_pdf(word_file_path): 5 | try: 6 | output_pdf_path = os.path.splitext(word_file_path)[0] + ".pdf" 7 | convert(word_file_path, output_pdf_path) 8 | print("Conversion successful. PDF saved") 9 | except Exception as e: 10 | print(f"Error occurred during conversion: {e}") 11 | 12 | if __name__ == "__main__": 13 | # Replace the paths below with the actual paths of your Word files 14 | word_files = [ 15 | r"enter word file location path 1", 16 | r"enter word file location path 2", 17 | r"enter word file location path 3", 18 | r"enter word file location path 4", 19 | r"enter word file location path 5", 20 | r"enter word file location path 6", 21 | r"enter word file location path 7", 22 | r"enter word file location path 8", 23 | r"enter word file location path 9", 24 | # you can add as many as you want 25 | ] 26 | 27 | for word_file_path in word_files: 28 | convert_word_to_pdf(word_file_path) 29 | -------------------------------------------------------------------------------- /Youtube Downloader/README.md: -------------------------------------------------------------------------------- 1 | # Youtube Downloader 2 | 3 | ### This is a simple youtube downloader that uses pafy to download videos from youtube. 4 | You have the options to download in video or audio format. 5 | 6 | * # Syntax: 7 | ```python 8 | python youtubeDownloader.py 9 | ``` -------------------------------------------------------------------------------- /Youtube Downloader/youtubeDownloader.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author: https://github.com/AcidOP 3 | """ 4 | 5 | import os 6 | import pafy # pip install pafy 7 | from httpx import main # pip install httpx 8 | from youtubesearchpython import VideosSearch # pip install youtube-search-python 9 | 10 | 11 | def fetchVideoId(): 12 | song = input('[#] Name of the video > ') 13 | 14 | video_obj = VideosSearch(song, limit=1) 15 | # Video id of the song 16 | id = video_obj.result()['result'][0]['id'] 17 | 18 | return id 19 | 20 | 21 | def download(): 22 | id = fetchVideoId() 23 | 24 | video = pafy.new(id) 25 | 26 | isVideo = input("Is it to be sasved as Video? (Y/N): ") 27 | 28 | if isVideo.lower() == "y": 29 | best = video.getbest() 30 | else: 31 | best = video.getbestaudio() 32 | 33 | video_name = f"{best.title}.{best.extension}" 34 | current_dir = os.getcwd() 35 | # Create a folder to save the video 36 | if not os.path.exists(f"{current_dir}/videos"): 37 | os.mkdir(f"{current_dir}/videos") 38 | # Save the video 39 | print(f"[#] Downloading {video_name}...") 40 | best.download(filepath=f"{current_dir}/videos/{video_name}") 41 | print(f"[#] Downloaded {video_name}!") 42 | 43 | 44 | if __name__ == "__main__": 45 | download() 46 | -------------------------------------------------------------------------------- /emoji/emoji.py: -------------------------------------------------------------------------------- 1 | from reportlab.pdfgen import canvas 2 | from reportlab.lib.pagesizes import letter 3 | from reportlab.pdfbase import pdfmetrics 4 | from reportlab.pdfbase.ttfonts import TTFont 5 | 6 | def create_pdf_with_emoji(output_filename, emoji, font_path): 7 | # Create a canvas for the PDF 8 | c = canvas.Canvas(output_filename, pagesize=letter) 9 | 10 | # Register a custom emoji font 11 | pdfmetrics.registerFont(TTFont('EmojiFont', font_path)) 12 | 13 | # Set the font for the emoji 14 | c.setFont('EmojiFont', 36) 15 | 16 | # Add the emoji to the PDF 17 | c.drawString(100, 400, emoji) 18 | 19 | # Save the PDF 20 | c.save() 21 | 22 | if __name__ == "__main__": 23 | output_filename = "emoji.pdf" 24 | emoji = "😊" # Replace with the emoji you want to display 25 | font_path ="emoji.tiff" # Replace with the path to your emoji font 26 | 27 | create_pdf_with_emoji(output_filename, emoji, font_path) 28 | -------------------------------------------------------------------------------- /emoji/emoji.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/emoji/emoji.tiff -------------------------------------------------------------------------------- /emoji_to_pdf/Symbola_hint.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/emoji_to_pdf/Symbola_hint.ttf -------------------------------------------------------------------------------- /emoji_to_pdf/emoji.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/emoji_to_pdf/emoji.pdf -------------------------------------------------------------------------------- /emoji_to_pdf/emoji_to_pdf.py: -------------------------------------------------------------------------------- 1 | from reportlab.platypus import Paragraph 2 | from reportlab.lib.styles import getSampleStyleSheet 3 | from reportlab.pdfgen import canvas 4 | from reportlab.rl_config import defaultPageSize 5 | from reportlab.pdfbase import pdfmetrics 6 | from reportlab.pdfbase.ttfonts import TTFont 7 | from emojipy import Emoji 8 | import re 9 | 10 | Emoji.unicode_alt = False 11 | 12 | def create_emoji_pdf(txt, size): 13 | txt = Emoji.to_image(txt) 14 | txt = txt.replace('class="emojione " style="" ', 'height=%s width=%s' %(size, size)) 15 | return re.sub('alt="'+Emoji.shortcode_regexp+'"', '', txt) 16 | 17 | txt_file = "Hello World 😂👍😂🙌😉🤳🤷‍♀️🙌😁🎂🐱‍👤🤳✔💋🐱‍👓🐱‍👓😃🎁" 18 | symbola_font = TTFont('Symbola', 'Symbola_hint.ttf') 19 | pdfmetrics.registerFont(symbola_font) 20 | width, height = defaultPageSize 21 | styles = getSampleStyleSheet() 22 | styles["Title"].fontName = 'Symbola' 23 | style = styles["Title"] 24 | content = create_emoji_pdf(Emoji.to_image(txt_file), style.fontSize) 25 | para = Paragraph(content, style) 26 | canv = canvas.Canvas('emoji.pdf') 27 | para.wrap(width, height) 28 | para.drawOn(canv, 0, height/2) 29 | canv.save() -------------------------------------------------------------------------------- /emoji_to_pdf/requirements.txt: -------------------------------------------------------------------------------- 1 | emojipy == 3.0.5 2 | reportlab ==4.0.7 3 | six == 1.16.0 4 | -------------------------------------------------------------------------------- /freelance-help-program/README.md: -------------------------------------------------------------------------------- 1 | # freelance-help-program 2 | This software is designed to help freelancers calculate their payment based on hours worked. It takes an Excel file as input, where the start time is written in the first column and the end time is written in the second column. The software calculates the total time and the amount to be paid according to the hourly payment entered by the user. 3 | 4 | ## Installation 5 | 6 | Layer the repository or download the code files. 7 | Install the required dependencies by running the following command: 8 | pip install openpyxl 9 | 10 | ## Usage 11 | 12 | 1. Run the program by executing the following command: 13 | python calculate_payment.py 14 | 15 | The program will open a graphical user interface (GUI) window. 16 | Click the "Browse" button to select the Excel file containing the time values. 17 | Enter the hourly rate in the appropriate input field. 18 | Click the "Calculate" button to calculate the payment. 19 | The program will display a message box with the total payment amount. 20 | The modified Excel file with the calculated results will be saved as "modified_[original_file_name].xlsx". 21 | 22 | Note: Make sure the Excel file has the correct format, with the start time in the first column and the end time in the second column. 23 | -------------------------------------------------------------------------------- /import of music and video/Readme.md: -------------------------------------------------------------------------------- 1 | **ABOUT** 2 | # Music Player 3 | 4 | A simple Python script that provides a graphical user interface (GUI) for playing music files. This script uses `tkinter` for the GUI and `pygame` for audio playback. 5 | 6 | ## Prerequisites 7 | 8 | Before you begin, ensure you have met the following requirements: 9 | 10 | - Python3 installed. 11 | - The `pygame` library installed. You can install it using pip: 12 | 13 | ```bash 14 | pip install pygame 15 | 16 | 17 | ## Usage 18 | Clone or download this repository to your local machine. 19 | Open your terminal or command prompt and navigate to the project directory. 20 | 21 | Run the script using Python: 22 | bash 23 | python music_player.py 24 | Click the "Open Music File" button to select an MP3 or WAV music file from your computer. 25 | 26 | The selected music file will be played using the pygame mixer. 27 | 28 | 29 | **Troubleshooting** 30 | If you encounter any issues while using the music player, please consider the following troubleshooting steps: 31 | 32 | 1. Ensure you have Python 3 installed. 33 | 2. Verify that pygame is installed by running pip show pygame. 34 | 3. Check your system's audio settings for playback. 35 | 36 | ------------------------------------------------------------------------------------------------------------------------------------------ 37 | 38 | **README.md for Video Player Script:** 39 | 40 | # Video Player 41 | 42 | A Python script that provides a graphical user interface (GUI) for playing video files (MP4 or AVI). This script uses `tkinter` for the GUI and relies on the [OpenCV](https://opencv.org/) library for video playback. 43 | 44 | ## Prerequisites 45 | 46 | Before you begin, ensure you have met the following requirements: 47 | 48 | - Python 3 installed. 49 | - The [OpenCV](https://opencv.org/) library installed. You can install it using pip: 50 | 51 | ```bash 52 | pip install opencv-python 53 | 54 | **Usage** 55 | Clone or download this repository to your local machine. 56 | Open your terminal or command prompt and navigate to the project directory. 57 | 58 | Run the script using Python: 59 | bash 60 | python video_player.py 61 | Click the "Open Video File" button to select an MP4 or AVI video file from your computer. 62 | 63 | The selected video file will be played using the OpenCV-based video player. 64 | 65 | 66 | **Troubleshooting** 67 | If you encounter any issues while using the video player, please consider the following troubleshooting steps: 68 | 69 | 1. Ensure you have Python 3 installed. 70 | 2. Verify that opencv-python is installed by running pip show opencv-python. 71 | 3. Check your system's video codec support and audio settings. 72 | 73 | -------------------------------------------------------------------------------- /import of music and video/import.music.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pygame 3 | import tkinter as tk 4 | from tkinter import filedialog 5 | from tkinter import ttk 6 | 7 | # Initialize pygame mixer 8 | pygame.mixer.init() 9 | 10 | # Function to list music files in a directory 11 | def list_music_files(directory): 12 | music_files = [] 13 | for root, _, files in os.walk(directory): 14 | for file in files: 15 | if file.endswith((".mp3", ".wav")): 16 | music_files.append(os.path.join(root, file)) 17 | return music_files 18 | 19 | # Function to play music 20 | def play_music(): 21 | selected_item = music_listbox.curselection() 22 | if selected_item: 23 | index = int(selected_item[0]) 24 | pygame.mixer.music.load(music_files[index]) 25 | pygame.mixer.music.play() 26 | 27 | # Function to pause music 28 | def pause_music(): 29 | pygame.mixer.music.pause() 30 | 31 | # Function to resume music 32 | def resume_music(): 33 | pygame.mixer.music.unpause() 34 | 35 | # Function to stop music 36 | def stop_music(): 37 | pygame.mixer.music.stop() 38 | 39 | # Function to open a directory dialog and set the music directory 40 | def choose_directory(): 41 | global music_directory 42 | music_directory = filedialog.askdirectory() 43 | music_files = list_music_files(music_directory) 44 | music_listbox.delete(0, tk.END) 45 | for file in music_files: 46 | music_listbox.insert(tk.END, os.path.basename(file)) 47 | 48 | # Create a tkinter window 49 | root = tk.Tk() 50 | # Adjust size 51 | root.geometry("420x300") 52 | 53 | # set minimum window size value 54 | root.minsize(420, 300) 55 | 56 | # set maximum window size value 57 | root.maxsize(420, 300) 58 | root.title("Video Player") 59 | root.title("Music Player") 60 | 61 | # Create and configure a frame for buttons 62 | button_frame = ttk.Frame(root) 63 | button_frame.grid(row=1, column=0, padx=20, pady=10) 64 | 65 | # Create buttons 66 | play_button = ttk.Button(button_frame, text="Play", command=play_music) 67 | pause_button = ttk.Button(button_frame, text="Pause", command=pause_music) 68 | resume_button = ttk.Button(button_frame, text="Resume", command=resume_music) 69 | stop_button = ttk.Button(button_frame, text="Stop", command=stop_music) 70 | 71 | # Grid layout for buttons 72 | play_button.grid(row=0, column=0, padx=10) 73 | pause_button.grid(row=0, column=1, padx=10) 74 | resume_button.grid(row=0, column=2, padx=10) 75 | stop_button.grid(row=0, column=3, padx=10) 76 | 77 | # Create a frame for the music list 78 | list_frame = ttk.Frame(root) 79 | list_frame.grid(row=0, column=0, padx=20, pady=10) 80 | 81 | # Create a listbox to display music files 82 | music_listbox = tk.Listbox(list_frame, selectmode=tk.SINGLE, width=50) 83 | music_listbox.pack() 84 | 85 | # Create a button to choose the music directory 86 | choose_button = ttk.Button(list_frame, text="Choose Music Directory", command=choose_directory) 87 | choose_button.pack() 88 | 89 | # Initialize the music directory 90 | music_directory = "" 91 | 92 | # Run the tkinter main loop 93 | root.mainloop() 94 | -------------------------------------------------------------------------------- /import of music and video/import.vd.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pygame 3 | import tkinter as tk 4 | from tkinter import filedialog 5 | from tkinter import ttk 6 | 7 | # Initialize pygame 8 | pygame.init() 9 | 10 | # Function to list video files in a directory 11 | def list_video_files(directory): 12 | video_files = [] 13 | for root, _, files in os.walk(directory): 14 | for file in files: 15 | if file.endswith((".mp4", ".avi", ".mkv")): 16 | video_files.append(os.path.join(root, file)) 17 | return video_files 18 | 19 | # Function to play video 20 | def play_video(): 21 | selected_item = video_listbox.curselection() 22 | if selected_item: 23 | index = int(selected_item[0]) 24 | video = pygame.movie.Movie(video_files[index]) 25 | video.set_display(video_display) 26 | video.play() 27 | 28 | # Function to pause video 29 | def pause_video(): 30 | pygame.mixer.music.pause() 31 | 32 | # Function to resume video 33 | def resume_video(): 34 | pygame.mixer.music.unpause() 35 | 36 | # Function to stop video 37 | def stop_video(): 38 | pygame.mixer.music.stop() 39 | 40 | # Function to open a directory dialog and set the video directory 41 | def choose_directory(): 42 | global video_directory 43 | video_directory = filedialog.askdirectory() 44 | video_files = list_video_files(video_directory) 45 | video_listbox.delete(0, tk.END) 46 | for file in video_files: 47 | video_listbox.insert(tk.END, os.path.basename(file)) 48 | 49 | # Create a tkinter window 50 | root = tk.Tk() 51 | # Adjust size 52 | root.geometry("420x300") 53 | 54 | # set minimum window size value 55 | root.minsize(420, 300) 56 | 57 | # set maximum window size value 58 | root.maxsize(420, 300) 59 | root.title("Video Player") 60 | 61 | # Create and configure a frame for buttons 62 | button_frame = ttk.Frame(root) 63 | button_frame.grid(row=1, column=0, padx=20, pady=10) 64 | 65 | # Create buttons 66 | play_button = ttk.Button(button_frame, text="Play", command=play_video) 67 | pause_button = ttk.Button(button_frame, text="Pause", command=pause_video) 68 | resume_button = ttk.Button(button_frame, text="Resume", command=resume_video) 69 | stop_button = ttk.Button(button_frame, text="Stop", command=stop_video) 70 | 71 | # Grid layout for buttons 72 | play_button.grid(row=0, column=0, padx=10) 73 | pause_button.grid(row=0, column=1, padx=10) 74 | resume_button.grid(row=0, column=2, padx=10) 75 | stop_button.grid(row=0, column=3, padx=10) 76 | 77 | # Create a frame for the video list 78 | list_frame = ttk.Frame(root) 79 | list_frame.grid(row=0, column=0, padx=20, pady=10) 80 | 81 | # Create a listbox to display video files 82 | video_listbox = tk.Listbox(list_frame, selectmode=tk.SINGLE, width=50) 83 | video_listbox.pack() 84 | 85 | # Create a button to choose the video directory 86 | choose_button = ttk.Button(list_frame, text="Choose Video Directory", command=choose_directory) 87 | choose_button.pack() 88 | 89 | # Initialize the video directory 90 | video_directory = "" 91 | 92 | # Create a Pygame display for video playback 93 | video_display = pygame.display.set_mode((640, 480)) 94 | 95 | # Run the tkinter main loop 96 | root.mainloop() 97 | -------------------------------------------------------------------------------- /recently_accessed_files/README.MD: -------------------------------------------------------------------------------- 1 | # recently_accessed_files 2 | 3 | ## Introduction 4 | 5 | This Python script that extracts the path of recently accessed files in the specified directory. 6 | 7 | ## Usage 8 | 9 | ### Prerequisites 10 | 11 | Before using this script, ensure you have the following: 12 | 13 | - Python installed on your system. 14 | - Required libraries: `os`, `datetime` 15 | 16 | ### Running the Script 17 | 18 | 1. Run this script in your terminal. 19 | 20 | ```python 21 | $ python recently_accessed_files.py 22 | ``` 23 | 2. After running the python script we have to provide the desired directory from which we want to extract the paths. 24 | 25 | ```python 26 | $ Enter the directory path to search: 27 | ``` 28 | 3. Example Output 29 | 30 | ![Alt text](image-1.png) 31 | 32 | ### Information about .py file 33 | 34 | 1. `get_file_access_time` function 35 | 36 | - This function provides the time, in seconds since the Unix epoch, when the file was last accessed. 37 | - Args : 38 | - **file_path**: provided directory path 39 | - Returns: 40 | - access time 41 | 42 | 1. `get_recently_accessed_files` function 43 | 44 | - This function returns a list of recently accessed files in the given directory and its subdirectories, sorted by their access time in descending order. 45 | 46 | - Args : 47 | - **directory_path**: The path to the directory to search. 48 | - **time_threshold**: The time threshold in seconds since the Unix epoch. Only files accessed after the time threshold will be returned. If `None`, all files will be returned. 49 | 50 | - Returns: 51 | - A list of file paths, sorted by their access time in descending order. 52 | 53 | ### Output 54 | 55 | The script will create a list of recently accessed files. 56 | 57 | ### Example 58 | 59 | - file1.txt 60 | - file2.txt 61 | - file3.txt 62 | - file4.txt 63 | - file5.txt 64 | - file6.txt -------------------------------------------------------------------------------- /recently_accessed_files/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IT2Topper0127/Python-Scripts/17183f835b42a6615b72af8d1ecfa6bf0e9e34c7/recently_accessed_files/image-1.png -------------------------------------------------------------------------------- /recently_accessed_files/recently_accessed_files.py: -------------------------------------------------------------------------------- 1 | import os 2 | import datetime 3 | 4 | def get_file_access_time(file_path): 5 | return os.path.getatime(file_path) 6 | 7 | def get_recently_accessed_files(directory_path, time_threshold=None): 8 | 9 | recently_accessed_files = [] 10 | for root, dirs, files in os.walk(directory_path): 11 | for file in files: 12 | file_path = os.path.join(root, file) 13 | file_access_time = get_file_access_time(file_path) 14 | 15 | if time_threshold is None or file_access_time >= time_threshold: 16 | recently_accessed_files.append(file_path) 17 | 18 | return sorted(recently_accessed_files, key=lambda file_path: get_file_access_time(file_path), reverse=True) 19 | 20 | def main(): 21 | 22 | # Get the directory path to search. 23 | directory_path = input("Enter the directory path to search: ") 24 | 25 | # Get the list of recently accessed files. 26 | recently_accessed_files = get_recently_accessed_files(directory_path) 27 | 28 | # Print the list of recently accessed files. 29 | print("List of recently accessed files:") 30 | for file_path in recently_accessed_files: 31 | print(f"{file_path}") 32 | 33 | if __name__ == "__main__": 34 | main() 35 | --------------------------------------------------------------------------------