' % (self.imdb_link, self.name)
37 |
38 |
39 | def get_rating(self):
40 | return ' %s ' % str((self.rating / 10))
41 |
--------------------------------------------------------------------------------
/IMDBQuerier/chromedriver.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/IMDBQuerier/chromedriver.exe
--------------------------------------------------------------------------------
/IMDBQuerier/css/list_style.css:
--------------------------------------------------------------------------------
1 | li {
2 | list-style-type: none;
3 | text-align: center;
4 | max-width: 50%;
5 | background-color: #EEEEEE;
6 | }
7 |
8 | span.rating {
9 | color: #D9AA00;
10 | }
11 |
12 |
13 | span.list_title{
14 | font-weight: bold;
15 | }
16 |
--------------------------------------------------------------------------------
/IMDBQuerier/requirements.txt:
--------------------------------------------------------------------------------
1 | bs4
2 | selenium
3 | regex
--------------------------------------------------------------------------------
/Image-Circulator/README.md:
--------------------------------------------------------------------------------
1 | # Image Circulator
2 | Tiny Python3 script to make your images circular.
3 |
4 | ## Dependencies
5 | It requires `python3` and `pillow`.
6 | To install `pillow`, you need `pip3` or python3.
7 |
8 | ## Usage
9 | To run, from the command line type:
10 |
11 | `python3 image_circulator.py -i INPUT_FILE_PATH -o OUTPUT_FILE_PATH -d DIAMETER_IN_PIXELS`
12 |
13 | Or make the script executable.
14 |
--------------------------------------------------------------------------------
/Image-Circulator/image_circulator.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | from PIL import Image, ImageOps, ImageDraw
4 | from argparse import ArgumentParser
5 |
6 |
7 | parser = ArgumentParser()
8 | inputfile = parser.add_argument('-i', '--inputfile', help='input file path')
9 | outputfile = parser.add_argument('-o', '--outputfile', help='output file path')
10 | diameter = parser.add_argument('-d', '--diameter', help='output file diameter')
11 |
12 | args = parser.parse_args()
13 |
14 |
15 | print('Input file is '+ str(args.inputfile))
16 | print('Output file is '+ str(args.outputfile))
17 | print('Image diameter will be '+ str(args.diameter))
18 |
19 | im = Image.open(args.inputfile)
20 |
21 | width, height = im.size
22 |
23 | left = (width - int(args.diameter))/2
24 | top = (height - int(args.diameter))/2
25 | right = (width + int(args.diameter))/2
26 | bottom = (height + int(args.diameter))/2
27 |
28 | im = im.crop((left, top, right, bottom));
29 |
30 | bigsize = (im.size[0] * 3, im.size[1] * 3)
31 | mask = Image.new('L', bigsize, 0)
32 | draw = ImageDraw.Draw(mask)
33 | draw.ellipse((0, 0) + bigsize, fill=255)
34 | mask = mask.resize(im.size, Image.ANTIALIAS)
35 | im.putalpha(mask)
36 |
37 | output = ImageOps.fit(im, mask.size, centering=(0.5, 0.5))
38 | output.putalpha(mask)
39 | output.save(args.outputfile)
40 |
41 | print('Done!')
42 |
--------------------------------------------------------------------------------
/Image-Circulator/requirements.txt:
--------------------------------------------------------------------------------
1 | Pillow
2 |
--------------------------------------------------------------------------------
/Image_Compressor/Image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Image_Compressor/Image.jpg
--------------------------------------------------------------------------------
/Image_Compressor/Image_Compressor.py:
--------------------------------------------------------------------------------
1 | import PIL
2 | from PIL import Image
3 | from tkinter.filedialog import *
4 |
5 | file_paths = askopenfilenames()
6 |
7 | if len(file_paths) == 0:
8 | print("No Files Selected")
9 |
10 | for file in file_paths:
11 | file_name = file.split('/')[-1]
12 | file_name, extension = file_name.split('.')
13 |
14 | img = PIL.Image.open(file)
15 | height,width = img.size
16 | img=img.resize((height,width),Image.Resampling.LANCZOS)
17 |
18 | save_path=askdirectory()
19 | img.save(save_path+f"/{file_name}_compressed.{extension}")
--------------------------------------------------------------------------------
/Image_Compressor/README.md:
--------------------------------------------------------------------------------
1 | # Image_Compressor
2 |
3 | This script compresses the image choosen to much reduced size. Image can be of any format.
4 | Note : The image should be in same folder as the script
5 | It will return with the compressed image when you compile.
6 | It automates the task of compressing the image in day to day lives.
7 |
8 | # Dependencies:
9 |
10 | Note : Use python3.11 for tkinder
11 |
12 | `pip install pillow`
13 |
14 |
--------------------------------------------------------------------------------
/ImportanceChecker/ImportanceChecker.py:
--------------------------------------------------------------------------------
1 | try:
2 | from googlesearch import search
3 | except ImportError:
4 | print("No module named 'google' found.")
5 |
6 |
7 | def ImportanceChecker(query, stoplevel=10, pauselevel=1):
8 | """
9 | Checks 'importance' by analyzing google search results for a person/topic and
10 | finding if they have a wikipedia page among the top results. Number of search
11 | results required is automatically set to 10.
12 | """
13 |
14 | #urlgenerator runs relatively slowly to prevent google from blocking user IP
15 | urlgenerator = search(query, stop=stoplevel, pause=pauselevel)
16 | for _ in range(stoplevel):
17 | url = next(urlgenerator)
18 | if 'wikipedia' in url:
19 | return True
20 | return False
21 |
22 |
23 | def main():
24 | print("Who do you want to be searched? ", end="")
25 |
26 | query = input()
27 |
28 | important = ImportanceChecker(query)
29 |
30 | if (important):
31 | print(f"{query} is important!")
32 | else:
33 | print(f"{query} isn't that important.")
34 |
35 | if __name__ == "__main__":
36 | main()
--------------------------------------------------------------------------------
/ImportanceChecker/README.md:
--------------------------------------------------------------------------------
1 | #Importance Checker
2 |
3 | A simple program to check for a person or topic's "importance" by checking whether the search value's possible Wikipedia page appears in the top *x* Google search results, where *x* is set to 10 by default.
4 |
5 | ##Instructions
6 |
7 | Type these commands in the terminal:
8 |
9 | `pip install beautifulsoup`
10 |
11 | `pip install google`
12 |
13 |
14 | Now type:
15 |
16 | `ImportanceChecker.py`
17 |
18 | The program will run, and test a user-inputted value if in *main*. Use `import ImportanceChecker` to use it in your python project.
19 |
20 |
21 | ###Notes:
22 | * *ImportanceChecker* runs relatively slow to help prevent Google from blocking the user's IP address. One can modify the time delay in between requests to speed the function up by changing the third parameter to something other than its default, *1*.
--------------------------------------------------------------------------------
/ImportanceChecker/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4
2 | google
--------------------------------------------------------------------------------
/InstadpShower/README.md:
--------------------------------------------------------------------------------
1 | # InstadpShower
2 |
3 | This is a simple python script which uses web scraping techniques to display the instagram dp of any user just by typing its username.
4 |
5 | To use this script, you need to have bs4 and requests libraries of python installed in your local machine.
6 |
7 | To install bs4 and requests, use the following command
8 |
9 | ```
10 | pip install beautifulsoup4
11 | ```
12 | ```
13 | pip install requests
14 | ```
15 |
16 | Once libraries are installed, just run the script and type the instagram username of the person, whom you want to see the dp of, and the instagram dp will be displayed on the browser.
17 |
--------------------------------------------------------------------------------
/InstadpShower/dppage.py:
--------------------------------------------------------------------------------
1 | import webbrowser as wb
2 | import requests
3 | import re
4 | import json
5 |
6 |
7 | username=input("Enter the username : ")
8 |
9 | try:
10 | content = requests.get("https://www.instagram.com/"+username).content
11 | find=re.findall(r"logging_page_id.*show_suggested_profiles",str(content))
12 | user_id=((find[0][16:]).split(","))[0][14:-1] # We get the user id of the username
13 | jsonreq=requests.get("https://i.instagram.com/api/v1/users/"+user_id+"/info/").content # using a link we get the whole info of the person
14 | jsonloaded=json.loads(jsonreq)
15 | imgurl=jsonloaded["user"]["hd_profile_pic_url_info"]["url"]
16 | wb.open_new_tab(imgurl)
17 | except:
18 | print("No such username exists")
19 |
--------------------------------------------------------------------------------
/InstadpShower/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4
2 | requests
3 |
--------------------------------------------------------------------------------
/Keylogger/README.md:
--------------------------------------------------------------------------------
1 | # Keylogger
2 | A script written in Python that logs your input from the keyboard.
3 |
4 |
5 | ### Steps to run this on terminal
6 |
7 | - Clone the project.
8 | - Install the dependencies listed in requirements.txt.
9 | - Run `python keylogger.py` in your terminal.
10 |
11 |
12 | ### PS
13 |
14 | - You can use Delete key to exit the script.
15 | - You can open log.txt to view your log.
16 |
17 |
18 | ### Author
19 |
20 | **[Preet Mishra](https://www.github.com/preetmishra)**
--------------------------------------------------------------------------------
/Keylogger/requirements.txt:
--------------------------------------------------------------------------------
1 | astroid==2.1.0
2 | autopep8==1.4.3
3 | certifi==2023.7.22
4 | colorama==0.4.1
5 | isort==4.3.4
6 | lazy-object-proxy==1.3.1
7 | mccabe==0.6.1
8 | pycodestyle==2.4.0
9 | pylint==2.2.2
10 | pynput==1.4.4
11 | six==1.12.0
12 | wincertstore==0.2
13 | wrapt==1.10.11
14 |
--------------------------------------------------------------------------------
/Keylogger/script.py:
--------------------------------------------------------------------------------
1 | import pynput
2 | from pynput.keyboard import Key, Listener
3 |
4 |
5 | keys = []
6 |
7 |
8 | def on_press(key):
9 | keys.append(key)
10 | write_file(keys)
11 |
12 |
13 | def write_file(keys):
14 | with open('log.txt', 'w') as f:
15 | for key in keys:
16 | #removing ''
17 | k = str(key).replace("'", "")
18 | f.write(k)
19 | #explicitly adding a space after every keystroke for readability
20 | f.write(' ')
21 |
22 |
23 | def on_release(key):
24 | if key == Key.delete:
25 | return False
26 |
27 |
28 | with Listener(on_press = on_press, on_release = on_release) as listener:
29 | listener.join()
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) [2019] [Ayush Bhardwaj]
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.
--------------------------------------------------------------------------------
/Location_Of_Adress/locator.py:
--------------------------------------------------------------------------------
1 | import geocoder
2 | t=input("enter the location:")
3 | g = geocoder.arcgis(t)
4 | print(g.latlng)
5 |
6 |
--------------------------------------------------------------------------------
/Location_Of_Adress/requirements.txt:
--------------------------------------------------------------------------------
1 | geocoder
2 |
--------------------------------------------------------------------------------
/Location_Of_Own_IP_Adress/location_using_own_ip_address.py:
--------------------------------------------------------------------------------
1 | import geocoder
2 | g = geocoder.ipinfo('me')
3 | print(g.latlng)
4 |
--------------------------------------------------------------------------------
/Location_Of_Own_IP_Adress/requirements.txt:
--------------------------------------------------------------------------------
1 | geocoder
2 |
--------------------------------------------------------------------------------
/Minecraft_server_in_background/README.md:
--------------------------------------------------------------------------------
1 | # Running a Minecraft server in the background
2 |
3 | This program runs a script (which can be specified) in a subprocess with redirected output
4 | (new output location can be specified) and periodically checks a file for a keyword (both
5 | the name of the file to check and the keyword to check for can be specified)
6 | and exits (stopping the subprocess via sending a command), if the contents of the file
7 | include the keyword.
8 |
9 | You probably want to run this script in background, e.g. calling it via './run.py &'
10 | or via 'nohup ./run.py &'.
11 |
12 | A sample invocation could look like this:
13 |
14 | ```bash
15 | nohup ./run.py &
16 | ```
17 | Now the specified script, e.g. a Minecraft server, is running in the background.
18 |
19 | ```bash
20 | echo stop > command.txt
21 | ```
22 | After a short delay, the script in the background will be stopped.
23 |
--------------------------------------------------------------------------------
/Minecraft_server_in_background/run.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import subprocess
4 | import time
5 |
6 | filename_script = './start.sh' # the script that will be executed
7 | filename_script_output = './log.txt'
8 | filename_own_input = 'command.txt' # the file this script periodically reads from
9 | stop_command = b'stop\n' # must be a binary string
10 | exit_keyword = 'stop'
11 |
12 | with open(filename_own_input, 'w') as f:
13 | f.write('') # reset content of file and create it if needed
14 |
15 | fd_script_output = open(filename_script_output, 'w') # create file descriptor for script to write its stdout to
16 | script_process = subprocess.Popen( # start new process running script
17 | filename_script,
18 | stdin=subprocess.PIPE, # needed for script_process.communicate() (see below)
19 | stdout=fd_script_output # redirect output
20 | )
21 |
22 | while True:
23 | with open(filename_own_input, 'r') as f:
24 | if exit_keyword in f.read(): # check if we should exit
25 | script_process.communicate(input=stop_command) # stop subprocess and wait for it to terminate
26 | break
27 | time.sleep(1)
28 |
29 | fd_script_output.close()
30 |
--------------------------------------------------------------------------------
/Minecraft_server_in_background/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx2048M -Xms2048M -jar server.jar -nogui
4 |
--------------------------------------------------------------------------------
/PDF2text/README.md:
--------------------------------------------------------------------------------
1 | # Description: PDF2text
2 | this is a small script to make a extract text from pdf file.
3 |
4 | ### Dependencies:
5 | 1- [pdftotext](https://pypi.org/project/pdftotext/)
6 |
7 | ## Usage
8 | Run ```python script.py``` then enter path of pdf file.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/PDF2text/requirements.txt:
--------------------------------------------------------------------------------
1 | pdftotext
2 |
--------------------------------------------------------------------------------
/PDF2text/script.py:
--------------------------------------------------------------------------------
1 | import os
2 | import pdftotext
3 |
4 |
5 | pdf_path = input("Enter the path of the pdf file : ")
6 |
7 | assert os.path.exists(pdf_path), "this pdf file doesn't exist"
8 |
9 | with open(pdf_path, 'rb') as f_r:
10 | pdf_pages = pdftotext.PDF(f_r)
11 |
12 | for i, page in enumerate(pdf_pages):
13 | print('Page {}'.format(i))
14 | print(page)
15 | print('*'*100)
16 |
--------------------------------------------------------------------------------
/PDFsplitter/README.md:
--------------------------------------------------------------------------------
1 | ## PDFsplitter
2 |
3 | This Python script allows you to split a PDF file into separate PDF files, one for each page. It uses the PyPDF2 library to perform the splitting.
4 |
5 | ### Usage
6 |
7 | 1. Make sure you have Python 3.x installed on your system.
8 |
9 | 2. Install the required PyPDF2 library using pip:
10 | ```pip install PyPDF2```
11 |
12 | 3. Run the script with the following command:
13 |
14 | `python PDFsplitter.py input_pdf output_folder`
15 | - `input_pdf`: The path to the input PDF file that you want to split.
16 | - `output_folder`: The folder where the split PDF pages will be saved.
17 |
18 | ### Example
19 |
20 | To split an input PDF file named `input.pdf` into separate pages and save them in an `output_pages` folder, you can run the following command:
21 |
22 | python PDFsplitter.py input.pdf output_pages
--------------------------------------------------------------------------------
/PDFsplitter/requirements.txt:
--------------------------------------------------------------------------------
1 | PyPDF2==3.0.1
2 |
--------------------------------------------------------------------------------
/PX-to-REM/README.md:
--------------------------------------------------------------------------------
1 | # PX-to-REM Script
2 |
3 | This script can convert **PX to REM** and **REM to PX**
4 |
5 | ## Usage call python script then select your interest **PX to REM** or **REM to PX** to convert
6 |
7 | ``` bash
8 | $ python px_to_rem.py
9 | ```
10 |
--------------------------------------------------------------------------------
/PX-to-REM/converter.py:
--------------------------------------------------------------------------------
1 | class Converter:
2 | base_px = 16
3 |
4 | def __init__(self):
5 | self.data = []
6 |
7 | def px_to_rem(self, px):
8 | return float(px) / self.base_px
9 |
10 | def rem_to_px(self, rem):
11 | return float(rem) * self.base_px
12 |
--------------------------------------------------------------------------------
/PdfToAudio/README.md:
--------------------------------------------------------------------------------
1 | # Pdf to Audiobook Converter
2 | This python script generates audio for given pdf files.
3 |
4 | ## Dependencies / Requirements
5 | - PyPDF2. Install it by typing this command in your terminal `pip install PyPDF2`
6 | - pyttsx3. Install it by `pip install pyttsx3`
7 |
--------------------------------------------------------------------------------
/PdfToAudio/pdf_to_audiobook.py:
--------------------------------------------------------------------------------
1 | # Importing the required packages.
2 | import PyPDF2
3 | import pyttsx3
4 |
5 | text = None
6 |
7 | # Reading a PDF file from your computer by specifying the path and setting the read mode to binary.
8 | pdf_reader = PyPDF2.PdfFileReader(open(r"D:\MyPdf.pdf", "rb"))
9 |
10 | # Getting the handle to speaker i.e. creating a reference to pyttsx3.Engine instance.
11 | speaker = pyttsx3.init()
12 |
13 | # Splitting the PDF file into pages and reading one at a time.
14 | for page_number in range(pdf_reader.numPages):
15 | text = pdf_reader.getPage(page_number).extractText()
16 | # Generating speech.
17 | speaker.say(text)
18 | speaker.runAndWait()
19 |
20 | # Stopping the speaker after the complete audio has been created.
21 | speaker.stop()
22 |
23 | # Saving the audiobook to your computer.
24 | engine = pyttsx3.init()
25 | engine.save_to_file(text, r"D:\MyAudio.mp3")
26 | engine.runAndWait()
27 |
--------------------------------------------------------------------------------
/PdfToAudio/requirements.txt.txt:
--------------------------------------------------------------------------------
1 | PyPDF2
2 | pyttsx3
--------------------------------------------------------------------------------
/Ping_Server/README.md:
--------------------------------------------------------------------------------
1 | # Ping_server
2 | /P>this is a pyhton script to ping your servers automatically and alert you with telegram messages or telephone call when you server are down or you can manipulate this logig based on diffrent http return status
3 |
you need to liitle configeration in telegram and twillio make it work
4 |
--------------------------------------------------------------------------------
/Ping_Server/requirements.txt:
--------------------------------------------------------------------------------
1 | Telethon
2 | twilio
3 | requests
4 |
--------------------------------------------------------------------------------
/Plagiarism_detector/README.md:
--------------------------------------------------------------------------------
1 | # Plagiarism Detector
2 | This script helps to detect the amount (percentage) of similarity between 2 files .
3 |
4 | ## Input
5 | It takes paths of 2 files you want to compare as input
6 |
7 | ## Output
8 | It returns the percentage of similarity between the 2 files
--------------------------------------------------------------------------------
/Plagiarism_detector/plagiarism.py:
--------------------------------------------------------------------------------
1 | from difflib import SequenceMatcher
2 |
3 | def similarity_per(f1,f2):
4 | with open(f1,errors="ignore") as file1,open(f2,errors="ignore") as file2:
5 | file1_data=file1.read()
6 | file2_data=file2.read()
7 | similarity=SequenceMatcher(None,file1_data,file2_data).ratio()
8 | print(f"these 2 files are {similarity*100} % similar")
9 |
10 | if __name__ == '__main__':
11 | f1=input("file 1 path :")
12 | f2=input("file 2 path :")
13 | similarity_per(f1,f2)
14 |
--------------------------------------------------------------------------------
/Port_Scanner/README.md:
--------------------------------------------------------------------------------
1 | # Port Scanner
2 | A simple tool that asynchronously scans a server's ports with python. It's pretty quick as it processes ports in batches of 256.
3 |
4 | ## Required libraries
5 | None, the only libraries that are used are built-ins.
6 |
7 | ## Usage
8 | Use "port_scanner.py", and enter the IP that you want to scan when prompted.
9 |
--------------------------------------------------------------------------------
/Port_Scanner/port_scanner.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from random import SystemRandom
3 |
4 | def run(tasks, *, loop=None):
5 | """Run Asynchronous Tasks"""
6 | if loop is None:
7 | loop = asyncio.get_event_loop()
8 | # waiting for all tasks
9 | return loop.run_until_complete(asyncio.wait(tasks))
10 |
11 | async def scanner(ip, port, loop=None):
12 | fut = asyncio.open_connection(ip, port, loop=loop)
13 |
14 | try:
15 | reader, writer = await asyncio.wait_for(fut, timeout=0.5) # This is where it is blocking?
16 | print("{}:{} Connected".format(ip, port))
17 | except asyncio.TimeoutError:
18 | pass
19 | # handle connection refused and bunch of others
20 | except Exception as exc:
21 | print('Error {}:{} {}'.format(ip, port, exc))
22 |
23 | def scan(ips, ports, randomize=False):
24 | """Scan the ports"""
25 | loop = asyncio.get_event_loop()
26 | if randomize:
27 | rdev = SystemRandom()
28 | ips = rdev.shuffle(ips)
29 | ports = rdev.shuffle(ports)
30 |
31 | # let's pass list of task, not only one
32 | run([scanner(ip, port) for port in ports for ip in ips])
33 |
34 |
35 | ips = [input("IP to scan: ")]
36 | STEP = 256
37 | for r in range(STEP+1, 65536, STEP):
38 | # print(r)
39 | ports = [str(r) for r in list(range(r-STEP, r))]
40 | scan(ips, ports)
--------------------------------------------------------------------------------
/Pressure_Converter/README.md:
--------------------------------------------------------------------------------
1 | # Developed and maintained by [Osagie Iyayi](https://github.com/E-wave112)
2 |
3 | - This simple program converts between different common units of pressure such as
4 | Pascal(Pa),Bar(bar),Millimeter Mercury(mmHg) and atmosphere(atm).
5 | the test cases are based on the fact that the value of pressure
6 | on it's own can never be negative,except in cases where it is relative to another kind of pressure.
7 |
8 | - Run the doctest via the command
9 |
10 | ```
11 | $ python -m doctest -v Pressure_Converter/pressure_converter_script.py
12 | ```
--------------------------------------------------------------------------------
/Pressure_Converter/requirements.txt:
--------------------------------------------------------------------------------
1 | doctest
--------------------------------------------------------------------------------
/Pretty-CSV/README.md:
--------------------------------------------------------------------------------
1 | # Pretty CSV
2 |
3 | This script pretty-prints CSV input into a table output for easier readibility. The script reads from stdin and writes into stdout for pipe compatibility.
4 |
5 | ## Examples
6 | Read from local file
7 | ```sh
8 | python3 pretty-csv.py < csv-file.csv
9 | ```
10 |
11 | Read from `curl`
12 | ```sh
13 | curl -fsSL https://people.sc.fsu.edu/~jburkardt/data/csv/cities.csv | python3 pretty-csv.py
14 | ```
15 |
16 | Pipe to `less` for better navigation
17 | ```sh
18 | python3 pretty-csv.py < long-csv-file.csv | less -S
19 | ```
20 |
--------------------------------------------------------------------------------
/Pretty-CSV/pretty-csv.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | import csv
3 | import sys
4 | from typing import Iterable, List
5 |
6 |
7 | def main():
8 | content_lines = sys.stdin.buffer.readlines()
9 | reader = csv.reader(line.decode('utf-8') for line in content_lines)
10 | headers = next(reader)
11 | print(create_table(reader, headers))
12 |
13 |
14 | def create_table(rows: Iterable[List[str]], headers: List[str]) -> str:
15 | table = [headers]
16 | column_lengths = [len(header) for header in headers]
17 | for row in rows:
18 | for i, text in enumerate(row):
19 | column_length = column_lengths[i]
20 | text_length = len(text)
21 | if text_length > column_length:
22 | column_lengths[i] = text_length
23 | table.append(list(row))
24 |
25 | result = []
26 | for row in table:
27 | row_text = []
28 | for i, text in enumerate(row):
29 | column_length = column_lengths[i]
30 | row_text.append(space_pad(text, column_length))
31 | result.append(' '.join(row_text))
32 | return '\n'.join(result)
33 |
34 |
35 | def space_pad(text: str, length: int) -> str:
36 | temp = text + ''.join(' ' for _ in range(length))
37 | return temp[:length]
38 |
39 |
40 | if __name__ == '__main__':
41 | main()
42 |
--------------------------------------------------------------------------------
/Proxy-Request/README.md:
--------------------------------------------------------------------------------
1 | # Web proxy request application using Python
2 |
3 |
4 | A quick, reliable and random Web Proxy request application using Python.
5 |
6 | ## 3rd party libraries used
7 |
8 | - requests
9 |
10 | - bs4
11 |
12 | ## Usage
13 |
14 | ```
15 | from proxy_request import proxy_request
16 |
17 | r = proxy_request('get', "https://httpbin.org/ip")
18 |
19 | print(r.json())
20 | ```
--------------------------------------------------------------------------------
/Proxy-Request/proxy_request.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from bs4 import BeautifulSoup
3 | from random import choice
4 |
5 |
6 | def get_proxy():
7 | url = "https://www.sslproxies.org/"
8 | r = requests.get(url)
9 | soup = BeautifulSoup(r.content, 'html5lib')
10 | return {'https': choice(list(map(lambda x:x[0]+':'+x[1], list(zip(map(lambda x:x.text, soup.findAll('td')[::8]),
11 | map(lambda x:x.text, soup.findAll('td')[1::8]))))))}
12 |
13 | def proxy_request(request_type, url, **kwargs):
14 | while 1:
15 | try:
16 | proxy = get_proxy()
17 | print(f"Using proxy {proxy['https']}")
18 | response = requests.request(request_type, url, proxies=proxy, timeout=5, **kwargs)
19 | break
20 | except Exception as e:
21 | print(e)
22 | return response
23 |
24 |
25 | if __name__ == "__main__":
26 | r = proxy_request('get', "https://www.youtube.com/IndianPythonista")
--------------------------------------------------------------------------------
/Proxy-Request/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 | beautifulsoup4
3 |
--------------------------------------------------------------------------------
/PyRecorder/README.md:
--------------------------------------------------------------------------------
1 | # PyRecorder
2 |
3 | ## Record Preview
4 |
5 | 
6 |
7 | ## Stop Preview
8 |
9 | 
10 |
11 | * [Download](https://github.com/jainrocky/screen_recorder/blob/master/dist/PyRecorder.exe) Executable File
12 |
--------------------------------------------------------------------------------
/PyRecorder/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy==1.22.0
2 | opencv-python==4.1.1.26
3 | Pillow==10.2.0
4 |
--------------------------------------------------------------------------------
/Py_Cleaner/README.md:
--------------------------------------------------------------------------------
1 | # PY-CLEAN
2 |
3 | Tool to organize Directories
4 |
5 |
6 | ### Installations and Dependencies
7 |
8 | -> [Python](https://python.org) Installed
9 |
10 | ### How to execute the file:
11 |
12 | 1. Windows Users: Open CMD/ Powershell -> Navigate to the Cloned Directory and then Type In:
13 |
14 | ```python
15 | python main.py
16 | ```
17 |
18 | 2. OSX/ Linux: Open Terminal -> Navigate to the Cloned Directory and then Type In:
19 |
20 | ```python
21 | python3 main.py
22 | ```
23 |
24 | ### Note
25 |
26 | -> Kindly do not modify any file (unless you know what you are doing).
27 |
--------------------------------------------------------------------------------
/Py_Cleaner/Screenshot 2020-06-24 at 12.27.00 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Py_Cleaner/Screenshot 2020-06-24 at 12.27.00 PM.png
--------------------------------------------------------------------------------
/Py_Cleaner/bg.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Py_Cleaner/bg.gif
--------------------------------------------------------------------------------
/Py_Cleaner/folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Py_Cleaner/folder.png
--------------------------------------------------------------------------------
/RSA-key-pairs/README.md:
--------------------------------------------------------------------------------
1 | # Python RSA Key Pair Generator
2 | This python script will generate a private and public key pair using the RSA algorithm
3 |
4 | ## Modules used
5 |
6 | Math
7 | ```
8 | import math
9 | ```
10 |
11 | Random
12 | ```
13 | import random
14 | ```
15 |
16 | #Usage
17 | You can use the public and private key to encrypt and decrypt information
18 | Run the python file and get key pairs or edit the code and define your custom bounds in the random limits
19 | ```
20 | random.randint(start,end)
21 | ```
22 |
--------------------------------------------------------------------------------
/RSA-key-pairs/key-pair-generator.py:
--------------------------------------------------------------------------------
1 | #a simple RSA public key and private key pair generator
2 | #using gcd from math module for coprimes
3 | #and random for random numbers
4 | import math
5 | import random
6 | p = random.randint(1,100)
7 | q = random.randint(100,200)
8 | if (math.gcd(p,q) == 1):
9 | n = p * q
10 | phi = (p-1)*(q-1)
11 | k = 0
12 | e = random.randint(1,20000)
13 | if (math.gcd(phi,e)==1):
14 | for i in range(1,20000):
15 | d = (((phi * i) + 1)/e)
16 | if d.is_integer():
17 | k = d
18 | break
19 | print('Public key is: (',e,',',n,')')
20 | print('Private key is: (',int(k),',',n,')')
21 |
--------------------------------------------------------------------------------
/RSA-key-pairs/requirements.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/RSA_Algorithm/README.md:
--------------------------------------------------------------------------------
1 | # RSA Algorithm
2 | * Python script that encrypts and decrypts a text based on [RSA algorithm](https://people.csail.mit.edu/rivest/Rsapaper.pdf)
3 | * It involves the concept of modular arithmatic and euler's theorem.
4 | * It is also based on the idea that factorizing large numbers requires years.
5 | * Here, the (a,n) are kept public and (p,q,b) are kept private.
6 |
7 | 
8 |
9 | ## Usage
10 | For Windows users:
11 |
12 | ```bash
13 | $ python RSA_Algorithm.py
14 | ```
15 |
16 | For Mac/Linux/Unix users:
17 |
18 | ```bash
19 | $ ./RSA_Algorithm.py
20 | ```
21 |
22 | ## References
23 | [Blog](https://www.di-mgt.com.au/rsa_alg.html)
24 | [Paper](https://people.csail.mit.edu/rivest/Rsapaper.pdf)
25 | [Video](https://www.youtube.com/watch?v=wXB-V_Keiu8)
26 |
--------------------------------------------------------------------------------
/RSA_Algorithm/RSA_Algorithm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/RSA_Algorithm/RSA_Algorithm.png
--------------------------------------------------------------------------------
/RSA_Communication/README.md:
--------------------------------------------------------------------------------
1 | # RSA Communication Script
2 |
3 | ## How to use
4 | To use this script you may first open the script :p
5 | It will take some time, it will generate two BIG prime numbers, and that takes some time.
6 |
7 | After it finnishes calculating your keypair, it will print it and ask you if you want to encrypt or decrypt a message.
8 |
9 | ---
10 |
11 | If you want to encrypt, you write "e" and then press enter. The script will ask you for a key (keypair) to encrypt your message, and here you paste the keypair of your correspondant
12 | (the string that shows up at his/her script start).
13 | After you paste the keypair you will write your message, and when you press enter the encrypted message will be printed.
14 |
15 | ---
16 |
17 | If you want to decrypt a message, you write "d" and the press enter. Then the script will ask you for the message to decrypt, wich you are going to paste and press enter.
18 | After you press enter the decrypted message will be displayed :)
19 |
--------------------------------------------------------------------------------
/Random_Email_Generator/README.md:
--------------------------------------------------------------------------------
1 | # Programs
2 | ## [Random_Email_Generator.py](./Random_email_generator.py)
3 | This program randomly generates an email address using a mix of letters, both caps on and off, numbers, and punctuation, then outputs the results.
4 |
5 |
6 | # Requirements
7 | * [Random_Email_Generator.py](./Random_email_generator.py) can use Python 3 and higher or Python 2 and higher.
8 | Moreover, you might also have to install progressbar library in your system.
9 | ```bash
10 | $ pip install progressbar
11 | ```
12 |
13 | # Usage
14 |
15 | For Windows users:
16 |
17 | ```bash
18 | $ python Random_email_generator.py
19 | ```
20 |
21 | For Mac/Linux/Unix users:
22 |
23 | ```bash
24 | $ ./Random_email_generator.py
25 | ```
26 |
--------------------------------------------------------------------------------
/Random_Names_Generator/README.md:
--------------------------------------------------------------------------------
1 | # Random Names Generator
2 |
3 | ## A simple python script to generate some random names.
4 |
5 | ### There are two csv files for 'First Name' and 'Last Name' in text 'CSV_Database_Of_First_And_Last_Names' taken from [here](http://www.quietaffiliate.com/free-first-name-and-last-name-databases-csv-and-sql/)
6 |
7 | # Usage
8 | ### Step 1
9 | Fork this Repo and Clone it to your local machine.
10 | ```sh
11 | $ git clone https://github.com/YOUR_USERNAME/Random_Names_Generator.git
12 | $ cd Random_Names_Generator
13 | ```
14 | ### Step 2
15 | To run the python3 program
16 | ```sh
17 | $ python3 Random_Name_Generator.py
18 | ```
19 | The above only returns only one name.
20 |
21 |
22 | Add number of names if more than one name is required.
23 | ```sh
24 | $ python3 Random_Name_Generator.py 5
25 | ```
26 | ---
27 | Tip:-
28 | In Linux Machines you can save the files as text using output redirection
29 | ```sh
30 | $ python3 Random_Name_Generator.py 10 >> Random_Names_Generator.txt
31 | ```
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Random_Password_Generator/Passwords.txt:
--------------------------------------------------------------------------------
1 | AaGhi>]!Tkz0{ik0S)mU
k7wuVdpSIkc:8V{q)e_*N
3 | !+B.C;YJ4+;/_$g>]FK/^vD]X
4 | I[dgz&|>uoh(K:-i;xgE:F!!C
5 | $Ab\ag_?lD57,L]Gf3(]j04aw
6 | nCC&RS7K]]GK(%pDHr,>fyv?[
7 | |VT3$kK5AGir))o9A6+ApR`%X
8 | :T<0],Kzm]
12 | XVp,+V.ko[c/-C3M22*+p@J3>
13 | zTR_S+lDuRn|MwGIVGFwu]pgH
14 | ]p_8k1Z03$8]aJL@o^kY$#(Ez
15 | MGe:td4Ql~cZY&G.]u$IK){(p
16 | /&1>(jI|SEdg*L6$Zz,NfetZp
17 | 1dN6clgIgi-EfIYB@cn>#^mix
18 | )cci)3*:0l$lNZ*Upi3ME?-C]
19 | XC$#Rc*B+/Jr
21 |
--------------------------------------------------------------------------------
/Random_Password_Generator/README.md:
--------------------------------------------------------------------------------
1 | # Programs
2 | ## [PasswordGenerator.py](./PasswordGenerator.py)
3 | This program randomly generates a secure password using a mix of letters, both caps on and off, numbers, and punctuation, then outputs the results and saves them as a text document.
4 |
5 | ## [createPassword.py](./createPassword.py)
6 | This program uses the Python 3 module `secrets` to create a pseudo random password with alphanumeric, numbers, and special characters. The output will be printed into the terminal.
7 |
8 | # Requirements
9 | * [PasswordGenerator.py](./PasswordGenerator.py) can use Python 3 and higher or Python 2 and higher
10 | * [createPassword.py](./createPassword.py) can run on python 3.6 or higher or for Python 2 do:
11 | * `cd Random_Password_Generator/` to change directory into this folder.
12 | * Create virtual environment with `virtualvenv env`
13 | * do `source venv/bin/activate` to activate virtual environment.
14 | * do `pip install -r requirements.txt` to install python2-secrets
15 | * **TIP**: to deactivate virtual environment, do `deactivate`.
16 |
17 | # Usage
18 |
19 | For Windows users:
20 |
21 | ```bash
22 | $ python PasswordGenerator.py
23 | ```
24 |
25 | For Mac/Linux/Unix users:
26 |
27 | ```bash
28 | $ ./PasswordGenerator.py
29 | ```
--------------------------------------------------------------------------------
/Random_Password_Generator/createPassword.py:
--------------------------------------------------------------------------------
1 | #!/bin/python
2 | # -*- coding: utf-8 -*-
3 |
4 | # Create a pseudo random password with alphanumeric, numbers, and special characters
5 |
6 | import secrets #implemented in python version 3.6+
7 |
8 | #String of characters
9 | chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=_+`~[]{]\|;:,<.>/?'
10 |
11 | #2 for loops should be O(n²) runtime
12 | def create(number_of_passwords, pass_length):
13 | for i in range(number_of_passwords):
14 | list = [] # create new empty list
15 | for i in range(pass_length):
16 | select = secrets.choice(chars) #the secret sauce to select a pseudo random character
17 | list.append(select) #add pseudo random char to list
18 | l = ''.join(list) #concatenate list to string for every ''
19 | print(l) #<-- comment me out for faster computing
20 | return l
21 |
22 | #Run function
23 | create(int(5),int(20)) #number_of_passwords, pass_length
--------------------------------------------------------------------------------
/Random_Password_Generator/requirements.txt:
--------------------------------------------------------------------------------
1 | python2-secrets>=1.0.5
2 |
--------------------------------------------------------------------------------
/Remove-Duplicate-Files/README.md:
--------------------------------------------------------------------------------
1 | # Remove Duplicate Files
2 | A python script to find/remove duplicate files from the user specified directory
3 |
4 | # Usage
5 | Simply run the script removeDuplicateFiles.py from the terminal after specifying the path
6 |
--------------------------------------------------------------------------------
/Rock-Paper-Scissor/README.md:
--------------------------------------------------------------------------------
1 | # Python Rock-Paper-Scissor GAME
2 |
3 | The Python script shows the easy to understand and executable program which is used to play the rock-paper-scissor game with scorecard and wish to start or exit.
4 |
5 | ## Requirement
6 |
7 | Python 3.xx
8 |
9 | ## Running the script
10 |
11 | ```bash
12 | python Rock-Paper-Scissor.py
13 | ```
14 |
--------------------------------------------------------------------------------
/SSH_Host_Adder/README.md:
--------------------------------------------------------------------------------
1 | # SSH Host adder
2 |
3 | This is a fairly simple script which adds hosts to an ssh config file.
4 | SSH allows you to add hosts to a config file, so you don't have to remember ip addresses or hostnames. So if you add:
5 |
6 | ```
7 | HOST test
8 | HostName 192.168.80.1
9 | User root
10 | Port 22
11 | ```
12 |
13 | to `~/.ssh/config`, you can just do `ssh test` instead of writing the address / user / port.
14 |
15 | But when you constantly get new servers to ssh to, it's helpful to have a script!
16 |
17 | ## Usage:
18 |
19 | ```
20 | ./ssh_adder my_host 192.168.80.1 [--user myuser] [--port 2200]
21 | ```
22 |
23 | `--user` and `--port` are optional and default to `root` and `22` respectively.
24 |
25 | If you aren't using the default ssh config path, there is an argument for that as well:
26 |
27 | ```
28 | ./ssh_adder my_host 192.168.80.1 --conf /path/to/config
29 | ```
30 |
31 | `-conf` defaults to `~/.ssh/config`
32 |
33 | SSH configs allow you to make more complex operations, like adding different keys and whatnot, which I don't support here mostly because I haven't had a need to yet. If I get to updating my script some time, I'll update it here too.
34 |
--------------------------------------------------------------------------------
/SSH_Host_Adder/ssh_adder:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import sys
4 | import ssh_adder
5 |
6 | def main():
7 | ssh_adder.main(sys.argv)
8 |
9 |
--------------------------------------------------------------------------------
/SimpleWebpageParser/README.md:
--------------------------------------------------------------------------------
1 | # Simple Webpage Parser
2 | A simple wrapper around the popular web scraper library BeautifulSoap. It merges the use of Requests and BeautifulSoap library in one class which abstracts the process of extraction of html from webpage's url and gives user a clean code to work with.
3 |
4 | ## Libraries Required
5 | 1. requests
6 | `$pip install requests`
7 | 2. beautifulsoup4
8 | `$pip install beautifulsoup4`
9 |
10 | ## Usage
11 | A sample script `webpage_parser.py` has been provided to show the usage of the SimpleWebpageParser. It prints all the links from the Hacktoberfest's home page.
--------------------------------------------------------------------------------
/SimpleWebpageParser/SimpleWebpageParser.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from bs4 import BeautifulSoup
3 |
4 | class SimpleWebpageParser():
5 |
6 | def __init__(self, url):
7 | self.url = url
8 |
9 | def getHTML(self):
10 | r = requests.get(self.url)
11 | data = r.text
12 | soup = BeautifulSoup(data,"lxml")
13 | return soup
--------------------------------------------------------------------------------
/SimpleWebpageParser/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/SimpleWebpageParser/__init__.py
--------------------------------------------------------------------------------
/SimpleWebpageParser/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 | beautidulsoup4
3 |
--------------------------------------------------------------------------------
/SimpleWebpageParser/webpage_parser.py:
--------------------------------------------------------------------------------
1 | from SimpleWebpageParser import SimpleWebpageParser
2 |
3 | swp = SimpleWebpageParser("https://hacktoberfest.digitalocean.com/")
4 | html = swp.getHTML()
5 | print html.find_all('a')
6 |
7 | ## the html returned is an object of type BeatifulSoup, you can parse using BeautifulSoup syntax
8 | ## refer to its documentation for more functionalities
--------------------------------------------------------------------------------
/Slideshare-Downloader/README.md:
--------------------------------------------------------------------------------
1 | # Slideshare-Downloader
2 | Download slides from slideshows shared on SlideShare (Now LinkedIn SlideShare) as a PDF.
3 |
4 | # Usage
5 | This was written for Python 3, but it should work with Python 2.7 as well.
6 |
7 | ## Installation
8 | ### Linux/Mac
9 | ```bash
10 | python3 -m pip install --user -U -r requirements.txt
11 | python3 slideshare_downloader.py --help
12 | ```
13 |
14 | ### Windows
15 | ```powershell
16 | py -3 -m pip install --user -U -r requirements.txt
17 | py -3 slideshare_downloader.py --help
18 | ```
19 |
20 | ## Running
21 | ```bash
22 | slideshare_downloader.py -f some_slides -u http://www.slideshare.net/codeblue_jp/igor-skochinsky-enpub
23 | ```
--------------------------------------------------------------------------------
/Slideshare-Downloader/requirements.txt:
--------------------------------------------------------------------------------
1 | docopt
2 | img2pdf
3 | requests
4 | beautifulsoup4
5 |
--------------------------------------------------------------------------------
/SmsYourLocation/README.md:
--------------------------------------------------------------------------------
1 |
2 |
this is small python script to send sms to your loved ones....especially for those have very caring mother like mine
3 |
so you can run this script as cron job and it will SMS your currrent location to number you want (note: it should be registered with TWILO)
4 |
NOTE:you need to make a account in twilo. if you are going to use paid one you will have more options like multiple numbers extra....
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SmsYourLocation/SmsYourLocation.py:
--------------------------------------------------------------------------------
1 | import urllib3
2 | import json
3 | http = urllib3.PoolManager()
4 | r = http.request('GET', 'http://ipinfo.io/json')
5 | data = json.loads(r.data.decode('utf-8'))
6 | city=data['city']
7 | loc=data['loc']
8 | print(city,loc)
9 | from twilio.rest import Client
10 |
11 | client = Client("TWILO SSID", "AUTH TOKEN")
12 | client.messages.create(to="PHONE NO YOU WANT TO SEND SMS",
13 | from_="YOUR TWILLO PHONE NUMBER",
14 | body="hi amma i am in "+city+" now and my cordinates are " +loc)
15 |
--------------------------------------------------------------------------------
/Squid-Proxy-Installer-for-Ubuntu16/README.md:
--------------------------------------------------------------------------------
1 | **Squid Proxy Automation-Script**
2 | *it's for Ubuntu 14 or 16 servers.*
3 | **You can browse with your installed squid proxy on your server**
4 | You need simple server or OpenVPN ovpn file.
5 |
6 | Go python3 Squid_Proxy.py and install Squid Proxy
7 |
8 | 1. Install Squid Proxy
9 | 2. Add Password
10 | 3. Change Password
11 | 4. Remove Password
12 | 5. Uninstall Squid Proxy
13 | 6. Exit
--------------------------------------------------------------------------------
/Steg_Tool/README.md:
--------------------------------------------------------------------------------
1 | # Steganography Tool
2 |
3 | * Advanced Image Steganography Tool used to hide files inside Images.
4 | * Uses LSB (Least Significant Bit) Algorithm to store file data inside the image
5 | * Works with only .png format
6 |
7 | Commands
8 | ```
9 | python3 steg.py
10 | ```
11 | Input
12 | ```
13 | encode
14 |
15 | decode
16 | ```
17 | Example
18 | ```
19 | encode image.png image_new.png secret.txt
20 | decode image_new.png secret_new.txt
21 | ```
--------------------------------------------------------------------------------
/Steg_Tool/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Steg_Tool/image.png
--------------------------------------------------------------------------------
/Steg_Tool/secret.txt:
--------------------------------------------------------------------------------
1 | secret
--------------------------------------------------------------------------------
/Subtitle-downloader/README.md:
--------------------------------------------------------------------------------
1 | # Subtitle Downloader
2 | A simple script to download subtitles from [http://thesubdb.com/]
3 |
4 | ##Dependencies
5 | It requires `python3` and `request`.
6 | To install `request`, you need `pip3` or python3.
7 |
8 | ## Usage
9 | You can directly run the script `subdownloader.py` with the queries supplied from the command line.
10 | If you make the script executable and add it to the system path, then you can directly run the script.
11 |
--------------------------------------------------------------------------------
/Subtitle-downloader/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 |
--------------------------------------------------------------------------------
/TTS_Text_to_Speech_Mp3/README.md:
--------------------------------------------------------------------------------
1 | # TTS - Text to Speech Mp3
2 |
3 | Write spoken mp3 data to a file, a file-like object (bytestring) for further audio manipulation, or stdout.
4 | This example uses the Python library [gTTS](https://pypi.org/project/gTTS/) (Google Text-to-Speech), to interface with Google Translate's text-to-speech API.
5 |
6 | ## Installation
7 |
8 | ``$ pip install requirements.txt``
9 |
10 | ## Quickstart
11 |
12 | ```
13 | >>> from gtts import gTTS
14 | >>> tts = gTTS('hello')
15 | >>> tts.save('hello.mp3')
16 | ```
17 |
18 | ## Disclaimer
19 |
20 | [gTTS](https://pypi.org/project/gTTS/) project is not affiliated with Google or Google Cloud. Breaking upstream changes can occur without notice. This project is leveraging the undocumented Google Translate speech functionality and is different from Google Cloud Text-to-Speech.
21 |
--------------------------------------------------------------------------------
/TTS_Text_to_Speech_Mp3/requirements.txt:
--------------------------------------------------------------------------------
1 | gTTS
2 |
--------------------------------------------------------------------------------
/TTS_Text_to_Speech_Mp3/run.py:
--------------------------------------------------------------------------------
1 | from gtts import gTTS
2 |
3 | def main():
4 | tts = gTTS('hello')
5 | tts.save('hello.mp3')
6 |
7 | if __name__ == "__main__":
8 | main()
9 |
--------------------------------------------------------------------------------
/Take_screenshot/README.md:
--------------------------------------------------------------------------------
1 | # Take a Screenshot :
2 |
3 | A simple implementation on how to take screenshots .
4 |
5 | #### Required Modules :
6 | - Numpy
7 | ```bash
8 | pip install numpy
9 | ```
10 | - Opencv
11 | ```bash
12 | pip install opencv-python
13 | ```
14 | - Pyautogui
15 | ```bash
16 | pip3 install pyautogui --user
17 | ```
18 | #### Results :
19 |
20 | 
21 |
--------------------------------------------------------------------------------
/Take_screenshot/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy
2 | PyAutoGUI
3 | opencv-python
4 |
--------------------------------------------------------------------------------
/Take_screenshot/screenshot.py:
--------------------------------------------------------------------------------
1 | #Needed packages
2 | import numpy as np
3 | import cv2
4 | import pyautogui
5 |
6 | #take screenshot using pyautogui
7 | image = pyautogui.screenshot()
8 |
9 | #since the pyautogui takes as a PIL(pillow) and in RGB we need to convert it to numpy array and BGR
10 | #so we can write it to the disk
11 | image = cv2.cvtColor(np.array(image),cv2.COLOR_RGB2BGR)
12 |
13 | #writing it to the disk using opencv
14 | cv2.imwrite("test.png",image)
15 |
--------------------------------------------------------------------------------
/Take_screenshot/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Take_screenshot/test.png
--------------------------------------------------------------------------------
/Tambola_Ticket_Generator/README.MD:
--------------------------------------------------------------------------------
1 | # Tambola ticket generator
2 | This is a simple utility to generate tambola tickets
3 |
4 | ## Requirement
5 |
6 | * Python 3
7 | * numpy
8 | * tabulate
9 |
10 | ```bash
11 | pip install -r requirements.txt
12 | ```
13 |
14 | ## Usage
15 |
16 | ```bash
17 | $ python main.py
18 | ╒═══╤════╤════╤════╤════╤════╤════╤════╤════╕
19 | │ 0 │ 14 │ 0 │ 32 │ 0 │ 0 │ 61 │ 71 │ 81 │
20 | ├───┼────┼────┼────┼────┼────┼────┼────┼────┤
21 | │ 4 │ 0 │ 24 │ 33 │ 45 │ 0 │ 63 │ 0 │ 0 │
22 | ├───┼────┼────┼────┼────┼────┼────┼────┼────┤
23 | │ 0 │ 0 │ 25 │ 37 │ 49 │ 59 │ 0 │ 79 │ 0 │
24 | ╘═══╧════╧════╧════╧════╧════╧════╧════╧════╛
25 | ```
26 |
27 | ```bash
28 | $ python main.py --count 2
29 | ╒═══╤════╤════╤════╤════╤════╤════╤════╤════╕
30 | │ 0 │ 14 │ 0 │ 32 │ 0 │ 0 │ 61 │ 71 │ 81 │
31 | ├───┼────┼────┼────┼────┼────┼────┼────┼────┤
32 | │ 4 │ 0 │ 24 │ 33 │ 45 │ 0 │ 63 │ 0 │ 0 │
33 | ├───┼────┼────┼────┼────┼────┼────┼────┼────┤
34 | │ 0 │ 0 │ 25 │ 37 │ 49 │ 59 │ 0 │ 79 │ 0 │
35 | ╘═══╧════╧════╧════╧════╧════╧════╧════╧════╛
36 |
37 | ╒═══╤════╤════╤════╤════╤════╤════╤════╤════╕
38 | │ 1 │ 0 │ 0 │ 32 │ 42 │ 0 │ 61 │ 72 │ 0 │
39 | ├───┼────┼────┼────┼────┼────┼────┼────┼────┤
40 | │ 0 │ 17 │ 24 │ 0 │ 45 │ 0 │ 0 │ 77 │ 82 │
41 | ├───┼────┼────┼────┼────┼────┼────┼────┼────┤
42 | │ 5 │ 0 │ 26 │ 39 │ 49 │ 59 │ 0 │ 0 │ 0 │
43 | ╘═══╧════╧════╧════╧════╧════╧════╧════╧════╛
44 | ```
45 |
--------------------------------------------------------------------------------
/Tambola_Ticket_Generator/main.py:
--------------------------------------------------------------------------------
1 | """
2 | Tambola Ticket generator
3 | ask (c) 2020. All rights reserved.
4 | """
5 |
6 | import argparse
7 |
8 | import numpy as np
9 | from tabulate import tabulate
10 |
11 |
12 | def shuffle_array(a):
13 | while (~a.any(axis=1)).any():
14 | [np.random.shuffle(a[:, i]) for i in range(3)]
15 | return a
16 |
17 |
18 | def generate_ticket():
19 | ticket = np.full(27, 1).reshape(9, 3)
20 | ticket[:4, :] *= 0
21 | ticket = shuffle_array(ticket)
22 |
23 | for i in range(9):
24 | num = np.arange(1, 10) if i < 8 else np.arange(1, 11)
25 | np.random.shuffle(num)
26 | num = np.sort(num[:3])
27 | ticket[i, :] *= (num + i * 10)
28 | return ticket.T
29 |
30 |
31 | def get_tickets(args):
32 | tickets = []
33 | for _ in range(args.count):
34 | tickets.append(generate_ticket())
35 | return tickets
36 |
37 |
38 | def main():
39 | parser = argparse.ArgumentParser()
40 | parser.add_argument('-c', '--count', help="Generates and returns tambola tickets given by count", type=int,
41 | default=1)
42 | args = parser.parse_args()
43 | return get_tickets(args)
44 |
45 |
46 | if __name__ == "__main__":
47 | generated_tickets = main()
48 | print("Generated {0} tickets".format(len(generated_tickets)))
49 |
50 | for t in generated_tickets:
51 | print(tabulate(t, tablefmt='fancy_grid'))
52 |
--------------------------------------------------------------------------------
/Tambola_Ticket_Generator/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy==1.22.0
2 | tabulate==0.8.7
3 |
--------------------------------------------------------------------------------
/Task-Scheduler/requirements.txt:
--------------------------------------------------------------------------------
1 | pytz==2021.3
2 |
--------------------------------------------------------------------------------
/TestMyInternetSpeed/README.md:
--------------------------------------------------------------------------------
1 | ## Test Your Internet Speed using Python
2 |
4 |
5 | This is a simple but powerful and efficient python program.
6 | You can test your internet bandwidth speed with this script i wrote using just a single command, you will also get a bunch of good options to choose from and the test will be performed with the help of speedtest-cli module in python.
7 |
8 | - Test Download Speed
9 | - Test Upload Speed
10 | - Test Server Pings
11 | - Results in Mbps(Mega bits per second)
12 |
13 | #### How to use
14 |
15 | - Clone the repo or download the zip
16 | - Navigate to the folder of the program in terminal/cmd.
17 | - Install the dependencies using pip install -r requirements.txt
18 | - Run the command python TestMySpeed.py
19 |
20 | (Note: You will need to have python 3 installed and if you are on a unix based OS (macOS, or linux) you may need to run the command using python3 TestMySpeed.py)
21 |
--------------------------------------------------------------------------------
/TestMyInternetSpeed/TestMySpeed.py:
--------------------------------------------------------------------------------
1 |
2 | # the package used is speedtest-cli(it is the only package we need)
3 | import speedtest
4 | from time import sleep
5 | speed=speedtest.Speedtest()
6 |
7 | option=int(input('''
8 | What do you want to know:
9 | 1) Download speed
10 | 2) Upload speed
11 | 3) Both Download and Upload
12 | 4) Ping
13 | Your choice: '''))
14 |
15 | if option<1 or option>4:
16 | sleep(2)
17 | print('You have entered wrong choice, please enter again with values from 1 to 4')
18 | else:
19 | sleep(1)
20 | print()
21 | print('Pls wait, test in progress...')
22 | print()
23 | down_speed=round(speed.download()/1000000,3)
24 | up_speed=round(speed.upload()/1000000,3)
25 | print('One more sec please...')
26 | sleep(2.5)
27 | print()
28 | if option == 1:
29 | print('Your Download speed is: ',down_speed,'Mbps')
30 | elif option == 2:
31 | print('Your Upload speed is: ',up_speed,'Mbps')
32 | elif option == 3:
33 | print('Your Download speed is: ',down_speed,'Mbps',end=" ")
34 | print(',and your Upload speed is: ',up_speed,'Mbps')
35 |
36 | elif option == 4:
37 | s=[]
38 | speed.get_servers(s)
39 | print(speed.results.ping,'ms')
40 | else:
41 | print('Sorry, something went wrong, pls try again...')
42 |
43 |
44 |
--------------------------------------------------------------------------------
/TestMyInternetSpeed/requirements.txt:
--------------------------------------------------------------------------------
1 | speedtest-cli
--------------------------------------------------------------------------------
/TicTacToe_AI_and_2_players/README.md:
--------------------------------------------------------------------------------
1 | author: Omar Sameh
2 | email: o.s.dr.who@gmail.com
3 | no requirments enjoy!
--------------------------------------------------------------------------------
/TicTacToe_AI_and_2_players/Requirements.txt:
--------------------------------------------------------------------------------
1 | None! enjoy!
--------------------------------------------------------------------------------
/To Do Bot/Procfile:
--------------------------------------------------------------------------------
1 | worker: python bot.py
2 |
--------------------------------------------------------------------------------
/To Do Bot/README.md:
--------------------------------------------------------------------------------
1 | # ToDoBot
2 | Telegram Bot for ToDo list to add, delete, see and check remaining date for particular task.
3 |
4 | ## Usage
5 | * create a bot on telegram app using bot-father.
6 | * Add an unique TOKEN generated by bot-father to bot.py
7 | * run the bot using `python bot.py`
8 | * send /help to bot to know the detailed functionality.
9 |
--------------------------------------------------------------------------------
/To Do Bot/dbhelper.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 |
3 |
4 | class DBHelper:
5 |
6 | def __init__(self, dbname="todo.sqlite"):
7 | self.dbname = dbname
8 | self.conn = sqlite3.connect(dbname)
9 |
10 | def setup(self):
11 | tblstmt = "CREATE TABLE IF NOT EXISTS items (description text, due_date date ,owner text)"
12 | itemidx = "CREATE INDEX IF NOT EXISTS itemIndex ON items (description ASC)"
13 | ownidx = "CREATE INDEX IF NOT EXISTS ownIndex ON items (owner ASC)"
14 | self.conn.execute(tblstmt)
15 | self.conn.execute(itemidx)
16 | self.conn.execute(ownidx)
17 | self.conn.commit()
18 |
19 | def add_item(self, item_text, due_date, owner):
20 | stmt = "INSERT INTO items (description, due_date ,owner) VALUES (?, ? ,?)"
21 | args = (item_text, due_date ,owner)
22 | self.conn.execute(stmt, args)
23 | self.conn.commit()
24 |
25 | def delete_item(self, item_text, owner):
26 | stmt = "DELETE FROM items WHERE description = (?) AND owner = (?)"
27 | args = (item_text, owner )
28 | self.conn.execute(stmt, args)
29 | self.conn.commit()
30 |
31 | def get_items(self, owner):
32 | stmt = "SELECT description,due_date FROM items WHERE owner = (?)"
33 | args = (owner, )
34 | return [x for x in self.conn.execute(stmt, args)]
35 |
36 |
--------------------------------------------------------------------------------
/To Do Bot/requirements.txt:
--------------------------------------------------------------------------------
1 | python-dateutil==2.6.0
2 | requests
3 | telepot==10.5
4 | urllib3
5 | virtualenv==15.1.0
6 |
--------------------------------------------------------------------------------
/To Do Bot/runtime.txt:
--------------------------------------------------------------------------------
1 | python-3.6.1
--------------------------------------------------------------------------------
/To Do Bot/todo.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/To Do Bot/todo.sqlite
--------------------------------------------------------------------------------
/Toonify/README.md:
--------------------------------------------------------------------------------
1 | ## HOW TO USE
2 |
3 | #### Using OpenCv ([link](./toonify-opencv.py))
4 |
5 |
6 | - To just view the image
7 | ```python
8 | python3 toonify-opencv.py -i img_path
9 | ```
10 |
11 |
12 | - To view and download the image
13 | ```python
14 | python3 toonify-opencv.py -i img_path -o download_path
15 | ```
16 |
17 | #### Using Toonify-API(by DeepAI)
18 |
19 |
20 | ##### For local image ([link](./toonify-API-1.py))
21 |
22 | ```python
23 | python3 toonify-API-1.py -i img_path -k api_key
24 |
25 | ```
26 |
27 | ##### For URLS ([link](./toonify-API-2.py))
28 |
29 | ```python
30 | python3 toonify-API-2.py -i img_path -k api_key
31 |
32 | ```
33 |
34 | > NOTE: The toonify image works well with .jpg format and might give some problem with other formats
35 |
36 |
37 | For more details on toonify API:
38 |
39 | [toonify API doc](https://deepai.org/machine-learning-model/toonify)
40 |
--------------------------------------------------------------------------------
/Toonify/toonify-API-1.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import requests
3 |
4 | aq = argparse.ArgumentParser()
5 | aq.add_argument('-i', '--input', required=True, help="input image path")
6 |
7 | aq.add_argument('-k', '--apikey', required=True, help="api-key")
8 |
9 | args = vars(aq.parse_args())
10 |
11 | r = requests.post(
12 | "https://api.deepai.org/api/toonify",
13 | files={
14 | 'image': open(args['input'], 'rb'),
15 | },
16 | headers={'api-key': args['apikey']}
17 | )
18 | print(r.json()['output_url'])
--------------------------------------------------------------------------------
/Toonify/toonify-API-2.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import requests
3 |
4 | aq = argparse.ArgumentParser()
5 | aq.add_argument('-i', '--input', required=True, help="input image link")
6 |
7 | aq.add_argument('-k', '--apikey', required=True, help="api-key")
8 |
9 | args = vars(aq.parse_args())
10 |
11 | r = requests.post(
12 | "https://api.deepai.org/api/toonify",
13 | files={
14 | 'image': args['input'],
15 | },
16 | headers={'api-key': args['apikey']}
17 | )
18 | print(r.json()['output_url'])
19 |
--------------------------------------------------------------------------------
/Toonify/toonify-opencv.py:
--------------------------------------------------------------------------------
1 | # importing libraries
2 | import cv2
3 | import numpy as np
4 | import argparse
5 |
6 | aq = argparse.ArgumentParser()
7 |
8 | aq.add_argument('-i', '--input', required=True, help="input image path")
9 |
10 | aq.add_argument('-o', '--output', help="path where you want to download the image")
11 |
12 | args = vars(aq.parse_args())
13 | # reading image
14 | img = cv2.imread(args['input'])
15 |
16 | # Edges
17 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
18 | gray = cv2.medianBlur(gray, 5)
19 | edges = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C,
20 | cv2.THRESH_BINARY, 9, 9)
21 |
22 | # Cartoonization
23 | color = cv2.bilateralFilter(img, 2, 250, 250)
24 | cartoon = cv2.bitwise_or(color, color, mask=edges)
25 |
26 | if(args['output']):
27 | cv2.imwrite(args['output'], cartoon)
28 |
29 |
30 | cv2.imshow("Cartoon", cartoon)
31 | cv2.waitKey(0)
32 | cv2.destroyAllWindows()
--------------------------------------------------------------------------------
/Top_News/Readme.md:
--------------------------------------------------------------------------------
1 | ### Cool IT news
2 | This python made script shows top voted news `basic version votes>99` from hackernews.
3 |
4 | ### Installation
5 | First of all use
6 |
7 | ```
8 | pip install requirements.txt
9 | ```
10 |
11 | ### Run
12 |
13 | ```
14 | python coolnews.py
15 | ```
16 |
17 | ##
18 | If you want news of more then desired number of votes you can edit
19 | ```
20 | Line 29. if points > 99:
21 | ```
22 |
--------------------------------------------------------------------------------
/Top_News/coolnews.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from bs4 import BeautifulSoup
3 | import pprint
4 |
5 | res = requests.get('https://news.ycombinator.com/news')
6 | res2 = requests.get('https://news.ycombinator.com/news?p=2')
7 | soup = BeautifulSoup(res.text, 'html.parser')
8 | soup2 = BeautifulSoup(res2.text, 'html.parser')
9 |
10 | links = soup.select('.storylink')
11 | subtext = soup.select('.subtext')
12 | links2 = soup2.select('.storylink')
13 | subtext2 = soup2.select('.subtext')
14 |
15 | mega_links = links + links2
16 | mega_subtext = subtext + subtext2
17 |
18 | def sort_stories_by_votes(hnlist):
19 | return sorted(hnlist, key= lambda k:k['votes'],reverse=True)
20 |
21 | def create_custom_hn(links,subtext):
22 | hn=[]
23 | for idx, item in enumerate(links):
24 | title =item.getText()
25 | href = item.get('href',None)
26 | vote = subtext[idx].select('.score')
27 | if len(vote):
28 | points = int(vote[0].getText().replace(' points',''))
29 | if points > 99:
30 | hn.append({'title':title,'link':href,'votes':points})
31 | return sort_stories_by_votes(hn)
32 |
33 | pprint.pprint(create_custom_hn(mega_links, mega_subtext))
34 |
35 |
--------------------------------------------------------------------------------
/Top_News/requirements.txt:
--------------------------------------------------------------------------------
1 | requests==2.31.0
2 | bs4==0.0.1
--------------------------------------------------------------------------------
/TranslateCLI/README.md:
--------------------------------------------------------------------------------
1 | # Python Command Line Translator
2 | Use google translate library to translate text from command line.
3 |
4 | ## Requirements
5 |
6 | Python 3.xx
7 | googletrans
8 | ```bash
9 | pip install googletrans
10 |
11 | ```
12 |
13 | ### Usage
14 | python Translate.py -s -d
15 |
--------------------------------------------------------------------------------
/TranslateCLI/Translate.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import argparse
4 | from googletrans import Translator
5 |
6 | def translate(text, src_lng=None, dest_lng=None):
7 | translator = Translator()
8 | if src_lng and dest_lng:
9 | translated = translator.translate(text, src=src_lng, dest=dest_lng)
10 | elif src_lng:
11 | translated = translator.translate(text, src=src_lng)
12 | elif dest_lng:
13 | translated = translator.translate(text, dest=dest_lng)
14 | else:
15 | translated = translator.translate(text)
16 |
17 | return translated
18 |
19 | parser = argparse.ArgumentParser()
20 | parser.add_argument('text', type=str, help='text to translate')
21 | parser.add_argument('-s', '--src', default=None, help='origin language of the text')
22 | parser.add_argument('-d', '--dest', default=None, help='destiny language of the translation')
23 | parser.add_argument('-v', '--verbose', help='show more information', action='store_true')
24 |
25 | args = parser.parse_args()
26 |
27 | tr = translate(args.text, args.src, args.dest)
28 |
29 | if args.verbose:
30 | print('original text: %s' % tr.origin)
31 | print('translated text: %s' % tr.text)
32 | print('origin language: %s' % tr.src)
33 | print('destiny language: %s' % tr.dest)
34 | else:
35 | print(tr.text)
36 |
--------------------------------------------------------------------------------
/TranslateCLI/requirements.txt:
--------------------------------------------------------------------------------
1 | googletrans
2 |
--------------------------------------------------------------------------------
/Tweets_Tool/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Sarah Floris
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 |
--------------------------------------------------------------------------------
/Tweets_Tool/example.csv:
--------------------------------------------------------------------------------
1 | 0,1,2,3
2 | 0,Bayonetta 2,18 Oct 85 ,18 Oct 85
--------------------------------------------------------------------------------
/Tweets_Tool/main.py:
--------------------------------------------------------------------------------
1 | import sys
2 | assert sys.version_info >= (3, 0)
3 | import pandas as pd
4 | import numpy as np
5 | from multiprocessing.pool import ThreadPool
6 | import Tool
7 |
8 |
9 | def main(filepath):
10 | assert isinstance(filepath, str)
11 | videogames = pd.read_csv(filepath, skiprows=1, names=['games', 'start_date', 'end_date'])
12 | videogames = videogames.values
13 | pool = ThreadPool(250)
14 | text_results = pool.map(Tool.TweetObtain().TweetObtain_function,
15 | videogames)
16 | pool.close()
17 | pool.join()
18 | text_results = pd.DataFrame(
19 | np.vstack(text_results))
20 | text_results.to_csv('tweets.csv')
21 | return
22 |
23 | if __name__ == "__main__":
24 | main(sys.argv[1])
25 |
--------------------------------------------------------------------------------
/Tweets_Tool/requirements.txt:
--------------------------------------------------------------------------------
1 | requests==2.31.0
2 | urllib3==1.26.18
3 | requests==2.31.0
4 | urllib3==1.26.18
5 | py4j==0.10.4
6 | BeautifulSoup==3.2.0
7 | numpy==1.22.0
8 |
--------------------------------------------------------------------------------
/Tweets_Tool/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 |
3 | setup(name='Twitter_Tool',
4 | version='0.1',
5 | description='Web scraping ',
6 | url='http://github.com/sdf94/Twitter_Tool',
7 | author='Sarah Floris',
8 | author_email='sdf11c@acu.edu',
9 | license='MIT',
10 | packages=['Twitter_Tool'],
11 | zip_safe=False)
--------------------------------------------------------------------------------
/Upload_files_to_s3/README.md:
--------------------------------------------------------------------------------
1 | # Upload files & folders from your machine to Amazon S3
2 |
3 | A python script that will upload your files & folder to Amzzon S3 using python and boto3
4 |
5 | ## Requirement
6 |
7 | Python 2.xx
8 | boto3
9 | ```bash
10 | pip install boto3
11 | ```
12 |
13 | #Usage
14 | Go to Upload_files_to_s3 directory and add your folder's name you want to upload to s3 and then run upload_files_to_s3.py as below:
15 | ```bash
16 | $ python upload_files_to_s3.py
17 | ```
18 |
--------------------------------------------------------------------------------
/Upload_files_to_s3/requirements.txt:
--------------------------------------------------------------------------------
1 | boto3==1.9.197 # Amazon Web Services SDK for Python
2 |
--------------------------------------------------------------------------------
/Upload_files_to_s3/upload_files_to_s3.py:
--------------------------------------------------------------------------------
1 | import boto3
2 | import os
3 |
4 | ACL = 'public-read' #access type of the file
5 | AWS_ACCESS_KEY_ID = 'your_access_key'
6 | AWS_REGION = 'your_region'
7 | AWS_SECRET_ACCESS_KEY = 'your_secret_key'
8 | AWS_STORAGE_BUCKET_NAME = 'my_bucket'
9 | FOLDER_NAME_ON_S3 = 'my_folder_on_s3'
10 | FOLDER_PATH = '/home/foo/my_folder'
11 |
12 |
13 | def upload_files_to_s3(path):
14 | """
15 | Upload files to AWS s3 bucket from your machine
16 | using python and boto3
17 | """
18 | session = boto3.Session(
19 | aws_access_key_id=AWS_ACCESS_KEY_ID,
20 | aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
21 | region_name=AWS_REGION
22 | )
23 | s3 = session.resource('s3')
24 | bucket = s3.Bucket(AWS_STORAGE_BUCKET_NAME)
25 | for subdir, dirs, files in os.walk(path):
26 | for file in files:
27 | full_path = os.path.join(subdir, file)
28 | with open(full_path, 'rb') as data:
29 | key = FOLDER_NAME_ON_S3 + full_path[len(path) + 1:]
30 | bucket.put_object(Key=key, Body=data, ACL=ACL)
31 |
32 | if __name__ == "__main__":
33 | upload_files_to_s3(FOLDER_PATH)
--------------------------------------------------------------------------------
/Website-Blocker/README.md:
--------------------------------------------------------------------------------
1 | # Website Blocker using Python
2 | This is a program which blocks certain distracting website like Facebook, Youtube etc during your work hours.
3 |
4 | ## Libraby Used
5 | time (datetime is imported from python)
6 |
7 | ## Host Files
8 | Host is an operating system file which maps hostnames to IP addresses.
9 | Using python file handling manipulation I have changed hostnames on the hosts files for a certain interval of day when I'm working and need no distraction and deleted it then after when the time is over.
10 |
11 | ## Location of host file
12 | ### Host file on Mac and Linux :
13 | $ /etc/hosts
14 |
15 | ### Host file on windows :
16 | $ C:\Windows\System32\drivers\etc
17 |
18 | ## Note
19 | * Windows user need to create a duplicate of OS’s host file. Now provide the path of the duplicate file in hosts_path mentioned in the script.
20 | * For scheduling above script in Linux you have to open crontab in your terminal as a root.(use sudo command)
21 |
--------------------------------------------------------------------------------
/Website-Blocker/hosts:
--------------------------------------------------------------------------------
1 | 127.0.0.1 localhost
2 | 127.0.1.1 hastagab-Latitude-6430U
3 |
4 | # The following lines are desirable for IPv6 capable hosts
5 | ::1 ip6-localhost ip6-loopback
6 | fe00::0 ip6-localnet
7 | ff00::0 ip6-mcastprefix
8 | ff02::1 ip6-allnodes
9 | ff02::2 ip6-allrouters
10 |
--------------------------------------------------------------------------------
/Website-Blocker/website_blocker.py:
--------------------------------------------------------------------------------
1 | import time
2 | from datetime import datetime as dt
3 |
4 | host_temp = "hosts" #host file copied to the directory for ease.
5 | host_path = r"/etc/hosts" #original host file address in linux
6 | redirect = "127.0.0.1"
7 | website_list = ["www.facebook.com", "facebook.com"] #You can add your own list of websites
8 |
9 | while True:
10 | if dt(dt.now().year,dt.now().month,dt.now().day,8) < dt.now() < dt(dt.now().year,dt.now().month,dt.now().day,16): #You can choose your own working time period
11 | print("working hours...")
12 | with open(host_path,'r+') as file:
13 | content=file.read()
14 | for website in website_list:
15 | if website in content:
16 | pass
17 | else:
18 | file.write(redirect+" "+ website+"\n")
19 | else:
20 | with open(host_path,'r+') as file:
21 | content=file.readlines()
22 | file.seek(0)
23 | for line in content:
24 | if not any(website in line for website in website_list):
25 | file.write(line)
26 | file.truncate()
27 | print("fun hours...")
28 | time.sleep(10)
29 |
--------------------------------------------------------------------------------
/Website_Url_Detector/README.md:
--------------------------------------------------------------------------------
1 | # Website URL Detector
2 |
3 | ## Description
4 | A python script that detects URLs on a given website.
5 |
6 | ## Usage
7 |
8 | ```py
9 | >>> python detect_urls.py --website [website_url]
10 | ```
11 |
12 | ### Example
13 |
14 | ```py
15 | >>> python detect_urls.py --website https://en.wikipedia.org/wiki/Guido_van_Rossum
16 | https://upload.wikimedia.org/wikipedia/commons/thumb/e/e2/Guido-portrait-2014-drc.jpg/1200px-Guido-portrait-2014-drc.jpg
17 | https://creativecommons.org/licenses/by-sa/3.0/
18 | https://en.wikipedia.org/wiki/Guido_van_Rossum
19 | https://gvanrossum.github.io/
20 | http://mail.python.org/pipermail/python-dev/2007-January/070849.html
21 | https://web.archive.org/web/20090908131440/http://mail.python.org/pipermail/python-dev/2007-January/070849.html
22 | http://www.computerhistory.org/atchm/2018-chm-fellow-guido-van-rossum-python-creator-benevolent-dictator-for-life/
23 | https://web.archive.org/web/20180724114116/http://www.computerhistory.org/atchm/2018-chm-fellow-guido-van-rossum-python-creator-benevolent-dictator-for-life/
24 | https://web.archive.org/web/20081031103755/http://wiki.codecall.net/Guido_van_Rossum
25 | http://wiki.codecall.net/Guido_van_Rossum
26 | ...
27 | ```
--------------------------------------------------------------------------------
/Website_Url_Detector/requirements.txt:
--------------------------------------------------------------------------------
1 | argparse
2 | re
3 | requests==2.31.0
--------------------------------------------------------------------------------
/Wifi-Password/README.md:
--------------------------------------------------------------------------------
1 | **A Simple python Script to view saved password on your system.**
2 |
3 | This script works on both Windows and Linux.
4 |
--------------------------------------------------------------------------------
/Wifi-Password/requirements.txt:
--------------------------------------------------------------------------------
1 | subprocess
2 |
--------------------------------------------------------------------------------
/Wikipedia-Search/README.md:
--------------------------------------------------------------------------------
1 | # Wikipedia Search
2 | This app takes input from the user and searches Wikipedia
3 |
4 | # Requirements
5 |
6 | Python 3 and higher or Python 2 and higher
7 |
8 | Wikipedia Library (https://pypi.org/project/wikipedia/)
9 |
10 | # Usage
11 |
12 | For Windows users:
13 |
14 | ```bash
15 | $ python pywikisearch.py
16 | ```
17 |
18 | For Mac/Linux/Unix users:
19 |
20 | ```bash
21 | $ ./pywikisearch.py
22 | ```
23 |
--------------------------------------------------------------------------------
/Wikipedia-Search/pywikisearch.py:
--------------------------------------------------------------------------------
1 | import wikipedia
2 |
3 | print("Welcome to the app which find an answer to your question from wikipedia")
4 |
5 | while True:
6 | ques = input("What would you like to ask Wikipedia?")
7 | wikipedia.set_lang("en") #change "en" to convenient language for example wikipedia.set_lang("es") will set the language to spanish
8 | print wikipedia.summary(ques, sentences=3)
9 |
--------------------------------------------------------------------------------
/Wikipedia-Search/requirements.txt:
--------------------------------------------------------------------------------
1 | Wikipedia Library (https://pypi.org/project/wikipedia/)
2 |
--------------------------------------------------------------------------------
/Word-generator/README.md:
--------------------------------------------------------------------------------
1 | # Word Generator
2 |
3 | ## Description
4 | A python script that generates english words that contain 2 or more letters from input
5 |
6 | ## Usage
7 | Just run gen.py and type in some letters
8 |
9 | ## Requirements
10 | Python 3
--------------------------------------------------------------------------------
/Word-generator/gen.py:
--------------------------------------------------------------------------------
1 | def getDict(file):
2 | words = set()
3 | with open(file) as d:
4 | for w in d.read().split("\n"):
5 | words.add(w.lower())
6 | return words
7 |
8 | def isEng(word):
9 | englishWords = getDict("dictionary.txt")
10 | if word in englishWords:
11 | return True
12 | return False
13 |
14 | def permutations(xl, length = -1, res=[], output=[]):
15 | if xl == [] or len(res) == length:
16 | output.append(res)
17 | return
18 | for i in range(len(xl)):
19 | permutations(xl[:i] + xl[i + 1:], length, res + [xl[i]], output)
20 | return output
21 |
22 |
23 | while True:
24 | found = set()
25 | letters = [i for i in input("Choose letters: ")]
26 | for sz in range(2, len(letters)+1):
27 | print("\nSize:", sz, "letters")
28 | for comb in permutations(letters, sz ,[], []):
29 | if isEng("".join(comb)) and not "".join(comb) in found:
30 | print("Found word:", "".join(comb))
31 | found.add("".join(comb))
32 | print()
33 |
--------------------------------------------------------------------------------
/Word-generator/isEng.py:
--------------------------------------------------------------------------------
1 | def getDict(file):
2 | words = set()
3 | with open(file) as d:
4 | for w in d.read().split("\n"):
5 | words.add(w.lower())
6 | return words
7 |
8 | def isEng(word):
9 | englishWords = getDict("dictionary.txt")
10 | if word in englishWords:
11 | return True
12 | return False
13 | print(isEng("boot"))
--------------------------------------------------------------------------------
/Word_Frequency_Counter/requirements.txt:
--------------------------------------------------------------------------------
1 | argparse
2 | nltk==3.4.5
3 | re
4 | string
--------------------------------------------------------------------------------
/Word_Frequency_Counter/test_file.txt:
--------------------------------------------------------------------------------
1 | Once upon a time, a princess named Snow White lived in a castle with her father, the King, and her stepmother, the Queen. Her father had always said to his daughter that she must be fair to everyone at court. Said he, "People come here to the castle when they have a problem. They need the ruler to make a fair decision. Nothing is more important than to be fair."
2 |
3 | The Queen, Snow White's stepmother, knew how much this meant to her husband. At the first chance, she went to her magic mirror. "Mirror, mirror, on the wall," said the Queen. "Who is the fairest of them all?"
--------------------------------------------------------------------------------
/Word_Frequency_Counter/test_file_freq_dist.txt:
--------------------------------------------------------------------------------
1 | ('queen', 3)
2 | ('said', 3)
3 | ('fair', 3)
4 | ('mirror', 3)
5 | ('snow', 2)
6 | ('castle', 2)
7 | ('father', 2)
8 | ('stepmother', 2)
9 | ('upon', 1)
10 | ('time', 1)
11 | ('princess', 1)
12 | ('named', 1)
13 | ('white', 1)
14 | ('lived', 1)
15 | ('king', 1)
16 | ('always', 1)
17 | ('daughter', 1)
18 | ('must', 1)
19 | ('everyone', 1)
20 | ('court', 1)
21 | ('people', 1)
22 | ('come', 1)
23 | ('problem', 1)
24 | ('need', 1)
25 | ('ruler', 1)
26 | ('make', 1)
27 | ('decision', 1)
28 | ('nothing', 1)
29 | ('important', 1)
30 | ('whites', 1)
31 | ('knew', 1)
32 | ('much', 1)
33 | ('meant', 1)
34 | ('husband', 1)
35 | ('first', 1)
36 | ('chance', 1)
37 | ('went', 1)
38 | ('magic', 1)
39 | ('wall', 1)
40 | ('fairest', 1)
--------------------------------------------------------------------------------
/Work_Log_Generator/requirements.txt:
--------------------------------------------------------------------------------
1 | QDarkStyle
2 | PyQt5
3 | PyGithub
4 |
--------------------------------------------------------------------------------
/Work_Log_Generator/resources/icone.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Work_Log_Generator/resources/icone.ico
--------------------------------------------------------------------------------
/Work_Log_Generator/resources/loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Work_Log_Generator/resources/loader.gif
--------------------------------------------------------------------------------
/Work_Log_Generator/resources/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/Work_Log_Generator/resources/save.png
--------------------------------------------------------------------------------
/X_Scrapper/README.md:
--------------------------------------------------------------------------------
1 | # X Scrapper
2 | Use to scrape the tweets from given username (including the metadata of the tweet - location of user, views, likes etc.) using `tweepy`.
3 |
4 | ## Use case
5 | 1. To analyze the (sentiment trend of the given user)[https://github.com/iamshreeram/twitter-senti-analyzer] over the period of time (on given topic or anything)
6 | 2. Further analysis of user behaviour using geo-location, time of tweets,
7 |
8 | ### Requirements
9 |
10 | Python 3.xx
11 | tweepy
12 | ```bash
13 | pip install tweepy
14 |
15 | ```
16 |
17 | ### Usage
18 | python main.py
19 |
20 |
21 | ### Note :
22 | 1. This requires you to have the consumer key, consumer secret, access key and access secret from your x.com account
23 |
--------------------------------------------------------------------------------
/X_Scrapper/requirements.txt:
--------------------------------------------------------------------------------
1 | tweepy==4.3.0
2 |
--------------------------------------------------------------------------------
/Youtube_Video_Downloader/README.md:
--------------------------------------------------------------------------------
1 | # Youtube Video Downloader Script
2 |
3 | Requires pytube
4 |
--------------------------------------------------------------------------------
/Youtube_Video_Downloader/requirements.txt:
--------------------------------------------------------------------------------
1 | pytube
2 |
--------------------------------------------------------------------------------
/asymmetric_cryptography/README.md:
--------------------------------------------------------------------------------
1 | ## Asymmetric Encryption in python
2 |
3 | An example of asymmetric encryption in python using a public/private keypair - utilizes RSA from PyCrypto library
4 |
5 | ```bash
6 | pip install pycrypto
7 | python asymmetric.py
8 | ```
--------------------------------------------------------------------------------
/asymmetric_cryptography/asymmetric.py:
--------------------------------------------------------------------------------
1 | from Crypto import Random
2 | from Crypto.PublicKey import RSA
3 | import base64
4 |
5 |
6 | def generate_keys(modulus_length=256*4):
7 | privatekey = RSA.generate(modulus_length, Random.new().read)
8 | publickey = privatekey.publickey()
9 | return privatekey, publickey
10 |
11 |
12 | def encryptit(message , publickey):
13 | encrypted_msg = publickey.encrypt(message, 32)[0]
14 | encoded_encrypted_msg = base64.b64encode(encrypted_msg)
15 | return encoded_encrypted_msg
16 |
17 |
18 | def decryptit(message, privatekey):
19 | decoded_encrypted_msg = base64.b64decode(message)
20 | decoded_decrypted_msg = privatekey.decrypt(decoded_encrypted_msg)
21 | return decoded_decrypted_msg
22 |
23 |
24 | if __name__ == '__main__':
25 | message = "This is a awesome message!"
26 | privatekey , publickey = generate_keys()
27 | encrypted_msg = encryptit(message.encode("utf-8"), publickey)
28 | decrypted_msg = decryptit(encrypted_msg, privatekey)
29 |
30 | print(f'{privatekey.exportKey()} - ({len(privatekey.exportKey())})')
31 | print(f'{publickey.exportKey()} - ({len(publickey.exportKey())})')
32 | print(f'Original: {message} - ({len(message)})')
33 | print(f'Encrypted: {encrypted_msg} - ({len(encrypted_msg)})')
34 | print(f'Decrypted: {decrypted_msg} - ({len(decrypted_msg)})')
--------------------------------------------------------------------------------
/asymmetric_cryptography/requirements.txt:
--------------------------------------------------------------------------------
1 | pycrypto
2 |
--------------------------------------------------------------------------------
/automated_calendar/automated_calendar.py:
--------------------------------------------------------------------------------
1 | '''
2 | THIS CODE CREATES FOLDERS FOR EACH FY OF OUR COMPANY, WHERE WE COULD
3 | FIND 12 OTHER FOLDERS NAMED AFTER EACH MONTH OF THE YEAR.
4 | '''
5 |
6 | #Import modules and libraries we'll use
7 | from pathlib import Path
8 |
9 | #Create the folders where we'll store our automated calendar
10 | months =['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
11 | 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
12 |
13 | for i,month in enumerate(months):
14 | Path(f'Year1/{i+1}.{month}').mkdir(parents=True,exist_ok=True)
15 | Path(f'Year2/{i+1}.{month}').mkdir(parents=True,exist_ok=True)
16 | Path(f'Year3/{i+1}.{month}').mkdir(parents=True,exist_ok=True)
17 | Path(f'Year4/{i+1}.{month}').mkdir(parents=True,exist_ok=True)
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/automated_calendar/requirements.txt:
--------------------------------------------------------------------------------
1 | pkg-resources==0.0.0
2 |
--------------------------------------------------------------------------------
/automated_email/README.md:
--------------------------------------------------------------------------------
1 | #Automated email python script You can now send emails to multiple people at once easily with only a few clicks using smtplib module in Python
2 |
3 | #Requirement Python version 3 and above smtplib json
4 |
5 | ```bash
6 | pip install smtplib
7 | pip install json
8 | ```
9 |
10 | Can be run easily using commmand prompt (python automated_email.py)
11 | -> login as you would for your gmail account( same email and password)
12 | -> find your way with the intuitive user friendly menu
13 | (!!!Your passwords and emails are only stored on your local device and no one has access to your information otherwise!!!)
14 |
--------------------------------------------------------------------------------
/automated_email/requirements.txt:
--------------------------------------------------------------------------------
1 | smtplib
2 | json
3 |
--------------------------------------------------------------------------------
/caesar_cipher/README.md:
--------------------------------------------------------------------------------
1 | # Simple caesar Cipher [En,De]coder
2 |
3 | A simple implementation of a CLI tool to work with caesar ciphers. The default implementation is ROT-13, but can be
4 | adjusted for any offset. Works on files and string arguments passed via CLI.
5 |
6 | ```bash
7 | python3 caesar.py
8 |
9 | usage: caesar.py [-h] [-d] [-o OFFSET] (-f FILE | -s STRING)
10 | caesar.py: error: one of the arguments -f/--file -s/--string is required
11 | ```
12 |
13 | ```bash
14 | python3 caesar.py -s "have you tried turning it off and on again?"
15 | unir lbh gevrq gheavat vg bss naq ba ntnva?
16 | ```
17 |
18 | ```bash
19 | python3 caesar.py -d -s "unir lbh gevrq gheavat vg bss naq ba ntnva?"
20 | have you tried turning it off and on again?
21 | ```
22 |
23 | ```bash
24 | python3 caesar.py -s "have you tried turning it off and on again?" -o -4
25 | dwra ukq pneaz pqnjejc ep kbb wjz kj wcwej?
26 | ```
27 |
28 |
--------------------------------------------------------------------------------
/cli_calculator/README.md:
--------------------------------------------------------------------------------
1 | # calc_argparser
2 | Calculadora via CLI
3 |
4 | # Instructions
5 | To run CLI_Calculator execute:
6 |
7 | - `python args.py -h` - For help
8 | - `python args.py --sum x y` - To sum two numbers
9 | - `python args.py --sub x y` - To substraction two numbers
10 | - `python args.py --mult x y` - To multiplication two numbers
11 | - `python args.py --div x y` - To divide two numbers
12 |
--------------------------------------------------------------------------------
/cli_calculator/calc/__init__.py:
--------------------------------------------------------------------------------
1 | from .calc import sub, mult, div, soma
2 |
3 | __all__ = ['sub', 'mult', 'div', 'soma']
4 |
--------------------------------------------------------------------------------
/cli_calculator/calc/args.py:
--------------------------------------------------------------------------------
1 | """Calculadora utilizando ArgumentParser."""
2 |
3 | from argparse import ArgumentParser
4 |
5 | from calc import soma, sub, mult, div
6 |
7 |
8 | parser = ArgumentParser(description='Calculadora')
9 |
10 | parser.add_argument('--sum', help='Operação de soma', action='store_true')
11 | parser.add_argument('--sub', help='Operação de subtração', action='store_true')
12 | parser.add_argument('--mult', help='Operação de multiplicação', action='store_true')
13 | parser.add_argument('--div', help='Operação de divisão', action='store_true')
14 | parser.add_argument('x', type=int, help='Primeiro valor')
15 | parser.add_argument('y', type=int, help='Segundo valor')
16 |
17 | args = parser.parse_args()
18 |
19 | if args.sum:
20 | print(f'{soma(args.x, args.y)}')
21 |
22 | if args.sub:
23 | print(f'{sub(args.x, args.y)}')
24 |
25 | if args.mult:
26 | print(f'{mult(args.x, args.y)}')
27 |
28 | if args.div:
29 | print(f'{div(args.x, args.y)}')
30 |
--------------------------------------------------------------------------------
/cli_calculator/calc/calc.py:
--------------------------------------------------------------------------------
1 |
2 | def soma(x :int, y: int) -> int:
3 | """Função de soma."""
4 | return x + y
5 |
6 |
7 | def sub(x :int, y: int) -> int:
8 | """Função de subtração."""
9 | return x - y
10 |
11 | def mult(x :int, y: int) -> int:
12 | """Função de multiplicação."""
13 | return x * y
14 |
15 |
16 | def div(x :int, y: int) -> int:
17 | """Função de divisão."""
18 | try:
19 | return x / y
20 |
21 | except ZeroDivisionError:
22 | return 'Divisao por zero mal sucedida!!'
23 |
--------------------------------------------------------------------------------
/cli_calculator/tests/test_calc.py:
--------------------------------------------------------------------------------
1 | from unittest import TestCase
2 |
3 | from calc import soma, sub, mult, div
4 |
5 |
6 | class testCalc(TestCase):
7 | def test_should_return_two_values_sum(self):
8 | esperado = 1 + 2
9 | self.assertEqual(esperado, soma(1,2))
10 |
11 |
12 | def test_should_return_two_values_sub(self):
13 | esperado = 1 - 2
14 | self.assertEqual(esperado, sub(1,2))
15 |
16 |
17 | def test_should_return_two_values_mult(self):
18 | esperado = 1 * 2
19 | self.assertEqual(esperado, mult(1,2))
20 |
21 | def test_should_return_two_values_div(self):
22 | esperado = 1 / 2
23 | self.assertEqual(esperado, div(1,2))
24 |
25 |
26 | def test_should_return_exceptio_on_division_by_zero(self):
27 | esperado = 'Divisao por zero mal sucedida!!'
28 | self.assertEqual(esperado, div(1,0))
29 |
--------------------------------------------------------------------------------
/codeforcesChecker/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4==4.8.1
2 | chromedriver-binary==81.0.4044.69.0
3 | colorama==0.4.3
4 | requests==2.31.0
5 | selenium==3.141.0
6 | termcolor==1.1.0
--------------------------------------------------------------------------------
/covid_visualiser/README.md:
--------------------------------------------------------------------------------
1 |
2 | --> Clone the project
3 |
4 | --> run pip install -r requirements.txt
5 |
6 | -- > python3 main.py
7 |
8 | -- >It will launch a firefox tab showing the map
9 |
10 |
11 | This project visualise the current COVID position of India on a map using Folium
12 |
13 | (will extend it to more countries later)
14 |
--------------------------------------------------------------------------------
/covid_visualiser/requirements.txt:
--------------------------------------------------------------------------------
1 | folium==0.10.1
2 |
--------------------------------------------------------------------------------
/csv_to_json/README.md:
--------------------------------------------------------------------------------
1 | # CSV to JSON Converter
2 | A python script that converts the csv file into json
3 |
4 | ## CLI interface
5 | 
6 |
7 | ## Files
8 | before
9 | 
10 | After
11 | 
12 |
--------------------------------------------------------------------------------
/csv_to_json/convert.py:
--------------------------------------------------------------------------------
1 | import csv
2 | import json
3 |
4 | file_name = input("Provide the CSV filename without extension>> ")
5 |
6 | try:
7 |
8 | with open(file_name+'.csv') as f:
9 |
10 | reader = csv.reader(f, delimiter=',')
11 | titles = []
12 | temp_data = {}
13 |
14 | for heading in reader:
15 | titles = heading
16 | break
17 |
18 | i = 1
19 | for row in reader:
20 | current_row = "row{}".format(i)
21 | temp_data['{}'.format(current_row)] = {}
22 | for col in range(len(titles)):
23 | temp_data[current_row][titles[col]] = row[col]
24 | i+=1
25 |
26 | with open(file_name+'.json', 'w') as f_j:
27 | json.dump(temp_data, f_j, indent=4)
28 |
29 | except:
30 | print("Please provide correct filename")
31 |
32 | print("File converted successfully :)")
--------------------------------------------------------------------------------
/csv_to_json/img/CLI.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/csv_to_json/img/CLI.jpg
--------------------------------------------------------------------------------
/csv_to_json/img/after.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/csv_to_json/img/after.jpg
--------------------------------------------------------------------------------
/csv_to_json/img/before.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/csv_to_json/img/before.jpg
--------------------------------------------------------------------------------
/csv_to_json/requirements.txt:
--------------------------------------------------------------------------------
1 | csv
2 | json
--------------------------------------------------------------------------------
/elastic-snapshot/requirements.txt:
--------------------------------------------------------------------------------
1 | certifi==2023.7.22
2 | chardet==3.0.4
3 | idna==2.10
4 | requests==2.31.0
5 | urllib3==1.26.18
6 |
--------------------------------------------------------------------------------
/extended_ip_address_info/README.md:
--------------------------------------------------------------------------------
1 | # Extended IP address info
2 |
3 | View extended info about your public IP address from the terminal.
4 |
5 | The python script runs `curl` with the following parameters
6 | ```bash
7 | curl -H "Accept: application/json" https://ipinfo.io/json
8 | ```
9 |
10 | ## Create virtual environment and run
11 | Create virtual environment.
12 | ```bash
13 | python3 -m venv /path/to/new/virtual/environment
14 | ```
15 |
16 | Activate virtual environment.
17 | ```bash
18 | cd
19 | source bin/activate
20 | ```
21 |
22 | Install required libraries.
23 | ```bash
24 | pip install -r requirements.txt
25 | ```
26 |
27 | **Run program.**
28 | ```bash
29 | python extended_ip_address_info.py
30 | ```
31 |
32 | Deactivate virtual environment.
33 | ```bash
34 | deactivate
35 | ```
36 |
37 | ## Output
38 | Output should be in the form of the following:
39 | ```json
40 | {
41 | "ip": "xxx.xxx.xxx.xxx",
42 | "city": "A_city",
43 | "hostname": "host.isp-website.com",
44 | "region": "A_region",
45 | "country": "Country code",
46 | "loc": "coordinates",
47 | "org": "AS-number ISP-name",
48 | "postal": "postal-code",
49 | "timezone": "Europe/City",
50 | "readme": "https://ipinfo.io/missingauth"
51 | }
52 | ```
--------------------------------------------------------------------------------
/extended_ip_address_info/extended_ip_address_info.py:
--------------------------------------------------------------------------------
1 | #!/bin/python
2 | # -*- coding: utf-8 -*-
3 |
4 | # Using curl to get data from https://ipinfo.io/json
5 | # Template from pycurl documentation
6 | # http://pycurl.io/docs/latest/quickstart.html#examining-response-headers
7 |
8 | import pycurl #curl library
9 | import certifi #HTTP over TLS/SSL library
10 | from io import BytesIO #Buffered I/O implementation using an in-memory bytes buffer.
11 |
12 | #set header, '--header' or -H
13 | header = ['Accept: application/json']
14 |
15 | buffer = BytesIO()
16 | c = pycurl.Curl() #curl
17 | c.setopt(c.HTTPHEADER, header) #header
18 | c.setopt(c.URL, 'https://ipinfo.io/json') #URL
19 | c.setopt(c.WRITEDATA, buffer)
20 | c.setopt(c.CAINFO, certifi.where()) # SSL certificates
21 | c.perform()
22 | c.close()
23 |
24 | body = buffer.getvalue()
25 | # Body is a byte string.
26 | # We have to know the encoding in order to print it to a text file
27 | # such as standard output.
28 | print(body.decode('iso-8859-1'))
--------------------------------------------------------------------------------
/extended_ip_address_info/requirements.txt:
--------------------------------------------------------------------------------
1 | pycurl
2 | certifi
--------------------------------------------------------------------------------
/file-encrypt-decrypt/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
--------------------------------------------------------------------------------
/file-encrypt-decrypt/Pipfile:
--------------------------------------------------------------------------------
1 | [[source]]
2 | name = "pypi"
3 | url = "https://pypi.org/simple"
4 | verify_ssl = true
5 |
6 | [dev-packages]
7 |
8 | [packages]
9 | cryptography = "*"
10 | pytest = "*"
11 |
12 | [requires]
13 | python_version = "3.7"
14 |
--------------------------------------------------------------------------------
/file-encrypt-decrypt/README.md:
--------------------------------------------------------------------------------
1 | # 🗝 crypt
2 |
3 | A command line python script which can Encrypt a given file and also decrypt the encrypted file
4 |
5 |
6 |
7 | #### Pre-requisites
8 | * install pipenv
9 | ```sh
10 | $ brew install pipenv
11 | ```
12 |
13 | * install dependencies
14 | ```sh
15 | $ pipenv install
16 | ```
17 |
18 | #### Usage
19 | * Encrypt file
20 | ```sh
21 | $ pipenv run python crypt -e file.txt
22 | ```
23 | * Decrypt file
24 | ```sh
25 | $ pipenv run python crypt -d file.enc
26 | ```
27 | **note**
28 | - `file.enc` will be created if you pass in `file.txt`
29 | - Do not loose the Encryption 🗝
--------------------------------------------------------------------------------
/git_automation/.my_commands.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function create() {
4 | cd
5 | source .env
6 | python create.py $1
7 | cd $FILEPATH$1
8 | git init
9 | git remote add origin git@github.com:$USERNAME/$1.git
10 | touch README.md
11 | git add .
12 | git commit -m "Initial commit"
13 | git push -u origin main
14 | code .
15 | }
16 |
17 |
18 |
--------------------------------------------------------------------------------
/git_automation/README.md:
--------------------------------------------------------------------------------
1 | ### Install:
2 | ```bash
3 | pip install -r requirements.txt
4 | touch .env
5 | Then open the .env file and store your username, password, and desired file destination. Use the provided format at the bottom of this README.
6 | source ~/.my_commands.sh
7 | ```
8 |
9 | ### Usage:
10 | ```bash
11 | To run the script type in 'create '
12 | ```
13 |
--------------------------------------------------------------------------------
/git_automation/config.env:
--------------------------------------------------------------------------------
1 | USERNAME="User"
2 | PASSWORD="Pass"
3 | FILEPATH="/path/to/your/project/"
--------------------------------------------------------------------------------
/git_automation/create.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | from github import Github
4 | from dotenv import load_dotenv
5 |
6 | load_dotenv()
7 |
8 | path = os.getenv("FILEPATH")
9 | username = os.getenv("USERNAME")
10 | password = os.getenv("PASSWORD")
11 |
12 | def create():
13 | folderName = str(sys.argv[1])
14 | folderpath = os.path.join(path,folderName)
15 | if os.path.exists(folderpath):
16 | print("Folder already exists.. Link to the path - "+ folderpath)
17 | os.makedirs(folderpath)
18 | user = Github(username, password).get_user()
19 | repo = user.create_repo(sys.argv[1])
20 | print("Succesfully created repository {}".format(sys.argv[1]))
21 |
22 |
23 | if __name__ == "__main__":
24 | create()
25 |
--------------------------------------------------------------------------------
/git_automation/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium
2 | PyGithub
3 | python-dotenv
4 |
--------------------------------------------------------------------------------
/google_meet_joiner/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Automated Google Meet Joiner
3 |
4 | An automated google meet joiner the auto-joins meetings according to schedule.
5 |
6 |
7 |
8 |
9 | ## Setup
10 |
11 | 1. To run this project, download the files and run the following command to install all the necessary files.
12 |
13 | ```bash
14 | pip install -r requirements.txt
15 | ```
16 |
17 | 2. Then open the `meeting_ids.txt` file and add your meeting ids for the day in order on each line.
18 |
19 | E.g.
20 | ```bash
21 | meeting_id_1
22 | meeting_id_2
23 | meeting_id_3
24 | ```
25 |
26 | 3. Then open the `meeting_times.txt` file and add your meeting time (in the 24-hour format, e.g. 16:00) for the day in order on each line.
27 |
28 | E.g.
29 | ```bash
30 | 16:00
31 | 17:30
32 | 18:50
33 | ```
34 | 4. The run the python file either normally or using the `pythonw` version to avoid a dialog box.
35 |
36 | ```bash
37 | pythonw main.py
38 | ```
39 |
40 |
41 | ## Additional Setup
42 |
43 | 5. To add more than the default 3 meetings setup by the program, simply add your meeting ids and time to the respective file and copy the following line and paste it in the program for as many ids that you add.
44 |
45 | ```bash
46 | schedule.every().day.at(time[x]).do(joinGoogleMeet(ids[x]))
47 | ```
48 | - Remember to replace the 'x' with the number on which the meeting id and time is located.
49 |
50 | ## License
51 |
52 | [MIT](https://choosealicense.com/licenses/mit/)
53 |
54 |
55 | ## Authors
56 |
57 | - [@JohanSanSebastian](https://www.github.com/johansansebastian)
58 |
59 |
--------------------------------------------------------------------------------
/google_meet_joiner/assets/finalJoinMeet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hastagAB/Awesome-Python-Scripts/f0ea440d412b9b079e3346600f24c74a8ea96386/google_meet_joiner/assets/finalJoinMeet.png
--------------------------------------------------------------------------------
/google_meet_joiner/main.py:
--------------------------------------------------------------------------------
1 | import pyautogui
2 | import webbrowser
3 | import schedule
4 | import time
5 |
6 | def joinGoogleMeet(meeting_id):
7 | webbrowser.open_new_tab(
8 | f"https://meet.google.com/{meeting_id}".replace("'", ""))
9 | time.sleep(10)
10 |
11 | pyautogui.click()
12 | pyautogui.hotkey('ctrl', 'd')
13 | time.sleep(1)
14 | pyautogui.hotkey('ctrl', 'e')
15 |
16 | finaljoinBTN = pyautogui.locateCenterOnScreen(
17 | "assets/finalJoinMeet.png")
18 | pyautogui.moveTo(finaljoinBTN)
19 | pyautogui.click()
20 |
21 | if __name__ == '__main__':
22 | # meeting_id = input("Meeting ID: ")
23 | # joinGoogleMeet(meeting_id)
24 |
25 | with open('meeting_ids.txt', 'r') as f:
26 | ids = f.readlines()
27 | with open('meeting_times.txt', 'r') as j:
28 | time = j.readlines()
29 |
30 | # You can add more number of scheduled meetings using the line below,
31 | # replacing 'x' with the value of the meeting id and time in their respective times
32 |
33 | # schedule.every().day.at(time[x]).do(joinGoogleMeet(ids[x]))
34 |
35 | schedule.every().day.at(time[0]).do(joinGoogleMeet(ids[0]))
36 | schedule.every().day.at(time[1]).do(joinGoogleMeet(ids[1]))
37 | schedule.every().day.at(time[2]).do(joinGoogleMeet(ids[2]))
38 |
--------------------------------------------------------------------------------
/google_meet_joiner/meeting_ids.txt:
--------------------------------------------------------------------------------
1 | meeting_id_1
2 | meeting_id_2
3 | meeting_id_3
4 |
--------------------------------------------------------------------------------
/google_meet_joiner/meeting_times.txt:
--------------------------------------------------------------------------------
1 | meeting_time_1
2 | meeting_time_2
3 | meeting_time_3
4 |
--------------------------------------------------------------------------------
/google_meet_joiner/requirements.txt:
--------------------------------------------------------------------------------
1 | PyAutoGUI==0.9.53
2 | schedule==1.1.0
--------------------------------------------------------------------------------
/imageWatermarker/README.md:
--------------------------------------------------------------------------------
1 | ## Python script to watermark your images
2 |
3 | in the `main.py` file edit the following items:
4 |
5 | ```bash
6 | "",
7 | "