A collection of Python Scripts made for fun, while exploring Python 🐍

Overview

JFF-Python-Scripts

A collection of Python Scripts made for fun, while exploring Python 🐍

Inspiration 💡

Many of the programs in this repository are inspired from the projects given in Automate the Boring Stuff with Python by Al Sweigart and some other are born out of redundant curiosity of a boring mind during lazy afternoons.

This repository would contain python scripts, some of which might come of use occasionally. The purpose of creating this is to explore the various modules and implementations of the language through creating programs that are as much fun to use as they are to make.

How to Use? 😀

  • Clone the repository $ git clone https://github.com/thepushkarp/JFF-Python-Scripts.git
  • Create a virtual environment (click here to learn about Virtual Environment)
virtualenv env
  • Activate virtual environment (On macOS and Linux)
source env/bin/activate
  • Activate virtual environment (On Windows)
.\env\Scripts\activate
  • Install requirements
pip3 install -r requirements.txt
  • Run and explore the scripts!

NOTE: All the scripts are written in Python 3. So, make sure to use the appropriate version of pip and python.

Contents 📄

Code Destroyer

Code Destroyer, inspired by a tweet by Ben Johnson, replaces semicolon ";" (U+003B) in files with a Greek Question Mark ";" (U+037E), that looks alike, but shows syntax errors (since it is a different character) leaving the programmer scratching their heads in confusion. ;-)

Usage:

Put the file to be destroyed in the same folder as this script and run:

python3 codeDestroyer.py

Enter the full filename (like helloWorld.c) in the prompt that follows.

Disclaimer: Do not use this to prank on someone's hard-work. You know how frustating that feels.

Extract Phone Number and Email

Takes in the text from your clipboard and saves the Phone Numbers and Email Addresses found in it to .txt files. It searches for Indian Mobile Phone Numbers, Toll-Free Numbers, Telephone Numbers and Emails using Regular Expressions.

Useful if you have a large text data (like a website) and you are searching for phone numbers of emails in that text.

Usage:

python3 phoneAndEmail.py

Two files, emails.txt and phoneNumbers.txt would be created in the same directory containing the emails and phone numbers from the copied text.

Search files based on size

Lets you search through a folder based on file size. Asks user for folder path and size. Files and subfolders inside the folder, greater than or equal to the input size would be displayed.

Useful if you want to find large files and folders taking up space and wish to delete them.

Usage:

python3 searchSize.py

When prompted, enter the minimum size (in bytes) and the folder where files are to be searched. If the path entered is correct, the files, above and equal the size entered would be displayed.

Fill gaps in naming

Finds all files with a given prefix, such as spam001.txt, spam002.txt, and so on, in a single folder and locates any gaps in the numbering (such as if there is a spam001.txt and spam003.txt but no spam002.txt) and reanames all the files to close this gap.

Useful if you have a number of files with same prefix and numbering after it and by some case, there is irregularity in numbering (like after deleting unnecessary images from a camera) and you wish to get a ragular naming in those files.

Usage:

python3 fillGap.py

Enter the file prefix, extesion name and taret folder in the prompt that appears. The files would be named in order, closing gaps, if any.

Combine PDF files

Combines all the PDFs in the current working directory into a single PDF. The program also prompts user if they want to include the cover page of all the PDFs that are being merged.

It is recommended to rename files so that they are lexographically in the same order as they are to be combined and put them in the same directory as the script. The combined PDF would be saved as the name of the first file in the lexographic order prepended with 'combined'.

Useful if you have many PDF and you want to read them all one after the another (like all the PDFs of a professor's slides that you wish to read before exams). You won't need to go from one PDF to another after using this and would also have the option of adding or removing the coverpage of each PDF.

Ensure that none of the PDFs are encrypted.

Usage:

python3 combinePDF.py

Choose whether you want to include the cover page of each individual PDF by entering y or n.

Add Watermark to PDF

Add watermark to every page of a PDF document.

The watermark file should be a PDF too. If you want to make an image or text as a watermark, put them in a word file and stylize as per you want it to appear as the watermark and then export the file as PDF. This file would be the watermark file.

The usefullness of this script is straightforward - To add watermark to PDF files to prove its originality, make it harder to copy, and add authorship.

Ensure that none of the PDFs are encrypted.

Usage:

python3 addWatermarkPDF.py

Enter the filenames of the PDF to be watermarked and then of the watermark PDF.

Encrypt or Decrypt a PDF

Encrypt an unencrypted PDF file with a password or decrypt a password-protected PDF and save as an unencrypted file.

The usefullness of this script too is pretty straightforward - To add or remove privacy to PDF files.

Usage:

python3 encryptDecryptPDF.py

Choose whether you want to encrypt or decrypt a PDF and then enter the name of the file. You would be prompted to enter the password either to encrypt the PDF or decrypt it, as selected earlier.

Add Logo to Images

Adds logo to the lower-right corner of all the pngs, jpgs and jpegs in the directory. The size of logo is approximately 1/10 th of the size of the image and has a padding of 1/25 th to the right and bottom of the logo is added.

Useful to add logos to images to prove their originality, make them harder to copy, and add authorship.

Usage:

python3 addLogo.py

Enter the location of the logo file in the prompt that follows. All the images with added logo would be saved in the 'withLogo' directory.

License

MIT License


File Templates taken from awesome-bashrc and HackerRank-Test-Case-Generator.

Made with by Pushkar Patel

Owner
Pushkar Patel
Research Intern at SPIRE Labs, IISC Bangalore | GitHub Campus Expert @iiitv
Pushkar Patel
Python Client for Algorithmia Algorithms and Data API

Algorithmia Common Library (python) Python client library for accessing the Algorithmia API For API documentation, see the PythonDocs Algorithm Develo

Algorithmia 138 Oct 26, 2022
Algorithmic virtual trading using the neostox platform

Documentation Neostox doesnt have an API Support, so this is a little selenium code to automate strategies How to use Clone this repository and then m

Abhishek Mittal 3 Jul 20, 2022
Resilient Adaptive Parallel sImulator for griD (rapid)

Rapid is an open-source software library that implements a novel “parallel-in-time” (Parareal) algorithm and semi-analytical solutions for co-simulation of integrated transmission and distribution sy

Richard Lincoln 7 Sep 07, 2022
🧬 Performant Evolutionary Algorithms For Python with Ray support

🧬 Performant Evolutionary Algorithms For Python with Ray support

Nathan 49 Oct 20, 2022
This project is an implementation of a simple K-means algorithm

Simple-Kmeans-Clustering-Algorithm Abstract K-means is a centroid-based algorithm, or a distance-based algorithm, where we calculate the distances to

Saman Khamesian 7 Aug 09, 2022
A fast, pure python implementation of the MuyGPs Gaussian process realization and training algorithm.

Fast implementation of the MuyGPs Gaussian process hyperparameter estimation algorithm MuyGPs is a GP estimation method that affords fast hyperparamet

Lawrence Livermore National Laboratory 13 Dec 02, 2022
Algorithm and Structured Programming course project for the first semester of the Internet Systems course at IFPB

Algorithm and Structured Programming course project for the first semester of the Internet Systems course at IFPB

Gabriel Macaúbas 3 May 21, 2022
Cormen-Lib - An academic tool for data structures and algorithms courses

The Cormen-lib module is an insular data structures and algorithms library based on the Thomas H. Cormen's Introduction to Algorithms Third Edition. This library was made specifically for administeri

Cormen Lib 12 Aug 18, 2022
TikTok X-Gorgon & X-Khronos Generation Algorithm

TikTok X-Gorgon & X-Khronos Generation Algorithm X-Gorgon and X-Khronos headers are required to call tiktok api. I will provide you API as rental or s

TikTokMate 31 Dec 01, 2022
Rover. Finding the shortest pass by Dijkstra’s shortest path algorithm

rover Rover. Finding the shortest path by Dijkstra’s shortest path algorithm Задача Вы — инженер, проектирующий роверы-беспилотники. Вам надо спроекти

1 Nov 11, 2021
Python based framework providing a simple and intuitive framework for algorithmic trading

Harvest is a Python based framework providing a simple and intuitive framework for algorithmic trading. Visit Harvest's website for details, tutorials

100 Jan 03, 2023
A* (with 2 heuristic functions), BFS , DFS and DFS iterativeA* (with 2 heuristic functions), BFS , DFS and DFS iterative

Descpritpion This project solves the Taquin game (jeu de taquin) problem using different algorithms : A* (with 2 heuristic functions), BFS , DFS and D

Ayari Ahmed 3 May 09, 2022
PICO is an algorithm for exploiting Reinforcement Learning (RL) on Multi-agent Path Finding tasks.

PICO is an algorithm for exploiting Reinforcement Learning (RL) on Multi-agent Path Finding tasks. It is developed by the Multi-Agent Artificial Intel

21 Dec 20, 2022
It is a platform that implements some path planning algorithms.

PathPlanningAlgorithms It is a platform that implements some path planning algorithms. Main dependence: python3.7, opencv4.1.1.26 (for image show) Tip

5 Feb 24, 2022
A calculator to test numbers against the collatz conjecture

The Collatz Calculator This is an algorithm custom built by Kyle Dickey, used to test numbers against the simple rules of the Collatz Conjecture. Get

Kyle Dickey 2 Jun 14, 2022
A litle algorithm that i made for transform a picture in a spreadsheet.

PicsToSheets How it works? It is an algorithm designed to transform an image into a spreadsheet file. this converts image pixels to color cells of she

Guilherme de Oliveira 1 Nov 12, 2021
Algorithms-in-Python - Programs related to DSA in Python for placement practice

Algorithms-in-Python Programs related to DSA in Python for placement practice CO

MAINAK CHAUDHURI 2 Feb 02, 2022
A library for benchmarking, developing and deploying deep learning anomaly detection algorithms

A library for benchmarking, developing and deploying deep learning anomaly detection algorithms Key Features • Getting Started • Docs • License Introd

OpenVINO Toolkit 1.5k Jan 04, 2023
causal-learn: Causal Discovery for Python

causal-learn: Causal Discovery for Python Causal-learn is a python package for causal discovery that implements both classical and state-of-the-art ca

589 Dec 29, 2022
Ralebel is an interpreted, Haitian Creole programming language that aims to help Haitians by starting with the fundamental algorithm

Ralebel is an interpreted, Haitian Creole programming language that aims to help Haitians by starting with the fundamental algorithm

Lub Lorry Lamysère 5 Dec 01, 2022