├── .github
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── blank.yml
│ ├── issue.yml
│ └── python-app.yml
├── CODE_OF_CONDUCT.md
├── LICENSE
├── Notebooks
├── Customer_loan_repayment_problem
│ ├── datasets_137197_325031_test_Y3wMUE5_7gLdaTN.csv
│ └── loan-prediction-problem.ipynb
└── README.md
├── README.md
├── README_TEMPLATE.md
├── docs
├── .nojekyll
├── README.md
├── _config.yml
├── assets
│ └── css
│ │ └── main.css
└── index.html
├── projects
├── All_links_from_given_webpage
│ ├── README.md
│ ├── get_links.py
│ └── requirements.txt
├── Ascii_art
│ ├── README.md
│ ├── make_art.py
│ ├── requirements.txt
│ ├── sample_image.png
│ └── sample_output.png
├── Battery_notification
│ ├── README.md
│ ├── battery.py
│ └── requirements.txt
├── Calculate_age
│ ├── README.md
│ └── calculate.py
├── Capture_Video_Frames
│ ├── README.md
│ ├── capture_video_frames.py
│ └── requirements.txt
├── Check_website_connectivity
│ ├── README.md
│ ├── check_connectivity.py
│ ├── requirements.txt
│ ├── website_status.csv
│ └── websites.txt
├── Cli_todo
│ ├── README.md
│ ├── requirements.txt
│ ├── todo.py
│ └── todo.txt
├── Convert_JPEG_to_PNG
│ ├── README.md
│ ├── converter_GUI.py
│ ├── converter_terminal.py
│ ├── input.jpeg
│ └── output.png
├── Convert_JSON_to_CSV
│ ├── README.md
│ ├── converter.py
│ ├── input.json
│ └── output.csv
├── Convert_XML_To_JSON
│ ├── README.md
│ ├── converter.py
│ ├── input.xml
│ ├── output.json
│ └── requirements.txt
├── Convert_a_image_to_pdf
│ ├── README.md
│ ├── convert_image_to_pdf.py
│ └── requirements.txt
├── Convert_numbers_to_word
│ ├── README.md
│ ├── Screenshot.png
│ └── converter.py
├── Create_a_script_to_encrypt_files_and_folder
│ ├── README.md
│ ├── encrypt.py
│ └── requirements.txt
├── Create_a_simple_stopwatch
│ ├── README.md
│ └── stopwatch.py
├── Create_calculator_app
│ ├── README.md
│ ├── calculator.py
│ └── output.png
├── Currency_converter
│ ├── README.md
│ ├── cc.py
│ └── output.png
├── Decimal_to_binary_convertor_and_vice_versa
│ ├── README.md
│ ├── decimal_to_binary.py
│ └── output.png
├── Digital_clock
│ ├── Digital Clock.PNG
│ ├── README.md
│ └── digital_clock.py
├── Dns_record
│ ├── README.md
│ ├── dns_record.py
│ └── requirements.txt
├── Dominant_color
│ ├── README.md
│ ├── find-color.py
│ └── requirements.txt
├── Download_images_from_website
│ ├── Readme.md
│ ├── requirements.txt
│ └── scrap-img.py
├── Duplicate files remover
│ ├── README.md
│ ├── Screenshot.png
│ └── duplicatefileremover.py
├── EasyVideoPlayer
│ ├── EasyVideoPlayer.py
│ ├── README.md
│ └── requirements.txt
├── Easy_cartoonify
│ ├── README.md
│ └── easy_cartoonify.py
├── Encrypt_and_decrypt_text
│ ├── README.md
│ ├── aes_encode.py
│ ├── output.png
│ └── requirements.txt
├── Extract_zip_files
│ ├── README.md
│ └── extract_zip_files.py
├── Fetch HTTP status code
│ ├── README.md
│ ├── fetch_http_status_code.py
│ └── requirements.txt
├── Fetch_and_store_tweets
│ ├── README.md
│ ├── fetch_store_tweet.py
│ ├── img
│ │ ├── output-2.PNG
│ │ ├── output-2.png
│ │ ├── output.PNG
│ │ ├── output.png
│ │ ├── step-1.PNG
│ │ ├── step-1.png
│ │ ├── step-2.PNG
│ │ ├── step-2.png
│ │ ├── step-3.PNG
│ │ ├── step-3.png
│ │ ├── step-4.PNG
│ │ ├── step-4.png
│ │ ├── step-5.PNG
│ │ ├── step-5.png
│ │ ├── step-6.PNG
│ │ ├── step-6.png
│ │ ├── step-7.png
│ │ └── step-9.png
│ └── requirements.txt
├── Fetch_current_weather
│ ├── README.md
│ └── fetch_current_weather.py
├── Fetch_open_ports
│ ├── README.md
│ ├── Screenshot.png
│ └── fetch_open_port.py
├── Find_imdb_rating
│ ├── .gitignore
│ ├── README.md
│ ├── find_IMDb_rating.py
│ └── requirements.txt
├── Find_out_hostname_and_ip_address
│ ├── Hostname_IPaddress.py
│ ├── README.md
│ └── Screenshot.png
├── Geocoding
│ ├── README.md
│ ├── geocoding.py
│ └── requirements.txt
├── Get_meta_information_of_images
│ ├── README.md
│ ├── author_utils.py
│ ├── get_meta_from_pic.py
│ ├── gps_utils.py
│ └── requirements.txt
├── Get_wifi_password
│ ├── README.md
│ └── wifi.py
├── Hashing_passwords
│ ├── README.md
│ └── hashing_passwords.py
├── Hello
│ ├── Hello.py
│ └── README.md
├── Image_watermark
│ ├── README.md
│ ├── requirements.txt
│ └── watermark.py
├── Instagram_profile
│ ├── InstgramProfile.py
│ ├── Readme.md
│ ├── main.py
│ ├── output.png
│ ├── profilepic.py
│ └── requirements.txt
├── Internet_connection_check
│ ├── README.md
│ ├── internet_connection_check.py
│ └── output.png
├── Language_translator
│ ├── README.md
│ ├── Shot.png
│ ├── requirements.txt
│ └── translator.py
├── Leap_Year_Checker
│ ├── README.md
│ └── leapyear.py
├── Merge_csv_files
│ ├── README.md
│ ├── merge_csv_files.py
│ └── requirements.txt
├── Merge_pdfs
│ ├── README.md
│ ├── merge_pdfs.py
│ ├── mergedPdf.pdf
│ ├── mergedPdf1.pdf
│ ├── requirements.txt
│ ├── samplePdf1.pdf
│ └── samplePdf2.pdf
├── Movie Information Scraper
│ ├── README.md
│ ├── Screenshot.png
│ ├── movieInfoScraper.py
│ └── requirements.txt
├── News_website_scraper
│ ├── README.md
│ ├── images
│ │ ├── README.md
│ │ ├── home.JPG
│ │ ├── nextpage.JPG
│ │ └── result.JPG
│ └── moneycontrol_scrapper.py
├── Number_guessing_game
│ ├── README.md
│ ├── image.png
│ └── main.py
├── Organized_download_folder_with_different_categories
│ ├── README.md
│ └── file-sortor.py
├── Py_carbon_clips
│ └── Readme.md
├── Python_auto_draw
│ ├── README.md
│ ├── pyautoguidemo.gif
│ └── python-auto-draw.py
├── Qr_code_generator
│ ├── README.md
│ ├── generate_qrcode.py
│ └── url_qrcode.png
├── Random_Wikipedia_Article
│ ├── README.md
│ ├── requirements.txt
│ └── wiki_random.py
├── Random_password_generator
│ ├── README.md
│ ├── python-password-generator.py
│ └── random_password_gen.py
├── Random_word_from_list
│ ├── README.md
│ ├── Random_word_from_list.py
│ └── file.txt
├── Recursive_password_generator
│ ├── README.md
│ ├── Screenshot.png
│ └── generator.py
├── Reduce_image_file_size
│ ├── README.md
│ ├── input.jpg
│ ├── reduce_image_size.py
│ └── resized_output_image.jpg
├── RockPaperScissors_Game
│ ├── README.md
│ └── Rock_Paper_Scissors_Game.py
├── Scrape_Hacker_News
│ ├── README.md
│ └── main.py
├── Scrape_quotes
│ ├── README.md
│ ├── Screenshot.png
│ ├── quote_scraper.py
│ └── requirements.txt
├── Scraping Medium Articles
│ ├── README.md
│ ├── requirements.txt
│ ├── scraped_articles
│ │ ├── One_month_into_the_MLH_Fellowship.txt
│ │ ├── One_stop_guide_to_Google_Summer_of_Code.txt
│ │ └── The_Pros_and_Cons_of_Open_Source_Software.txt
│ └── scraping_medium.py
├── Send_email_from_csv
│ ├── Readme.md
│ ├── Sending_mail.py
│ ├── credentials.txt
│ └── emails.csv
├── Set_Alarm
│ ├── README.md
│ ├── alarm.py
│ └── musics
│ │ ├── Carnival.ogg
│ │ ├── Crusade.ogg
│ │ ├── Renaissance.ogg
│ │ ├── Variations.ogg
│ │ ├── dreamy_nights.ogg
│ │ ├── lakhau_hajarau.mp3
│ │ ├── morning_calm.ogg
│ │ ├── mozart_wakes.ogg
│ │ ├── new_horizon.ogg
│ │ └── the_four_seasons.ogg
├── Shutdown_or_restart_your_device
│ ├── PowerOptions.py
│ └── README.md
├── Snapshot_of_given_website
│ ├── README.md
│ ├── requirements.txt
│ └── snapshot_of_given_website.py
├── Speech_to_text
│ ├── README.md
│ ├── requirements.txt
│ └── speech_to_text.py
├── Spell_checker
│ ├── README.md
│ └── spell_checker.py
├── Split_File
│ ├── README.md
│ ├── requirements.txt
│ └── split_files.py
├── Split_a_video_file_by_given_time_period
│ ├── README.md
│ ├── requirements.txt
│ └── videosplitter.py
├── Split_folder_into_subfolders
│ ├── Readme.md
│ └── split_and_copy.py
├── Store_emails_in_csv
│ ├── README.md
│ ├── credentials.txt
│ ├── mails.csv
│ ├── requirements.txt
│ └── store_emails.py
├── String_search_from_multiple_files
│ ├── README.md
│ ├── files
│ │ ├── file1.txt
│ │ ├── file2.txt
│ │ ├── file3.txt
│ │ └── folder1
│ │ │ ├── hello.txt
│ │ │ └── python.txt
│ └── findstring.py
├── Terminal_Based_Hangman_Game
│ ├── README.md
│ ├── hangman.py
│ └── words.json
├── Terminal_progress_bar_with_images_resizing
│ ├── Readme.md
│ ├── progress_bar_ with_images_resizing.py
│ └── requirements.txt
├── Text_to_speech
│ ├── README.md
│ ├── abc.txt
│ ├── requirements.txt
│ ├── txtToSpeech.py
│ └── voice.mp3
├── Textfile_analysis
│ ├── README.md
│ └── textfile_analysis.py
├── Tic_tac_toe
│ ├── README.md
│ └── tic_tac_toe.py
├── Tic_tac_toe_with_ai
│ ├── .replit
│ ├── README.md
│ ├── tic-tac-toe-AI.py
│ └── tic_tac_toe.png
├── Time_to_load_website
│ ├── README.md
│ ├── sample.PNG
│ └── time_to_load_website.py
├── Todo_app
│ ├── Readme.md
│ ├── app.py
│ ├── requirements.txt
│ ├── static
│ │ └── css
│ │ │ └── style.css
│ ├── templates
│ │ ├── base.html
│ │ └── index.html
│ └── test.db
├── Unique_words_in_a_file
│ ├── README.md
│ ├── text_file.txt
│ └── unique.py
├── Unstructured Supplemenrary Service Data
│ ├── README.md
│ ├── Screenshot_20200910-134857.png
│ └── ussdtim.py
├── Web_page_summation
│ ├── .gitignore
│ ├── README.md
│ ├── app.py
│ ├── requirements.txt
│ └── utils
│ │ ├── __init__.py
│ │ ├── comparison.py
│ │ ├── model.py
│ │ ├── prepare.py
│ │ ├── summarize.py
│ │ ├── test.py
│ │ ├── train.py
│ │ └── utils.py
├── Web_scraping_a_youtube_comment
│ ├── README.md
│ ├── demo.gif
│ ├── requirements.txt
│ └── webscrapindcomment.py
├── Website_blocker
│ ├── README.md
│ ├── website_blocker.py
│ └── website_unblocker.py
├── Wikipedia_search_wordcloud
│ ├── README.md
│ ├── requirements.txt
│ ├── script_execution.jpg
│ ├── wiki-search-cloud.py
│ └── wordcloud.png
├── WishList
│ └── README.md
├── Write_a_script_to_download_a_random_image_from_unsplash_and_set_it_as_wallpaper
│ ├── README.md
│ ├── background_linux.py
│ └── background_windows.py
├── Write_script_to_compress_folder_and_files
│ ├── README.md
│ └── zipfiles.py
├── Write_script_to_move_files_into_alphabetically_ordered_folder
│ ├── README.md
│ └── main.py
├── XKCD_downloader
│ ├── README.md
│ ├── requirements.txt
│ └── xkcd_dowloader.py
├── capture_screenshot
│ ├── README.md
│ ├── requirements.txt
│ └── screenshot.py
├── cli_proxy_tester
│ ├── .gitignore
│ ├── README.md
│ ├── cli.py
│ ├── ipinfo
│ │ └── index.php
│ ├── proxytest.py
│ └── requirements.txt
├── convert pdf to text
│ ├── README.md
│ ├── converter1.py
│ ├── output.txt
│ ├── samplePdf1.pdf
│ └── temp
│ │ └── samplePdf1.txt
├── convert_Imgs
│ ├── JPGtoPNG.py
│ ├── PNGtoJPG.py
│ ├── README.md
│ ├── convertDynamic.py
│ ├── naruto_first.jpg
│ ├── naruto_first.png
│ ├── naruto_last.jpg
│ ├── naruto_last.png
│ └── requirements.txt
├── convert_dictionary_to_python_object
│ ├── README.md
│ └── conversion.py
├── convert_png_images_to_ico_format
│ ├── README.md
│ ├── convert.py
│ ├── convertUI.py
│ ├── input.png
│ ├── output.ico
│ └── requirements.txt
├── download GeeksForGeeks articles
│ ├── downloader.py
│ ├── readme.md
│ ├── requirements.txt
│ └── screenshot.jpg
└── racing_barchart_animation
│ ├── README.md
│ ├── animated_barchart.ipynb
│ ├── images
│ └── deceased.gif
│ └── requirements.txt
└── requirementsALL.txt
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | # Description
2 |
3 |
4 |
5 | ## Type of issue
6 |
7 | - [ ] Feature (New Script)
8 | - [ ] Bug
9 | - [ ] Documentation
10 |
11 | ## Checklist:
12 |
13 | - [ ] I have read the project guidelines.
14 | - [ ] I have checked all the existing projects, before submitting a new project issue.
15 | - [ ] I have checked previous issues to avoid duplicates.
16 | - [ ] This issue will be meaningful for the project.
17 |
18 |
19 |
20 |
21 |
26 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | # Description
2 |
3 | A short summary of what is included in your Pull Request.
4 |
5 | Fixes #(issue_no)
6 |
7 | Replace `issue_no` in the above line, with the issue related to this PR.
8 |
9 | ## Type of change
10 |
11 | Choosing one or more options from the following as per the nature of your Pull request.
12 |
13 | - [ ] Bug fix (non-breaking change which fixes an issue)
14 | - [ ] New feature (non-breaking change which adds functionality)
15 | - [ ] Documentation Update
16 |
17 | # Checklist:
18 | Please tick all the boxes that are fulfilled by your Pull Request.
19 |
20 | - [ ] I have named my files and folder, according to this project's guidelines.
21 | - [ ] My code follows the style guidelines of this project.
22 | - [ ] My Pull Request has a descriptive title. (not a vague title like `Update index.md`)
23 | - [ ] I have commented on my code, particularly in hard-to-understand areas.
24 | - [ ] I have created a helpful and easy to understand `README.md`, according to the given [`README_TEMPLATE.`](https://github.com/chavarera/python-mini-projects/blob/master/README_TEMPLATE.md)
25 | - [ ] I have included a requirements.txt file (if external libraries are required.)
26 | - [ ] My changes do not produce any warnings.
27 | - [ ] I have added a working sample/screenshot of the script.
28 |
--------------------------------------------------------------------------------
/.github/workflows/blank.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to help you get started with Actions
2 |
3 | name: CI
4 |
5 | # Controls when the action will run. Triggers the workflow on push or pull request
6 | # events but only for the master branch
7 | on:
8 | push:
9 | branches: [ master ]
10 | pull_request:
11 | branches: [ master ]
12 |
13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
14 | jobs:
15 | # This workflow contains a single job called "build"
16 | build:
17 | # The type of runner that the job will run on
18 | runs-on: ubuntu-latest
19 |
20 | # Steps represent a sequence of tasks that will be executed as part of the job
21 | steps:
22 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23 | - uses: actions/checkout@v2
24 |
25 | # Runs a single command using the runners shell
26 | - name: Run a one-line script
27 | run: echo Hello, world!
28 |
29 | # Runs a set of commands using the runners shell
30 | - name: Run a multi-line script
31 | run: |
32 | echo Add other actions to build,
33 | echo test, and deploy your project.
34 |
35 |
--------------------------------------------------------------------------------
/.github/workflows/issue.yml:
--------------------------------------------------------------------------------
1 | on:
2 | issues:
3 | types: [opened]
4 | name: Issues
5 | jobs:
6 | assignAuthor:
7 | name: Assign author to issue
8 | runs-on: ubuntu-latest
9 | steps:
10 | - name: Assign author to issue
11 | uses: technote-space/assign-author@v1
12 |
--------------------------------------------------------------------------------
/.github/workflows/python-app.yml:
--------------------------------------------------------------------------------
1 | # This workflow will install Python dependencies, run tests and lint with a single version of Python
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3 |
4 | name: Python application
5 |
6 | on:
7 | push:
8 | branches: [ master ]
9 | pull_request:
10 | branches: [ master ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v2
19 | - name: Set up Python 3.8
20 | uses: actions/setup-python@v2
21 | with:
22 | python-version: 3.8
23 | - name: Install dependencies
24 | run: |
25 | python -m pip install --upgrade pip
26 | pip install flake8
27 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28 | - name: Lint with flake8
29 | run: |
30 | # stop the build if there are Python syntax errors or undefined names
31 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
32 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
33 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34 |
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Ravishankar Chavare
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 |
--------------------------------------------------------------------------------
/Notebooks/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/README_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | # Script Title
2 |
3 | A short description about the script must be mentioned here.
4 |
5 | ### Prerequisites
6 |
7 | Modules required to be able to use the script successfully and how to install them. (Including a requirements.txt file will work.)
8 |
9 | ### How to run the script
10 |
11 | Steps on how to run the script along with suitable examples.
12 |
13 | ### Screenshot/GIF showing the sample use of the script
14 |
15 | Add a jpeg/png/gif file here.
16 |
17 | ## *Author Name*
18 |
19 | Your name goes here.
20 |
--------------------------------------------------------------------------------
/docs/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/docs/.nojekyll
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Python Project Collection
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/projects/All_links_from_given_webpage/README.md:
--------------------------------------------------------------------------------
1 | # All Links from given Webpage
2 |
3 | This script retrieves all links from a given Webpage and saves them as a tct file
4 |
5 | ### Prerequisites
6 | Required Modules
7 | - BeautifulSoup4
8 | - requests
9 |
10 | to install:
11 | ```
12 | $ pip install -r requirements.txt
13 | ```
14 |
15 | ### How to run the script
16 | ``` bash
17 | $ python get_links.py
18 | ```
19 | You will then be asked which webpage you would like to analyze.
20 | After that the extracted links will be saved as an array in `myLinks.txt`.
21 |
22 |
23 | ## *Author Name*
24 | Kai Reichart
25 |
--------------------------------------------------------------------------------
/projects/All_links_from_given_webpage/get_links.py:
--------------------------------------------------------------------------------
1 | import requests as rq
2 | from bs4 import BeautifulSoup
3 |
4 | url = input("Enter Link: ")
5 | if ("https" or "http") in url:
6 | data = rq.get(url)
7 | else:
8 | data = rq.get("https://" + url)
9 | soup = BeautifulSoup(data.text, "html.parser")
10 | links = []
11 | for link in soup.find_all("a"):
12 | links.append(link.get("href"))
13 |
14 | # Writing the output to a file (myLinks.txt) instead of to stdout
15 | # You can change 'a' to 'w' to overwrite the file each time
16 | with open("myLinks.txt", 'a') as saved:
17 | print(links[:10], file=saved)
18 |
--------------------------------------------------------------------------------
/projects/All_links_from_given_webpage/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4==4.9.2
2 | requests==2.24.0
3 |
--------------------------------------------------------------------------------
/projects/Ascii_art/README.md:
--------------------------------------------------------------------------------
1 | # ascii-art
2 |
3 | ## Description
4 | This Project will take an image and print out an [ASCII-art](https://en.wikipedia.org/wiki/ASCII_art).
5 |
6 | ## About this Project
7 | This project uses [opencv](https://www.opencv.org) to process image and [numpy](https://numpy.org) to manipulate arrays. The Image is numerically coded for different threshold regions it comes under and for each coded regions , a symbol is used for printing it out in the stdout.
8 |
9 | ## Usage
10 | Use the Script [make_art.py](https://github.com/Shiny-Akash/python-mini-projects/blob/ascii-art/projects/asciiart/make_art.py) .
11 | In the command line, Enter
12 |
13 | `python3 make_art.py [image_path]`
14 |
15 | Replace the `[image_path]` with the image you want to do ascii-art. By default it takes [sample_image.png](https://github.com/Shiny-Akash/python-mini-projects/blob/ascii-art/projects/asciiart/sample_image.png)
16 |
17 | ## Customization
18 | There are two things you can customize in [make_art.py](https://github.com/Shiny-Akash/python-mini-projects/blob/ascii-art/projects/asciiart/make_art.py).
19 |
20 | * `symbols_list`
21 | * `threshold_list`
22 |
23 | Modify the threshold list to take **different threshold values** thereby changing the patterns in the printed image.
24 | Modify the symbols list to substitute **different symbols** in the coded patterns.
25 |
26 | ## Sample
27 | Input Image :
28 | 
29 | Output :
30 | 
--------------------------------------------------------------------------------
/projects/Ascii_art/make_art.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import cv2
4 | import numpy as np
5 |
6 | import sys
7 |
8 | symbols_list = ["#", "-", "*", ".", "+", "o"]
9 | threshold_list = [0, 50, 100, 150, 200]
10 |
11 | def print_out_ascii(array):
12 | """prints the coded image with symbols"""
13 |
14 | for row in array:
15 | for e in row:
16 | # select symbol based on the type of coding
17 | print(symbols_list[int(e) % len(symbols_list)], end="")
18 | print()
19 |
20 |
21 | def img_to_ascii(image):
22 | """returns the numeric coded image"""
23 |
24 | # resizing parameters
25 | # adjust these parameters if the output doesn't fit to the screen
26 | height, width = image.shape
27 | new_width = int(width / 20)
28 | new_height = int(height / 40)
29 |
30 | # resize image to fit the printing screen
31 | resized_image = cv2.resize(image, (new_width, new_height),)
32 |
33 | thresh_image = np.zeros(resized_image.shape)
34 |
35 | for i, threshold in enumerate(threshold_list):
36 | # assign corresponding values according to the index of threshold applied
37 | thresh_image[resized_image > threshold] = i
38 | return thresh_image
39 |
40 |
41 | if __name__ == "__main__":
42 |
43 | if len(sys.argv) < 2:
44 | print("Image Path not specified : Using sample_image.png\n")
45 | image_path = "sample_image.png" # default image path
46 |
47 | if len(sys.argv) == 2:
48 | print("Using {} as Image Path\n".format(sys.argv[1]))
49 | image_path = sys.argv[1]
50 |
51 | image = cv2.imread(image_path, 0) # read image
52 |
53 | ascii_art = img_to_ascii(image)
54 | print_out_ascii(ascii_art)
55 |
--------------------------------------------------------------------------------
/projects/Ascii_art/requirements.txt:
--------------------------------------------------------------------------------
1 | opencv-python==4.3.0.36
2 | numpy==1.19.1
3 |
--------------------------------------------------------------------------------
/projects/Ascii_art/sample_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Ascii_art/sample_image.png
--------------------------------------------------------------------------------
/projects/Ascii_art/sample_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Ascii_art/sample_output.png
--------------------------------------------------------------------------------
/projects/Battery_notification/README.md:
--------------------------------------------------------------------------------
1 | # Battery Notificator
2 |
3 | This python script gives you a notification about your battery percentage of the device.
4 |
5 | ## Pre-requisites:
6 |
7 | You will need to install python on your machine. You can download python from the python.org and install it.
8 | And a few other python package that you need to install are as:
9 |
10 | 1. psutil
11 | > pip install psutil
12 |
13 | 2. pynotifier
14 | > pip install py-notifier
15 |
16 | 3. win10toast
17 | > pip install win10toast
18 |
19 | ## How to run the Script:
20 | python battery.py
21 |
22 | ## Authon Name:
23 | Bharat Gupta
24 |
--------------------------------------------------------------------------------
/projects/Battery_notification/battery.py:
--------------------------------------------------------------------------------
1 | # pip install psutil
2 | import psutil
3 |
4 | battery = psutil.sensors_battery()
5 | plugged = battery.power_plugged
6 | percent = battery.percent
7 |
8 | if percent >= 30:
9 |
10 | # pip install py-notifier
11 | # pip install win10toast
12 | from pynotifier import Notification
13 |
14 | Notification(
15 | title="Battery Low",
16 | description=str(percent) + "% Battery remain!!",
17 | duration=5, # Duration in seconds
18 | urgency=Notification.URGENCY_CRITICAL,
19 | ).send()
20 |
--------------------------------------------------------------------------------
/projects/Battery_notification/requirements.txt:
--------------------------------------------------------------------------------
1 | psutil==5.7.2
2 | py-notifier==0.1
3 | win10toast==0.9
4 |
--------------------------------------------------------------------------------
/projects/Calculate_age/README.md:
--------------------------------------------------------------------------------
1 | # Calculate Your Age!
2 |
3 | This script prints your age in three different ways :
4 | 1. Years
5 | 2. Months
6 | 3. Days
7 |
8 |
9 | ## Prerequisites
10 |
11 | You only need Python to run this script. You can visit [here](https://www.python.org/downloads/) to download Python.
12 |
13 |
14 | ## How to run the script
15 |
16 | Running the script is really simple! Just open a terminal in the folder where your script is located and run the following command :
17 |
18 | `python calculate.py`
19 |
20 |
21 | ## Sample use of the script
22 |
23 | ```
24 | $ python calculate.py
25 | input your name: XYZ
26 | input your age: 33
27 | XYZ's age is 33 years or 406 months or 12328 days
28 | ```
29 |
30 | ## *Author Name*
31 |
32 | random1001guy
33 |
--------------------------------------------------------------------------------
/projects/Calculate_age/calculate.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import time
3 | from calendar import isleap
4 |
5 | # judge the leap year
6 | def judge_leap_year(year):
7 | if isleap(year):
8 | return True
9 | else:
10 | return False
11 |
12 |
13 | # returns the number of days in each month
14 | def month_days(month, leap_year):
15 | if month == 1 or month == 3 or month == 5 or month == 7:
16 | return 31
17 | elif month == 8 or month == 10 or month == 12:
18 | return 31
19 | elif month == 4 or month == 6 or month == 9 or month == 11:
20 | return 30
21 | elif month == 2 and leap_year:
22 | return 29
23 | elif month == 2 and (not leap_year):
24 | return 28
25 |
26 |
27 | name = input("input your name: ")
28 | age = input("input your age: ")
29 | localtime = time.localtime(time.time())
30 |
31 | year = int(age)
32 | month = year * 12 + localtime.tm_mon
33 | day = 0
34 |
35 | begin_year = int(localtime.tm_year) - year
36 | end_year = begin_year + year
37 |
38 | # calculate the days
39 | for y in range(begin_year, end_year):
40 | if (judge_leap_year(y)):
41 | day = day + 366
42 | else:
43 | day = day + 365
44 |
45 | leap_year = judge_leap_year(localtime.tm_year)
46 | for m in range(1, localtime.tm_mon):
47 | day = day + month_days(m, leap_year)
48 |
49 | day = day + localtime.tm_mday
50 | print("%s's age is %d years or " % (name, year), end="")
51 | print("%d months or %d days" % (month, day))
52 |
--------------------------------------------------------------------------------
/projects/Capture_Video_Frames/README.md:
--------------------------------------------------------------------------------
1 | # Capture Video Frames
2 | ##### Execute
3 | `python capture_video_frames.py `
4 |
--------------------------------------------------------------------------------
/projects/Capture_Video_Frames/capture_video_frames.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shutil
3 | import sys
4 | import cv2
5 |
6 | class FrameCapture:
7 | '''
8 | Class definition to capture frames
9 | '''
10 | def __init__(self, file_path):
11 | '''
12 | initializing directory where the captured frames will be stored.
13 | Also truncating the directory where captured frames are stored, if exists.
14 | '''
15 | self.directory = "captured_frames"
16 | self.file_path = file_path
17 | if os.path.exists(self.directory):
18 | shutil.rmtree(self.directory)
19 | os.mkdir(self.directory)
20 |
21 | def capture_frames(self):
22 | '''
23 | This method captures the frames from the video file provided.
24 | This program makes use of openCV library
25 | '''
26 | cv2_object = cv2.VideoCapture(self.file_path)
27 |
28 | frame_number = 0
29 | frame_found = 1
30 |
31 | while frame_found:
32 | frame_found, image = cv2_object.read()
33 | capture = f'{self.directory}/frame{frame_number}.jpg'
34 | cv2.imwrite(capture, image)
35 |
36 | frame_number += 1
37 |
38 | if __name__ == '__main__':
39 | file_path = sys.argv[1]
40 | fc = FrameCapture(file_path)
41 | fc.capture_frames()
42 |
--------------------------------------------------------------------------------
/projects/Capture_Video_Frames/requirements.txt:
--------------------------------------------------------------------------------
1 | opencv-python==4.3.0.36
2 |
--------------------------------------------------------------------------------
/projects/Check_website_connectivity/README.md:
--------------------------------------------------------------------------------
1 | # Check Website Connectivity
2 |
3 | This directory contains a simple tool to check connectivity to a number of web sites.
4 |
5 | The input file `websites.txt` should contain web site URLs, one per line.
6 |
7 | The output file `website_status.csv` contains a two-column report with
8 | the URL of each checked site and its status.
9 | The script simply checks whether the web server returns a 200 status code.
10 |
11 | The output file will be overwritten each time you run the tool.
12 |
13 |
14 | ## Prerequisites
15 |
16 | This project uses the third-party library
17 | [requests](https://requests.readthedocs.io/)
18 | as well as the `csv` module from the Python standard library.
19 |
20 |
21 | ## How to run the Script
22 |
23 | To run this script, type
24 |
25 | ```
26 | python check_connectivity.py
27 | ```
28 | in the directory where you have checked out these files.
29 | (If you have an IDE which lets you run Python files,
30 | and prefer to use that instead,
31 | make sure you configure it to set the working directory to
32 | the one which contains the input file.)
33 |
34 |
35 | ## Development ideas
36 |
37 | The CSV should perhaps contain a date stamp, too.
38 |
39 | Perhaps add the `logging` library and optionally print progress information.
40 |
--------------------------------------------------------------------------------
/projects/Check_website_connectivity/check_connectivity.py:
--------------------------------------------------------------------------------
1 | import csv
2 |
3 | import requests
4 |
5 |
6 | status_dict = {"Website": "Status"}
7 |
8 |
9 | def main():
10 | with open("websites.txt", "r") as fr:
11 | for line in fr:
12 | website = line.strip()
13 | status = requests.get(website).status_code
14 | status_dict[website] = "working" if status == 200 \
15 | else "not working"
16 |
17 | # print(status_dict)
18 | with open("website_status.csv", "w", newline="") as fw:
19 | csv_writers = csv.writer(fw)
20 | for key in status_dict.keys():
21 | csv_writers.writerow([key, status_dict[key]])
22 |
23 |
24 | if __name__ == "__main__":
25 | main()
26 |
--------------------------------------------------------------------------------
/projects/Check_website_connectivity/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 |
--------------------------------------------------------------------------------
/projects/Check_website_connectivity/website_status.csv:
--------------------------------------------------------------------------------
1 | Website,Status
2 | http://web.hike.com/,working
3 | https://github.com/chavarera/python-mini-projects/issues/96,working
4 | https://www.youtube.com/,working
5 | https://dillinger.io/,working
6 | https://pypi.org/,working
7 |
--------------------------------------------------------------------------------
/projects/Check_website_connectivity/websites.txt:
--------------------------------------------------------------------------------
1 | http://web.hike.com/
2 | https://github.com/chavarera/python-mini-projects/issues/96
3 | https://www.youtube.com/
4 | https://dillinger.io/
5 | https://pypi.org/
--------------------------------------------------------------------------------
/projects/Cli_todo/README.md:
--------------------------------------------------------------------------------
1 | # Simple CLI Todo App
2 | Simple Todo app with command line interface. Supports adding, deleting, and viewing task entries.
3 |
4 | ## Dependencies
5 | Requires Python 3 and Click
6 |
7 | Install Click: `pip install click`
8 |
9 | ## How to use
10 | ### Running
11 | either run it from your code editor or Ide or type `python todo.py [command]` in your command line.
12 | (insted of [command] add desired command u want)
13 |
14 | ### Commands
15 | |Command | Description|
16 | |-------|-------|
17 | |`add`| Adds a task. Prompts user for task text. |
18 | |`done`| Deletes a task. Prompts user for task id. |
19 | |`tasks`| Displays all inputted tasks. |
20 |
--------------------------------------------------------------------------------
/projects/Cli_todo/requirements.txt:
--------------------------------------------------------------------------------
1 | click==7.1.2
2 |
--------------------------------------------------------------------------------
/projects/Cli_todo/todo.txt:
--------------------------------------------------------------------------------
1 | 0
2 |
--------------------------------------------------------------------------------
/projects/Convert_JPEG_to_PNG/README.md:
--------------------------------------------------------------------------------
1 | # CONVERT_JPEG_to_PNG
2 |
3 | This project contains a simply python script to change file extension from .jpeg to .png
4 |
5 | ## Requirements
6 | Pillow module
7 |
8 | `pip install pillow`
9 |
10 | ## Two methods:
11 |
12 | I accomplished this task in two ways
13 | ### Using Terminal
14 | - Add the image in jpeg format with name as 'input' in this folder.
15 | - Run converter_terminal.py script
16 | - output image will be generated in this folder
17 |
18 | ### Using GUI
19 | Just run the converter_GUI.py script and pick any jpeg image from any location and then press 'Convert Jpeg to Png'
20 |
21 |
22 |
--------------------------------------------------------------------------------
/projects/Convert_JPEG_to_PNG/converter_GUI.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 | from tkinter import filedialog, messagebox
3 | from PIL import Image
4 | root = tk.Tk() # Tkinter window initialized
5 | root.title('Converter') # Title of the window
6 | canvas1 = tk.Canvas(root, width=300, height=250, bg='orange', relief='raised')
7 | canvas1.pack()
8 | label1 = tk.Label(root, text='File Converter', bg='lightsteelblue2') # giving a title to the screen
9 | label1.config(font=('helvetica', 20))
10 | canvas1.create_window(150, 60, window=label1)
11 | im1 = None # variable to store path of image
12 |
13 |
14 | def getJPG():
15 | '''Function to get image location and open it with pillow'''
16 | global im1
17 | import_file_path = filedialog.askopenfilename()
18 | im1 = Image.open(import_file_path)
19 |
20 |
21 | font = ('helvetica', 12, 'bold')
22 | bg = 'royalblue'
23 | fg = 'white'
24 | browseButton_JPG = tk.Button(text=" Import JPEG File ", command=getJPG, bg=bg, fg=fg, font=font) # Browse button
25 | canvas1.create_window(150, 130, window=browseButton_JPG)
26 |
27 |
28 | def convertToPNG():
29 | '''Function to change file extenstion to png and save it to User's prefered location '''
30 | global im1
31 | if im1 is None:
32 | tk.messagebox.showerror("Error", "No File selected")
33 | else:
34 | export_file_path = filedialog.asksaveasfilename(defaultextension='.png')
35 | im1.save(export_file_path)
36 |
37 |
38 | saveAsButton_PNG = tk.Button(text='Convert JPEG to PNG', command=convertToPNG, bg=bg, fg=fg, font=font) # Convert button
39 | canvas1.create_window(150, 180, window=saveAsButton_PNG)
40 | root.mainloop()
41 |
--------------------------------------------------------------------------------
/projects/Convert_JPEG_to_PNG/converter_terminal.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | im1 = Image.open('input.jpeg') # takes input image from present folder
3 | im1.save('output.png') # output image is generated the folder
4 |
--------------------------------------------------------------------------------
/projects/Convert_JPEG_to_PNG/input.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Convert_JPEG_to_PNG/input.jpeg
--------------------------------------------------------------------------------
/projects/Convert_JPEG_to_PNG/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Convert_JPEG_to_PNG/output.png
--------------------------------------------------------------------------------
/projects/Convert_JSON_to_CSV/README.md:
--------------------------------------------------------------------------------
1 | # Convert a json file into a csv
2 | This script take a json file as input and generate a csv file in output.
3 |
4 | ### Prerequisites modules
5 | * json
6 | * Run `pip install json` to install required external modules.
7 |
8 | ### How to run the script
9 | - Execute `python3 converter.py`
10 |
--------------------------------------------------------------------------------
/projects/Convert_JSON_to_CSV/converter.py:
--------------------------------------------------------------------------------
1 | import json
2 |
3 | if __name__ == '__main__':
4 | try:
5 | with open('input.json', 'r') as f:
6 | data = json.loads(f.read())
7 |
8 | output = ','.join([*data[0]])
9 | for obj in data:
10 | output += f'\n{obj["Name"]},{obj["age"]},{obj["birthyear"]}'
11 |
12 | with open('output.csv', 'w') as f:
13 | f.write(output)
14 | except Exception as ex:
15 | print(f'Error: {str(ex)}')
16 |
--------------------------------------------------------------------------------
/projects/Convert_JSON_to_CSV/input.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Name": "Akash",
4 | "age": 26,
5 | "birthyear": "1994"
6 | },
7 | {
8 | "Name": "Abhay",
9 | "age": 34,
10 | "birthyear": "1986"
11 | }
12 | ]
--------------------------------------------------------------------------------
/projects/Convert_JSON_to_CSV/output.csv:
--------------------------------------------------------------------------------
1 | Name,age,birthyear
2 | Akash,26,1994
3 | Abhay,34,1986
--------------------------------------------------------------------------------
/projects/Convert_XML_To_JSON/README.md:
--------------------------------------------------------------------------------
1 | # Converter
2 |
3 | Convert XML to JSON
4 |
5 | ### prerequisite
6 | - you need to install below library using pip
7 | - $ pip install xmltodict
8 |
9 | ### Description
10 | - It coverts any input.xml file into output.json.
11 |
12 | ### How to run the script
13 |
14 | - First rename your file to input.xml
15 | - Execute `python3 converter.py`
16 | - The Output will be shown below as output.json
17 |
18 | ## *Author Name*
19 | Azhad Ghufran
20 |
--------------------------------------------------------------------------------
/projects/Convert_XML_To_JSON/converter.py:
--------------------------------------------------------------------------------
1 | import json
2 | import xmltodict
3 |
4 | with open('input.xml') as xml_file:
5 | parsed_data = xmltodict.parse(xml_file.read())
6 |
7 | xml_file.close()
8 |
9 | json_conversion = json.dumps(parsed_data)
10 |
11 | with open('output.json', 'w') as json_file:
12 | json_file.write(json_conversion)
13 |
14 | json_file.close()
15 |
--------------------------------------------------------------------------------
/projects/Convert_XML_To_JSON/requirements.txt:
--------------------------------------------------------------------------------
1 | xmltodict==0.12.0
2 |
--------------------------------------------------------------------------------
/projects/Convert_a_image_to_pdf/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Convert an Image to PDF
3 |
4 | The Python script enables the user to convert Images into PDF files. However, you must note that the script can only work well for JPG file formats. You can use the converter for revamping JPG images into PDF format.
5 |
6 | ### Requirements
7 |
8 | **img2pdf module**
9 |
10 | The `img2pdf` is an external Python module which enables you to convert a JPG image into a PDF.
11 |
12 | pip install img2pdf
13 |
14 | ### How to run the script
15 |
16 | ### Using Terminal
17 |
18 | - Add the image in the JPG format with name as 'input' in this folder.
19 | - Run converter_terminal.py script
20 | - Output PDF file will be generated in this folder
21 |
22 |
23 | ### Screenshot/GIF showing the sample use of the script
24 |
25 |
26 | 
27 |
28 | ## *Author Name*
29 |
30 | Devansh Agarwal
31 |
--------------------------------------------------------------------------------
/projects/Convert_a_image_to_pdf/convert_image_to_pdf.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import img2pdf
3 | import os
4 |
5 | filepath = sys.argv[1]
6 | if os.path.isdir(filepath):
7 | with open("output.pdf", "wb") as f:
8 | imgs = []
9 | for fname in os.listdir(filepath):
10 | if not fname.endswith(".jpg"):
11 | continue
12 | path = os.path.join(filepath, fname)
13 | if os.path.isdir(path):
14 | continue
15 | imgs.append(path)
16 | f.write(img2pdf.convert(imgs))
17 | elif os.path.isfile(filepath):
18 | if filepath.endswith(".jpg"):
19 | with open("output.pdf", "wb") as f:
20 | f.write(img2pdf.convert(filepath))
21 | else:
22 | print("please input file or dir")
23 |
24 |
--------------------------------------------------------------------------------
/projects/Convert_a_image_to_pdf/requirements.txt:
--------------------------------------------------------------------------------
1 | img2pdf==0.4.0
--------------------------------------------------------------------------------
/projects/Convert_numbers_to_word/README.md:
--------------------------------------------------------------------------------
1 | # Convert Numbers To Words
2 |
3 | Convert a number to the written word form
4 |
5 | ### Prerequisites
6 |
7 | None
8 |
9 | ### How to run the script
10 |
11 | Execute `python3 converter.py`
12 |
13 | ## Screenshot/GIF showing the sample use of the script
14 |
15 | 
16 |
17 | ## *Author Name*
18 |
19 | Niraj Shrestha
20 |
--------------------------------------------------------------------------------
/projects/Convert_numbers_to_word/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Convert_numbers_to_word/Screenshot.png
--------------------------------------------------------------------------------
/projects/Create_a_script_to_encrypt_files_and_folder/README.md:
--------------------------------------------------------------------------------
1 | ## create script to encrypt files and folder
2 |
3 | ### usage
4 |
5 | python encrypt.py path(file or folder)
6 |
7 | examples:
8 | python encrypt.py test.txt(file)
9 | or
10 | python eccrypt.py ./testdir(folder)
11 |
12 | encrypted files("original_file_name.bin") will be generated in original location after the program running
--------------------------------------------------------------------------------
/projects/Create_a_script_to_encrypt_files_and_folder/encrypt.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | from Cryptodome.Cipher import AES
4 | from Cryptodome import Random
5 | from binascii import b2a_hex
6 |
7 |
8 | def encrypt_dir(path):
9 | for root, _, files in os.walk("."):
10 | for file in files:
11 | file_path = os.path.join(root, file)
12 | print(file_path + " is encrypting.")
13 | encrypt_file(file_path)
14 |
15 |
16 | def encrypt_file(path):
17 | # get the plaintext
18 | with open(path) as f:
19 | plain_text = f.read()
20 |
21 | # The key length must be 16 (AES-128), 24 (AES-192), or 32 (AES-256) Bytes.
22 | key = b'this is a 16 key'
23 |
24 | iv = Random.new().read(AES.block_size)
25 | mycipher = AES.new(key, AES.MODE_CFB, iv)
26 | ciphertext = iv + mycipher.encrypt(plain_text.encode())
27 |
28 | # output
29 | with open(path + ".bin", "wb") as file_out:
30 | file_out.write(ciphertext[16:])
31 |
32 |
33 | path = sys.argv[1]
34 | if os.path.isdir(path) and os.path.exists(path):
35 | encrypt_dir(path)
36 | elif os.path.isfile(path) and os.path.exists(path):
37 | encrypt_file(path)
38 | else:
39 | print("it's a special file(socket,FIFO,device file)")
40 |
--------------------------------------------------------------------------------
/projects/Create_a_script_to_encrypt_files_and_folder/requirements.txt:
--------------------------------------------------------------------------------
1 | pycryptodome==3.9.8
2 |
--------------------------------------------------------------------------------
/projects/Create_a_simple_stopwatch/README.md:
--------------------------------------------------------------------------------
1 | ## create a simple stopwatch
2 |
3 | ### usage
4 |
5 | python stopwatch.py
--------------------------------------------------------------------------------
/projects/Create_calculator_app/README.md:
--------------------------------------------------------------------------------
1 | # Script Title
2 |
3 | A small python program that creates a calculator app
4 |
5 | ### Prerequisites
6 |
7 | Python 3
8 |
9 | ### How to run the script
10 |
11 | > python calculator.py
12 |
13 | ### Screenshot/GIF showing the sample use of the script
14 |
15 | 
16 |
17 |
18 | ## *Author Name*
19 |
20 | [Fin McCallum](https://github.com/FinMc)
21 |
--------------------------------------------------------------------------------
/projects/Create_calculator_app/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Create_calculator_app/output.png
--------------------------------------------------------------------------------
/projects/Currency_converter/README.md:
--------------------------------------------------------------------------------
1 | # Script Title
2 |
3 | A small python program that converts currency with live info
4 |
5 | ### Prerequisites
6 |
7 | - requests
8 | - Python 3
9 |
10 | ### How to run the script
11 |
12 | > python cc.py
13 |
14 | ### Screenshot/GIF showing the sample use of the script
15 |
16 | 
17 |
18 | ## *Author Name*
19 |
20 | [Fin McCallum](https://github.com/FinMc)
21 |
--------------------------------------------------------------------------------
/projects/Currency_converter/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Currency_converter/output.png
--------------------------------------------------------------------------------
/projects/Decimal_to_binary_convertor_and_vice_versa/README.md:
--------------------------------------------------------------------------------
1 | # Script Title
2 |
3 | A small python program that converts binary and decimal
4 |
5 | ### Prerequisites
6 |
7 | - Python 3
8 |
9 | ### How to run the script
10 |
11 | > python decimal_to_binary.py
12 |
13 | ### Screenshot/GIF showing the sample use of the script
14 |
15 | 
16 |
17 | ## *Author Name*
18 |
19 | [Fin McCallum](https://github.com/FinMc)
20 |
--------------------------------------------------------------------------------
/projects/Decimal_to_binary_convertor_and_vice_versa/decimal_to_binary.py:
--------------------------------------------------------------------------------
1 | try:
2 | menu = int(input("Choose an option: \n 1. Decimal to binary \n 2. Binary to decimal\n Option: "))
3 | if menu < 1 or menu > 2:
4 | raise ValueError
5 | if menu == 1:
6 | dec = int(input("Input your decimal number:\nDecimal: "))
7 | print("Binary: {}".format(bin(dec)[2:]))
8 | elif menu == 2:
9 | binary = input("Input your binary number:\n Binary: ")
10 | print("Decimal: {}".format(int(binary, 2)))
11 | except ValueError:
12 | print ("please choose a valid option")
13 |
--------------------------------------------------------------------------------
/projects/Decimal_to_binary_convertor_and_vice_versa/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Decimal_to_binary_convertor_and_vice_versa/output.png
--------------------------------------------------------------------------------
/projects/Digital_clock/Digital Clock.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Digital_clock/Digital Clock.PNG
--------------------------------------------------------------------------------
/projects/Digital_clock/README.md:
--------------------------------------------------------------------------------
1 | # Digital Clock using Python and Tkinter
2 | This script create a digital clock as per the system's current time.
3 |
4 | ## Library Used
5 | * tkinter
6 | * time
7 |
8 | ### To install required external modules
9 | * Run `pip install tkinter`
10 |
11 | ### How to run the script
12 | - Execute `python3 digital_clock.py`
13 |
14 | ### Screenshot/GIF showing the sample use of the script
15 |
16 | 
17 |
--------------------------------------------------------------------------------
/projects/Digital_clock/digital_clock.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 | from time import strftime
3 |
4 |
5 | def light_theme():
6 | frame = tk.Frame(root, bg="white")
7 | frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8)
8 | lbl_1 = tk.Label(frame, font=('calibri', 40, 'bold'),
9 | background='White', foreground='black')
10 | lbl_1.pack(anchor="s")
11 |
12 | def time():
13 | string = strftime('%I:%M:%S %p')
14 | lbl_1.config(text=string)
15 | lbl_1.after(1000, time)
16 | time()
17 |
18 |
19 | def dark_theme():
20 | frame = tk.Frame(root, bg="#22478a")
21 | frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8)
22 | lbl_2 = tk.Label(frame, font=('calibri', 40, 'bold'),
23 | background='#22478a', foreground='black')
24 | lbl_2.pack(anchor="s")
25 |
26 | def time():
27 | string = strftime('%I:%M:%S %p')
28 | lbl_2.config(text=string)
29 | lbl_2.after(1000, time)
30 | time()
31 |
32 |
33 | root = tk.Tk()
34 | root.title("Digital-Clock")
35 | canvas = tk.Canvas(root, height=140, width=400)
36 | canvas.pack()
37 |
38 | frame = tk.Frame(root, bg='#22478a')
39 | frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8)
40 | lbl = tk.Label(frame, font=('calibri', 40, 'bold'),
41 | background='#22478a', foreground='black')
42 | lbl.pack(anchor="s")
43 |
44 | def time():
45 | string = strftime('%I:%M:%S %p')
46 | lbl.config(text=string)
47 | lbl.after(1000, time)
48 | time()
49 |
50 | menubar = tk.Menu(root)
51 | theme_menu = tk.Menu(menubar, tearoff=0)
52 | theme_menu.add_command(label="Light", command=light_theme)
53 | theme_menu.add_command(label="Dark", command=dark_theme)
54 | menubar.add_cascade(label="Theme", menu=theme_menu)
55 | root.config(menu=menubar)
56 | root.mainloop()
57 |
--------------------------------------------------------------------------------
/projects/Dns_record/README.md:
--------------------------------------------------------------------------------
1 | ## DNS Record
2 |
3 | This script takes the website name as input and returns its dns records.
4 |
5 | #Requirements to run this file:
6 |
7 | External library called dnspython has been used here and it can be installed easily by using the following command:
8 |
9 | pip install -r requirements.txt
10 |
11 | #How to use this script?
12 |
13 | 1.Install the requirements.
14 |
15 | 2. Type the following command
16 |
17 | python dns_record.py
18 |
19 | 3.It will ask for a website:
20 |
21 | You can give any website name for example: google.com
--------------------------------------------------------------------------------
/projects/Dns_record/dns_record.py:
--------------------------------------------------------------------------------
1 | #Simple program to fetch dns record of a given website
2 |
3 | import json
4 | import dns.resolver
5 |
6 | #Dictionary to store the dns record of a website
7 | dns_record = {}
8 |
9 | #User defined website
10 | website = input("Enter the name of the website: ")
11 |
12 | #Fetching the 'A' record of the website and storing it in the dictionary
13 | a_record = dns.resolver.resolve(website, 'A')
14 | for ipval in a_record:
15 | dns_record['A_Record_IP'] = ipval.to_text()
16 |
17 | #List to store the mx records of a website
18 | mx_record_list = []
19 |
20 | #Fetching the mx records and storing them in the dictionary
21 | mx_record = dns.resolver.resolve(website,'MX')
22 | for server in mx_record:
23 | mx_record_list.append(server)
24 | for i, element in enumerate(mx_record_list):
25 | dns_record['MX_Record', i+1] = element
26 |
27 | #Displaying the record on the screen
28 | for key,value in dns_record.items():
29 | print(f"{key} = {value}")
30 |
31 |
--------------------------------------------------------------------------------
/projects/Dns_record/requirements.txt:
--------------------------------------------------------------------------------
1 | dnspython==2.0.0
--------------------------------------------------------------------------------
/projects/Dominant_color/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Dominant_color/README.md
--------------------------------------------------------------------------------
/projects/Dominant_color/find-color.py:
--------------------------------------------------------------------------------
1 | import cv2
2 | import numpy as np
3 |
4 | path = input("Enter Path :- ")
5 | try:
6 | img = cv2.imread(path)
7 | cv2.imshow("img", img)
8 | except Exception:
9 | print("Path not found")
10 | exit()
11 |
12 |
13 | array = np.array(img)
14 | unique, counts = np.unique(array, return_counts=True)
15 |
16 | ocurrance = dict(zip(unique, counts))
17 |
18 |
19 | a1_sorted_keys = sorted(ocurrance, key=ocurrance.get, reverse=True)
20 | print(a1_sorted_keys[:3])
21 |
22 |
23 | # Create a blank 300x300 black image
24 | image = np.zeros((300, 300, 3), np.uint8)
25 | # Fill image with red color(set each pixel to red)
26 | image[:] = a1_sorted_keys[:3]
27 |
28 |
29 | c = a1_sorted_keys[0]
30 |
31 | # Create a blank 300x300 black image
32 | color = np.zeros((300, 300, 3), np.uint8)
33 | # Fill image with red color(set each pixel to red)
34 | color[:] = (c, c, c)
35 |
36 | print("Tone : " + str(a1_sorted_keys[:3]))
37 | cv2.imshow("Tone", image)
38 | print("color : " + str([c, c, c]))
39 | cv2.imshow("color", color)
40 |
--------------------------------------------------------------------------------
/projects/Dominant_color/requirements.txt:
--------------------------------------------------------------------------------
1 | opencv-python==4.3.0.36
2 | numpy==1.19.1
3 |
--------------------------------------------------------------------------------
/projects/Download_images_from_website/Readme.md:
--------------------------------------------------------------------------------
1 | # Scrap images from URL
2 |
3 | 1. Dowmload Chrome Drive From Chrome.
4 | 2. Run scrap-img.py file `py scrap-img.py`
5 | 3. `Enter Path : E:\webscraping\chromedriver_win32\chromedriver.exe`
6 | `Enter URL : https://dribbble.com/`
7 |
--------------------------------------------------------------------------------
/projects/Download_images_from_website/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium==3.141.0
2 |
--------------------------------------------------------------------------------
/projects/Download_images_from_website/scrap-img.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | import requests as rq
3 | import os
4 | from bs4 import BeautifulSoup
5 | import time
6 |
7 | # path= E:\web scraping\chromedriver_win32\chromedriver.exe
8 | path = input("Enter Path : ")
9 |
10 | url = input("Enter URL : ")
11 |
12 | output = "output"
13 |
14 |
15 | def get_url(path, url):
16 | driver = webdriver.Chrome(executable_path=r"{}".format(path))
17 | driver.get(url)
18 | print("loading.....")
19 | res = driver.execute_script("return document.documentElement.outerHTML")
20 |
21 | return res
22 |
23 |
24 | def get_img_links(res):
25 | soup = BeautifulSoup(res, "lxml")
26 | imglinks = soup.find_all("img", src=True)
27 | return imglinks
28 |
29 |
30 | def download_img(img_link, index):
31 | try:
32 | extensions = [".jpeg", ".jpg", ".png", ".gif"]
33 | extension = ".jpg"
34 | for exe in extensions:
35 | if img_link.find(exe) > 0:
36 | extension = exe
37 | break
38 |
39 | img_data = rq.get(img_link).content
40 | with open(output + "\\" + str(index + 1) + extension, "wb+") as f:
41 | f.write(img_data)
42 |
43 | f.close()
44 | except Exception:
45 | pass
46 |
47 |
48 | result = get_url(path, url)
49 | time.sleep(60)
50 | img_links = get_img_links(result)
51 | if not os.path.isdir(output):
52 | os.mkdir(output)
53 |
54 | for index, img_link in enumerate(img_links):
55 | img_link = img_link["src"]
56 | print("Downloading...")
57 | if img_link:
58 | download_img(img_link, index)
59 | print("Download Complete!!")
60 |
--------------------------------------------------------------------------------
/projects/Duplicate files remover/README.md:
--------------------------------------------------------------------------------
1 | # Duplicate Files Remover
2 | This script removes duplicate files in the directory where the script runs.
3 |
4 | ### Prerequisites
5 | * No external libraries are used
6 | * os
7 | * hashlib
8 |
9 | ### How to run the script
10 | Execute `python3 duplicatefileremover.py`
11 |
12 | ### Screenshot/GIF showing the sample use of the script
13 |
14 | 
15 |
16 | ## Working
17 | The script first lists all the files in the directory. It takes MD5 hash of each file, when hash of 2 files become same it deletes the file.
18 |
19 | ## Author Name
20 | Anandha Krishnan Aji
--------------------------------------------------------------------------------
/projects/Duplicate files remover/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Duplicate files remover/Screenshot.png
--------------------------------------------------------------------------------
/projects/Duplicate files remover/duplicatefileremover.py:
--------------------------------------------------------------------------------
1 | import hashlib
2 | import os
3 |
4 | # Returns the hash string of the given file name
5 |
6 |
7 | def hashFile(filename):
8 | # For large files, if we read it all together it can lead to memory overflow, So we take a blocksize to read at a time
9 | BLOCKSIZE = 65536
10 | hasher = hashlib.md5()
11 | with open(filename, 'rb') as file:
12 | # Reads the particular blocksize from file
13 | buf = file.read(BLOCKSIZE)
14 | while(len(buf) > 0):
15 | hasher.update(buf)
16 | buf = file.read(BLOCKSIZE)
17 | return hasher.hexdigest()
18 |
19 |
20 | if __name__ == "__main__":
21 | # Dictionary to store the hash and filename
22 | hashMap = {}
23 |
24 | # List to store deleted files
25 | deletedFiles = []
26 | filelist = [f for f in os.listdir() if os.path.isfile(f)]
27 | for f in filelist:
28 | key = hashFile(f)
29 | # If key already exists, it deletes the file
30 | if key in hashMap.keys():
31 | deletedFiles.append(f)
32 | os.remove(f)
33 | else:
34 | hashMap[key] = f
35 | if len(deletedFiles) == 0:
36 | print('Deleted Files')
37 | for i in deletedFiles:
38 | print(i)
39 | else:
40 | print('No duplicate files found')
41 |
--------------------------------------------------------------------------------
/projects/EasyVideoPlayer/EasyVideoPlayer.py:
--------------------------------------------------------------------------------
1 | import cv2
2 | import os
3 | from pathlib import Path
4 | from ffpyplayer.player import MediaPlayer
5 |
6 |
7 | # User input for the name of the image file.
8 | video_name = input("Name of the video file that you want to play: ")
9 |
10 | # User input for the path of the image file.
11 | video_directory_guess = input("Directory that may contain the video: ")
12 |
13 |
14 | # This function finds your file. If you don't know the directory just type '/'
15 | def find_the_video(file_name, directory_name):
16 | files_found = []
17 | for path, subdirs, files in os.walk(directory_name):
18 | for name in files:
19 | if(file_name == name):
20 | file_path = os.path.join(path, name)
21 | files_found.append(file_path)
22 |
23 | print(files_found)
24 | return files_found[0] # Return the path.
25 |
26 |
27 | # Initialize the path of the image file.
28 | video_directory = Path(find_the_video(video_name, video_directory_guess))
29 |
30 | # Initialize the parent directory of the image path.
31 | new_working_directory = video_directory.parent
32 |
33 | # Change the working directory of the script.
34 | os.chdir(new_working_directory)
35 |
36 |
37 | video_path = find_the_video(video_name, video_directory_guess)
38 |
39 |
40 | def PlayVideo(video_path):
41 |
42 | video = cv2.VideoCapture(video_path)
43 | player = MediaPlayer(video_path)
44 |
45 | while True:
46 | grabbed, frame = video.read()
47 | audio_frame, val = player.get_frame()
48 | if not grabbed:
49 | print("End of video")
50 | break
51 | if cv2.waitKey(28) & 0xFF == ord("q"):
52 | break
53 | cv2.imshow("Video", frame)
54 | if val != 'eof' and audio_frame is not None:
55 | img, t = audio_frame
56 | video.release()
57 | cv2.destroyAllWindows()
58 |
59 |
60 | PlayVideo(video_path)
61 |
--------------------------------------------------------------------------------
/projects/EasyVideoPlayer/README.md:
--------------------------------------------------------------------------------
1 | # EasyVideoPlayer
2 | EasyVideoPlayer script is a video player based on the terminal. It can find the video in a pc, change its working directory and play the video file.
3 |
4 | ### Prerequisites
5 | cv2, os, pathlib and ffpyplayer.player libraries are needed to run this script, all of which can be installed using "pip3 install 'library name'".
6 |
7 | ### How to run the script
8 | 'cd' to the directory that contains the script and type "python3 EasyVideoPlayer.py". When you are done with the video, use "keyboard interrupt" (Ctrl + C) to exit the player.
9 |
10 | ## *Author Name*
11 | Bartu Yaman
12 |
--------------------------------------------------------------------------------
/projects/EasyVideoPlayer/requirements.txt:
--------------------------------------------------------------------------------
1 | opencv-python==4.4.0.42
2 | pathlib==1.0.1
3 | ffpyplayer==4.3.1
4 |
--------------------------------------------------------------------------------
/projects/Easy_cartoonify/README.md:
--------------------------------------------------------------------------------
1 | # OpenCV Cartoonify
2 |
3 | This script uses the OpenCV library to process images and outputs cartoon-like images and allows the user to process images without worrying about the directory of the image with a terminal based basic UI.
4 |
5 | ### The Significance of This Particular Cartoon Converter Script
6 |
7 | This script finds your image file in your pc and automatically changes its the working directory before it starts processing the image. This operation saves the time and energy of the user.
8 |
9 | #### Future Of This Project
10 |
11 | Please keep in mind that this is the first version of the project and currenty only has 2 options for the cartoon styles. I will add much more depth to the cartoonify-ing process later on.
12 |
--------------------------------------------------------------------------------
/projects/Encrypt_and_decrypt_text/README.md:
--------------------------------------------------------------------------------
1 | # aes_encode
2 |
3 | A small python program that encodes and decodes text.
4 |
5 | ### Prerequisites
6 |
7 | - pycryptodome 3.9.8
8 | - Python 3
9 |
10 | ### How to run the script
11 |
12 | > python aes_encode.py "a text"
13 |
14 | Example:
15 | ```
16 | python aes_encode.py "hello world"
17 | ```
18 | An encrypted file (`encrypted.bin`) will be generated
19 | when the program has finished running.
20 |
21 | ### Screenshot/GIF showing the sample use of the script
22 |
23 | 
24 |
25 | ### Author Name
26 |
27 | [Gaodong](https://github.com/xlgd)
28 |
--------------------------------------------------------------------------------
/projects/Encrypt_and_decrypt_text/aes_encode.py:
--------------------------------------------------------------------------------
1 | from Crypto.Cipher import AES
2 | from Crypto import Random
3 | from binascii import b2a_hex
4 | import sys
5 |
6 | # get the plaintext
7 | plain_text = sys.argv[1]
8 |
9 | # The key length must be 16 (AES-128), 24 (AES-192), or 32 (AES-256) Bytes.
10 | key = b'this is a 16 key'
11 |
12 | # Generate a non-repeatable key vector with a length
13 | # equal to the size of the AES block
14 | iv = Random.new().read(AES.block_size)
15 |
16 | # Use key and iv to initialize AES object, use MODE_CFB mode
17 | mycipher = AES.new(key, AES.MODE_CFB, iv)
18 |
19 | # Add iv (key vector) to the beginning of the encrypted ciphertext
20 | # and transmit it together
21 | ciphertext = iv + mycipher.encrypt(plain_text.encode())
22 |
23 |
24 | # To decrypt, use key and iv to generate a new AES object
25 | mydecrypt = AES.new(key, AES.MODE_CFB, ciphertext[:16])
26 |
27 | # Use the newly generated AES object to decrypt the encrypted ciphertext
28 | decrypttext = mydecrypt.decrypt(ciphertext[16:])
29 |
30 | # output
31 | file_out = open("encrypted.bin", "wb")
32 | file_out.write(ciphertext[16:])
33 | file_out.close()
34 |
35 | print("The key k is: ", key)
36 | print("iv is: ", b2a_hex(ciphertext)[:16])
37 | print("The encrypted data is: ", b2a_hex(ciphertext)[16:])
38 | print("The decrypted data is: ", decrypttext.decode())
39 |
--------------------------------------------------------------------------------
/projects/Encrypt_and_decrypt_text/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Encrypt_and_decrypt_text/output.png
--------------------------------------------------------------------------------
/projects/Encrypt_and_decrypt_text/requirements.txt:
--------------------------------------------------------------------------------
1 | pycryptodome==3.9.8
2 |
--------------------------------------------------------------------------------
/projects/Extract_zip_files/README.md:
--------------------------------------------------------------------------------
1 | ## Extract zip files
2 |
3 | This script takes a zip file as input and extracts its content into a separate folder.
4 | The folder is named same as the input zip file and is saved in the current directory
5 |
6 | ### How to use this?
7 | Just type the following in the command prompt:
8 |
9 | python extract_zip_files.py -l
10 |
11 | Example:
12 |
13 | python extract_zip_files.py -l Amazing_Spiderman_subtitles.zip
14 |
--------------------------------------------------------------------------------
/projects/Extract_zip_files/extract_zip_files.py:
--------------------------------------------------------------------------------
1 | import os
2 | import zipfile
3 | import sys
4 | import argparse
5 |
6 | # Code to add the cli
7 | parser = argparse.ArgumentParser()
8 | parser.add_argument("-l", "--zippedfile", required=True, help="Zipped file")
9 | args = vars(parser.parse_args())
10 |
11 | #Catching the user defined zip file
12 | zip_file = args['zippedfile']
13 |
14 | file_name = zip_file
15 |
16 | #To check if the entered zip file is present in the directory
17 | if os.path.exists(zip_file) == False:
18 | sys.exit("No such file present in the directory")
19 |
20 | #Function to extract the zip file
21 | def extract(zip_file):
22 | file_name = zip_file.split(".zip")[0]
23 | if zip_file.endswith(".zip"):
24 |
25 | #Will use this to save the unzipped file in the current directory
26 | current_working_directory = os.getcwd()
27 | new_directory = current_working_directory + "/" + file_name
28 | #Logic to unzip the file
29 | with zipfile.ZipFile(zip_file, 'r') as zip_object:
30 | zip_object.extractall(new_directory)
31 | print("Extracted successfully!!!")
32 | else:
33 | print("Not a zip file")
34 |
35 | extract(zip_file)
36 |
--------------------------------------------------------------------------------
/projects/Fetch HTTP status code/README.md:
--------------------------------------------------------------------------------
1 | ## Program to fetch the HTTP status code
2 |
3 | This script is used to fetch the status code of any request.
4 |
5 | Input:
6 | -> URL of a website or an API
7 |
8 | Output:
9 | -> Line 1 : Status code of the response followed by emoji (thumbsup/thumbsdown)
10 | -> Line 2 : Relevant message about the status code.
11 | i.e. If status code corresponds to failure, then reason of failure would be shown in the message field.
12 |
13 | ## Prerequisites
14 |
15 | This program uses and external dependency of "emoji" library to display the emojis in output.
16 | This library can be installed easily by using the following command:
17 | pip install -r requirements.txt
18 |
19 | ## How to use this script?
20 |
21 | -> Install the requirements.
22 | ->Type the following command:
23 | python fetch_http_status_code.py
24 | ->A message asking URL/API would be displayed : Enter any url of choice and check the output
--------------------------------------------------------------------------------
/projects/Fetch HTTP status code/fetch_http_status_code.py:
--------------------------------------------------------------------------------
1 | #Program to fetch the http status code give the url/api
2 | from urllib.request import Request, urlopen
3 | from urllib.error import URLError, HTTPError
4 | import emoji
5 |
6 | #Taking input url from user
7 | requestURL = input("Enter the URL to be invoked: ")
8 |
9 | #Gets the response from URL and prints the status code, corresponding emoji and message accordingly
10 | try:
11 | response = urlopen(requestURL)
12 | #In case of success, prints success status code and thumbs_up emoji
13 | print('Status code : ' + str(response.code) + ' ' + emoji.emojize(':thumbs_up:'))
14 | print('Message : ' + 'Request succeeded. Request returned message - ' + response.reason)
15 | except HTTPError as e:
16 | #In case of request failure, prints HTTP error status code and thumbs_down emoji
17 | print('Status : ' + str(e.code) + ' ' + emoji.emojize(':thumbs_down:'))
18 | print('Message : Request failed. Request returned reason - ' + e.reason)
19 | except URLError as e:
20 | #In case of bad URL or connection failure, prints Win Error and thumbs_down emoji
21 | print('Status :', str(e.reason).split(']')[0].replace('[','') + ' ' + emoji.emojize(':thumbs_down:'))
22 | print('Message : '+ str(e.reason).split(']')[1])
23 |
--------------------------------------------------------------------------------
/projects/Fetch HTTP status code/requirements.txt:
--------------------------------------------------------------------------------
1 | emoji==0.6.0
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/fetch_store_tweet.py:
--------------------------------------------------------------------------------
1 | import tweepy
2 | import csv
3 |
4 | # input your credentials here
5 | consumer_key = ''
6 | consumer_secret = ''
7 | access_token = ''
8 | access_token_secret = ''
9 | hastag = ''
10 |
11 | auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
12 | auth.set_access_token(access_token, access_token_secret)
13 | api = tweepy.API(auth,wait_on_rate_limit=True)
14 |
15 | # Open/Create a file to append data
16 | csvFile = open('tweets.csv', 'a')
17 | #Use csv Writer
18 | csvWriter = csv.writer(csvFile)
19 |
20 | for tweet in tweepy.Cursor(api.search,q=hastag,count=100,
21 | lang="en",
22 | since="2017-04-03").items():
23 | print (tweet.created_at, tweet.text)
24 | csvWriter.writerow([tweet.created_at, tweet.text.encode('utf-8')])
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/output-2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/output-2.PNG
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/output-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/output-2.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/output.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/output.PNG
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/output.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-1.PNG
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-1.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-2.PNG
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-2.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-3.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-3.PNG
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-3.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-4.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-4.PNG
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-4.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-5.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-5.PNG
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-5.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-6.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-6.PNG
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-6.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-7.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/img/step-9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_and_store_tweets/img/step-9.png
--------------------------------------------------------------------------------
/projects/Fetch_and_store_tweets/requirements.txt:
--------------------------------------------------------------------------------
1 | tweepy==3.9.0
2 |
--------------------------------------------------------------------------------
/projects/Fetch_current_weather/README.md:
--------------------------------------------------------------------------------
1 | # Current Weather
2 |
3 | This Script will help you to find current weather of any entered place.
4 | This script is using openweathermap.org to find the current weather.
5 |
6 | # Requirement
7 |
8 | To run this script you need to have api key, to get an API key you first [signup here](https://home.openweathermap.org/api_keys)
9 |
10 | After getting the api key add in the code
11 | ```
12 | api_key = "Your_API_Key"
13 | ```
14 |
15 | # Result
16 | The output this script will generate
17 |
--------------------------------------------------------------------------------
/projects/Fetch_current_weather/fetch_current_weather.py:
--------------------------------------------------------------------------------
1 | # Python program to find current weather details of any city using openweathermap api
2 | import requests, json
3 |
4 | # Enter your API key here
5 | api_key = "Your_API_Key"
6 |
7 | # base_url variable to store url
8 | base_url = "http://api.openweathermap.org/data/2.5/weather?"
9 |
10 | # Give city name
11 | city_name = input("Enter city name : ")
12 |
13 | complete_url = base_url + "appid=" + api_key + "&q=" + city_name
14 | response = requests.get(complete_url)
15 | x = response.json()
16 |
17 | if x["cod"] != "404":
18 |
19 | y = x["main"]
20 | current_temperature = y["temp"]
21 | current_pressure = y["pressure"]
22 | current_humidiy = y["humidity"]
23 | z = x["weather"]
24 | weather_description = z[0]["description"]
25 | print(" Temperature (in kelvin unit) = " +
26 | str(current_temperature) +
27 | "\n atmospheric pressure (in hPa unit) = " +
28 | str(current_pressure) +
29 | "\n humidity (in percentage) = " +
30 | str(current_humidiy) +
31 | "\n description = " +
32 | str(weather_description))
33 |
34 | else:
35 | print(" City Not Found ")
--------------------------------------------------------------------------------
/projects/Fetch_open_ports/README.md:
--------------------------------------------------------------------------------
1 | # Fetch open port
2 |
3 | This script finds open port for web address.
4 |
5 | ### Prerequisites
6 |
7 | No need for additional installations.
8 |
9 | ### How to run the script
10 |
11 | 1. Clone repo on your local machine and switch to script folder
12 | ```
13 | git clone https://github.com/chavarera/python-mini-projects.git
14 | cd python-mini-projects/projects/Fetch_open_ports/
15 | ```
16 |
17 | 2. Run following command
18 | ```
19 | python3 fetch_open_port.py
20 | ```
21 |
22 | 3. Once script is running, you can write any website you want, and it will print all open ports in range 50-500.
23 |
24 | ### Screenshot/GIF showing the sample use of the script
25 |
26 | 
27 |
28 | ## *Author Name*
29 |
30 | Aleksej Komnenovic
--------------------------------------------------------------------------------
/projects/Fetch_open_ports/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Fetch_open_ports/Screenshot.png
--------------------------------------------------------------------------------
/projects/Fetch_open_ports/fetch_open_port.py:
--------------------------------------------------------------------------------
1 | from socket import *
2 | import time
3 | startTime = time.time()
4 |
5 | if __name__ == '__main__':
6 | target = input('Enter the host to be scanned: ')
7 | t_IP = gethostbyname(target)
8 | print ('Starting scan on host: ', t_IP)
9 |
10 | for i in range(50, 500):
11 | s = socket(AF_INET, SOCK_STREAM)
12 |
13 | conn = s.connect_ex((t_IP, i))
14 | if(conn == 0) :
15 | print ('Port %d: OPEN' % (i,))
16 | s.close()
17 | print('Time taken:', time.time() - startTime)
--------------------------------------------------------------------------------
/projects/Find_imdb_rating/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/projects/Find_imdb_rating/README.md:
--------------------------------------------------------------------------------
1 | # Find IMDB Ratings
2 |
3 | This script is used to fetch the Ratings and Genre of the films in your films folder that match with ones on IMDb, the data is scraped from IMDB's official website and store in a csv file. The csv file can be used for analysis then, sorting acc to rating etc.
4 |
5 | Input: -> Path of the directory which contains the films.
6 |
7 | Output: -> A new csv file is made - 'film_ratings.csv' which contains the ratings for the films in your directory.
8 |
9 | ### Prerequisites
10 |
11 | This program uses and external dependency of 'BeautifulSoup' (for web scraping), 'requests' (for fetching content of the webpage), 'pandas' (to make the csv file), 'os' (to get data from directory).
12 | These libraries can be installed easily by using the following command: pip install -r requirements.txt
13 |
14 | ### How to run the script
15 |
16 | -> Install the requirements.
17 | -> Inside the find_IMDb_rating.py, update the directory path.
18 | -> Type the following command: python find_IMDb_rating.py
19 | -> A csv file with rating will be created in the same directory as the python file.
20 |
21 | ### Screenshot/GIF showing the sample use of the script
22 |
23 | Folder :
24 |
25 | 
26 |
27 | CSV File:
28 | 
29 |
30 |
31 | ## *Author Name*
32 |
33 | Utkarsh Bajaj
34 |
--------------------------------------------------------------------------------
/projects/Find_imdb_rating/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4==4.9.1
2 | certifi==2020.6.20
3 | chardet==3.0.4
4 | idna==2.10
5 | pandas==1.1.2
6 | python-dateutil==2.8.1
7 | pytz==2020.1
8 | requests==2.24.0
9 | six==1.15.0
10 | soupsieve==2.0.1
11 | urllib3==1.25.10
12 |
--------------------------------------------------------------------------------
/projects/Find_out_hostname_and_ip_address/Hostname_IPaddress.py:
--------------------------------------------------------------------------------
1 | # importing socket library
2 | import socket
3 |
4 | def get_hostname_IP():
5 | hostname = input("Please enter website address(URL):")
6 | try:
7 | print (f'Hostname: {hostname}')
8 | print (f'IP: {socket.gethostbyname(hostname)}')
9 | except socket.gaierror as error:
10 | print (f'Invalid Hostname, error raised is {error}')
11 |
12 | get_hostname_IP()
13 |
14 |
--------------------------------------------------------------------------------
/projects/Find_out_hostname_and_ip_address/README.md:
--------------------------------------------------------------------------------
1 | # Get Ipaddress and Hostname of Website
2 |
3 | Get the ip address and hostname of a website
4 |
5 | ### Prerequisites
6 |
7 | None
8 |
9 | ### How to run the script
10 |
11 | Execute `python3 Hostname_IPaddress.py`
12 |
13 | ### Screenshot/GIF showing the sample use of the script
14 |
15 | 
16 |
17 | ## *Author Name*
18 |
19 | Nuh Mohammed
20 |
--------------------------------------------------------------------------------
/projects/Find_out_hostname_and_ip_address/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Find_out_hostname_and_ip_address/Screenshot.png
--------------------------------------------------------------------------------
/projects/Geocoding/README.md:
--------------------------------------------------------------------------------
1 | ## Geocoding Script
2 |
3 | ### This script takes an address and return its latitude and longitude.This process is called geocoding
4 |
5 | #### I have used the locationiq website's geocoding api inorder to solve this problem.
6 |
7 | #### To be able to use this script you have to create a *free account* at https://locationiq.com/ and obtain your *private token*.
8 |
9 | #### Remember, *don't share* your private token with anyone.
10 |
--------------------------------------------------------------------------------
/projects/Geocoding/geocoding.py:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 | # Base Url for geocoding
4 | url = "https://us1.locationiq.com/v1/search.php"
5 |
6 | address = input("Input the address: ")
7 |
8 | #Your unique private_token should replace value of the private_token variable.
9 | #To know how to obtain a unique private_token please refer the README file for this script.
10 | private_token = "Your_private_token"
11 |
12 | data = {
13 | 'key': private_token,
14 | 'q': address,
15 | 'format': 'json'
16 | }
17 |
18 | response = requests.get(url, params=data)
19 |
20 | latitude = response.json()[0]['lat']
21 | longitude = response.json()[0]['lon']
22 |
23 | print(f"The latitude of the given address is: {latitude}")
24 | print(f"The longitude of the given address is: {longitude}")
25 | print("Thanks for using this script")
26 |
--------------------------------------------------------------------------------
/projects/Geocoding/requirements.txt:
--------------------------------------------------------------------------------
1 | certifi==2020.6.20
2 | chardet==3.0.4
3 | idna==2.10
4 | requests==2.24.0
5 | urllib3==1.25.10
6 |
--------------------------------------------------------------------------------
/projects/Get_meta_information_of_images/README.md:
--------------------------------------------------------------------------------
1 | ## Get meta information of images
2 |
3 | ### usage
4 |
5 | python get_meta_from_pic.py image_file
6 |
7 | ### note
8 |
9 | Make sure the picture contains location information, otherwise the location cannot be obtained
10 |
11 | you need fill in your email address to use the function in gps_utils.py:
12 | ```python
13 | geolocator = Nominatim(user_agent = "your email")
14 | ```
--------------------------------------------------------------------------------
/projects/Get_meta_information_of_images/get_meta_from_pic.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | from PIL.ExifTags import TAGS
3 | from author_utils import get_file_security, get_author
4 | from gps_utils import get_location
5 | import os
6 | import sys
7 | from datetime import datetime
8 |
9 | def get_exif(image):
10 | image.verify()
11 | return image._getexif()
12 |
13 |
14 | def get_labeled_exif(exif):
15 | labeled = {}
16 | for (key, val) in exif.items():
17 | labeled[TAGS.get(key)] = val
18 |
19 | return labeled
20 |
21 | im = Image.open(sys.argv[1])
22 |
23 | # get the image name
24 | name = im.filename
25 |
26 | # get the image size
27 | w, h = im.size
28 |
29 | # get the image file extension
30 | _, file_extension = os.path.splitext(sys.argv[1])
31 |
32 | # get the exif information
33 | exif = get_exif(im)
34 | labeled = get_labeled_exif(exif)
35 |
36 | # get the file creation time
37 | ctime = os.path.getctime(sys.argv[1])
38 |
39 | # output information
40 | print("ImageName: %s" %(name))
41 | print("size: %sx%s" % (w, h))
42 | print("FileExtension: %s" %(file_extension))
43 | if ('ExifImageWidth' in labeled.keys()):
44 | print("ImageWidth: %s" % (labeled['ExifImageWidth']))
45 | else:
46 | print("No ImageWidth")
47 |
48 | if ('ExifImageHeight' in labeled.keys()):
49 | print("ImageHeight: %s" % (labeled['ExifImageHeight']))
50 | else:
51 | print("No ImageHeight")
52 |
53 | if ('DateTimeOriginal' in labeled.keys()):
54 | print("DateTimeOriginal: %s" % (labeled['DateTimeOriginal']))
55 | else:
56 | print("No DateTimeOriginal")
57 |
58 | print("CreateDate: %s" % (datetime.fromtimestamp(ctime).strftime('%Y-%m-%d %H:%M:%S')))
59 | print("Author: %s" % (get_author(sys.argv[1])))
60 | print("Location: %s" % (get_location(sys.argv[1])))
61 |
--------------------------------------------------------------------------------
/projects/Get_meta_information_of_images/gps_utils.py:
--------------------------------------------------------------------------------
1 | import exifread
2 | import requests,json
3 | from geopy.geocoders import Nominatim
4 |
5 | def format_lati_long(data):
6 | list_tmp=str(data).replace('[', '').replace(']', '').split(',')
7 | list=[ele.strip() for ele in list_tmp]
8 | if (list[-1].find('/') != -1):
9 | data_sec = int(list[-1].split('/')[0]) /(int(list[-1].split('/')[1])*3600)
10 | else:
11 | data_sec = int(list[-1])/3600
12 | data_minute = int(list[1])/60
13 | data_degree = int(list[0])
14 | result=data_degree + data_minute + data_sec
15 | return result
16 |
17 | def get_location(filename):
18 | img=exifread.process_file(open(filename,'rb'))
19 | latitude=format_lati_long(str(img['GPS GPSLatitude']))
20 | longitude=format_lati_long(str(img['GPS GPSLongitude']))
21 | geolocator = Nominatim(user_agent = "your email")
22 | position = geolocator.reverse(str(latitude) + ',' + str(longitude))
23 | return position.address
--------------------------------------------------------------------------------
/projects/Get_meta_information_of_images/requirements.txt:
--------------------------------------------------------------------------------
1 | PIL==1.1.6
2 | ExifRead==2.3.1
3 | geopy==2.0.0
4 |
--------------------------------------------------------------------------------
/projects/Get_wifi_password/README.md:
--------------------------------------------------------------------------------
1 | ## WIFI PASSWORD EJECTOR
2 | # Description
3 | a simple python script that tells you the password of the wifi you're connected with
4 |
5 | # Requirements
6 | just need to install python in your system.
7 |
8 | # How to run
9 | run the file from your code editor or Ide or u can also run it from the command line
10 |
--------------------------------------------------------------------------------
/projects/Get_wifi_password/wifi.py:
--------------------------------------------------------------------------------
1 | import subprocess
2 |
3 | data = (
4 | subprocess.check_output(["netsh", "wlan", "show", "profiles"])
5 | .decode("utf-8")
6 | .split("\n")
7 | )
8 | profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
9 | for i in profiles:
10 | results = (
11 | subprocess
12 | .check_output(["netsh", "wlan", "show", "profile", i, "key=clear"])
13 | .decode("utf-8")
14 | .split("\n")
15 | )
16 | results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
17 | try:
18 | print("{:<30}| {:<}".format(i, results[0]))
19 | except IndexError:
20 | print("{:<30}| {:<}".format(i, ""))
21 |
--------------------------------------------------------------------------------
/projects/Hashing_passwords/README.md:
--------------------------------------------------------------------------------
1 | # hashing passwords
2 | ## Execute
3 | `python hashing_passwords.py [-t {sha256,sha512,md5}] `
4 | *※Default hash-type is sha256*
5 |
6 | ## Example
7 | ```
8 | $ python hashing_passwords.py nakao
9 | < hash-type : sha256 >
10 | 63201414e0804bdc63b662bd87f0f51616ab69bd672aefe2b17fcec1ef14a995
11 | ```
12 |
13 | ```
14 | $ python hashing_passwords.py nakao -t sha512
15 | < hash-type : sha512 >
16 | 9cae3a2096c33b6049502ac923baff9649478df62eb090bac30d5c684b2f724ecaf7c3d7744ebccb49118d2ab07d615b02a7d170fd6310f815da18e09863841a
17 | ```
18 |
--------------------------------------------------------------------------------
/projects/Hashing_passwords/hashing_passwords.py:
--------------------------------------------------------------------------------
1 | # -*- cofing: utf-8 -*-
2 | import argparse
3 | import hashlib
4 |
5 | # parsing
6 | parser = argparse.ArgumentParser(description='hashing given password')
7 | parser.add_argument('password', help='input password you want to hash')
8 | parser.add_argument('-t', '--type', default='sha256',choices=['sha256', 'sha512', 'md5'] )
9 | args = parser.parse_args()
10 |
11 | # hashing given password
12 | password = args.password
13 | hashtype = args.type
14 | m = getattr(hashlib,hashtype)()
15 | m.update(password.encode())
16 |
17 | # output
18 | print("< hash-type : " + hashtype + " >")
19 | print(m.hexdigest())
20 |
--------------------------------------------------------------------------------
/projects/Hello/Hello.py:
--------------------------------------------------------------------------------
1 | # This is simple program to show how print statement works
2 |
3 | print('Hello Python World')
4 |
--------------------------------------------------------------------------------
/projects/Hello/README.md:
--------------------------------------------------------------------------------
1 | # Hello
2 |
3 | This script is a good way to show how the print function work and it's usually every programmer's first line of code. The print() function prints the specified message to the screen.
4 |
5 | ### Prerequisites
6 |
7 | Python installed locally. Check [here](https://www.python.org/downloads/) to install depending on your OS
8 |
9 | ### How to run the script
10 |
11 | ```
12 | python Hello.py
13 | ```
14 |
15 | The final result will be printed on the screen as:
16 |
17 | ```
18 | Hello Python World
19 | ```
20 |
21 | ## *Author Name*
22 |
23 | Ravi Chavare
--------------------------------------------------------------------------------
/projects/Image_watermark/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Image_watermark/README.md
--------------------------------------------------------------------------------
/projects/Image_watermark/requirements.txt:
--------------------------------------------------------------------------------
1 | PIL==1.1.6
2 |
--------------------------------------------------------------------------------
/projects/Image_watermark/watermark.py:
--------------------------------------------------------------------------------
1 | import os
2 | from PIL import Image
3 | from PIL import ImageFilter
4 |
5 |
6 | def watermark_photo(input_image_path, output_image_path, watermark_image_path):
7 |
8 | base_image = Image.open(input_image_path)
9 | watermark = Image.open(watermark_image_path)
10 | # add watermark to your image
11 | position = base_image.size
12 |
13 | watermark_size = watermark.size
14 |
15 | newsize = int(position[0] * 8 / 100), int(position[0] * 8 / 100)
16 |
17 | watermark = watermark.resize(newsize)
18 | # Blur If Needed
19 | # watermark = watermark.filter(ImageFilter.BoxBlur(2))
20 | new_position = position[0] - newsize[0] - 20, position[1] - newsize[1] - 20
21 |
22 | transparent = Image.new(mode="RGBA", size=position, color=(0, 0, 0, 0))
23 | # Create a new transparent image
24 | transparent.paste(base_image, (0, 0))
25 | # paste the original image
26 |
27 | transparent.paste(watermark, new_position, mask=watermark)
28 | # paste the watermark image
29 | image_mode = base_image.mode
30 | if image_mode == "RGB":
31 | transparent = transparent.convert(image_mode)
32 | else:
33 | transparent = transparent.convert("P")
34 | transparent.save(output_image_path, optimize=True, quality=100)
35 | print("Saving " + output_image_path + " ...")
36 |
37 |
38 | folder = input("Enter Folder Path : ")
39 |
40 | watermark = input("Enter Watermark Path : ")
41 |
42 | os.chdir(folder)
43 | files = os.listdir(os.getcwd())
44 |
45 | if not os.path.isdir("output"):
46 | os.mkdir("output")
47 |
48 | c = 1
49 | for f in files:
50 | if os.path.isfile(os.path.abspath(f)):
51 | if f.endswith(".png") or f.endswith(".jpg"):
52 | watermark_photo(f, "output/" + f, watermark)
53 |
54 |
--------------------------------------------------------------------------------
/projects/Instagram_profile/InstgramProfile.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from lxml import html
3 | import re
4 | import sys
5 |
6 |
7 | def main(username):
8 | '''main function accept instagram username
9 | return an dictionary object containging profile deatils
10 | '''
11 | url = "https://www.instagram.com/{}/?hl=en".format(username)
12 | page = requests.get(url)
13 | tree = html.fromstring(page.content)
14 | data = tree.xpath('//meta[starts-with(@name,"description")]/@content')
15 |
16 | if data:
17 | data = tree.xpath('//meta[starts-with(@name,"description")]/@content')
18 | data = data[0].split(', ')
19 | followers = data[0][:-9].strip()
20 | following = data[1][:-9].strip()
21 | posts = re.findall(r'\d+[,]*', data[2])[0]
22 | name = re.findall(r'name":"\w*[\s]+\w*"', page.text)[-1][7:-1]
23 | aboutinfo = re.findall(r'"description":"([^"]+)"', page.text)[0]
24 | instagram_profile = {
25 | 'success': True,
26 | 'profile': {
27 | 'name': name,
28 | 'profileurl': url,
29 | 'username': username,
30 | 'followers': followers,
31 | 'following': following,
32 | 'posts': posts,
33 | 'aboutinfo': aboutinfo
34 | }
35 | }
36 | else:
37 | instagram_profile = {
38 | 'success': False,
39 | 'profile': {}
40 | }
41 | return instagram_profile
42 |
43 |
44 | # python InstgramProfile.py username
45 | if __name__ == "__main__":
46 | '''driver code'''
47 |
48 | if len(sys.argv) == 2:
49 | output = main(sys.argv[-1])
50 | print(output)
51 | else:
52 | print('=========>Invalid paramaters Valid Command is<=========== \
53 | \npython InstagramProfile.py username')
54 |
--------------------------------------------------------------------------------
/projects/Instagram_profile/Readme.md:
--------------------------------------------------------------------------------
1 | ## Instgram profile information
2 |
3 | ### install packages
4 | ```
5 | pip install -r requirements.txt
6 | ```
7 |
8 | ### Execute Program
9 | ```
10 | python InstgramProfile.py
11 | ```
12 |
13 | ### Sample run
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/projects/Instagram_profile/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Instagram_profile/output.png
--------------------------------------------------------------------------------
/projects/Instagram_profile/requirements.txt:
--------------------------------------------------------------------------------
1 | appdirs==1.4.3
2 | beautifulsoup4==4.9.2
3 | bs4==0.0.1
4 | CacheControl==0.12.6
5 | certifi==2019.11.28
6 | chardet==3.0.4
7 | colorama==0.4.3
8 | contextlib2==0.6.0
9 | distlib==0.3.0
10 | distro==1.4.0
11 | html5lib==1.0.1
12 | idna==2.8
13 | ipaddr==2.2.0
14 | lockfile==0.12.2
15 | lxml==4.5.2
16 | msgpack==0.6.2
17 | packaging==20.3
18 | pep517==0.8.2
19 | Pillow==7.2.0
20 | progress==1.5
21 | pyparsing==2.4.6
22 | pytoml==0.1.21
23 | requests==2.22.0
24 | retrying==1.3.3
25 | six==1.14.0
26 | soupsieve==2.0.1
27 | tqdm==4.50.0
28 | urllib3==1.25.8
29 | webencodings==0.5.1
30 |
--------------------------------------------------------------------------------
/projects/Internet_connection_check/README.md:
--------------------------------------------------------------------------------
1 | # Internet Connection Check
2 |
3 | A small python script to check internet connectivity.
4 |
5 | ### Prerequisites
6 |
7 | Python3
8 |
9 | ### How to run the script
10 |
11 | > python3 internet_connection_check.py
12 |
13 | ### Screenshot/GIF showing the sample use of the script
14 |
15 | 
16 |
17 | ## *Author Name*
18 |
19 | [Ashu Sharma](https://github.com/AshuSharma7)
20 | [Jacob Ogle](https://github.com/JakeOgle94)
21 |
--------------------------------------------------------------------------------
/projects/Internet_connection_check/internet_connection_check.py:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 | def internet_connection_test():
4 | url = 'https://www.google.com/'
5 | print(f'Attempting to connect to {url} to determine internet connection status.')
6 |
7 | try:
8 | requests.get(url, timeout = 10)
9 | print(f'Connection to {url} was successful.')
10 | return True
11 | except:
12 | requests.ConnectionError
13 | print(f'Failed to connect to {url}.')
14 | return False
15 |
16 | internet_connection_test()
17 |
--------------------------------------------------------------------------------
/projects/Internet_connection_check/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Internet_connection_check/output.png
--------------------------------------------------------------------------------
/projects/Language_translator/README.md:
--------------------------------------------------------------------------------
1 | # Google Translater Scripts
2 |
3 | Transalte one language to another language
4 |
5 | ### Requirements
6 | - you need to install below library using pip
7 | - $ pip install googletrans
8 | ### Description
9 | - There are 16 languages you can translate into.
10 |
11 | ### How to run the script
12 | Execute `python3 python translator.py`
13 | - After then you have choices to select language by their code
14 | - Enter Sentence and you will get translated language
15 |
16 | ### Language options and their code
17 | | Code | Language |
18 | | ----------- | ----------- |
19 | | bn | Bangla |
20 | | en | English |
21 | | ko | Koren |
22 | | fr | French |
23 | | de | German |
24 | | he | Hebrew |
25 | | hi | Hindi |
26 | | it | Italian |
27 | | ja | Japanese |
28 | | la | Latin |
29 | | ms | Malay |
30 | | ne | Nepali |
31 | | ru | Russian |
32 | | ar | Arabic |
33 | | zh | Chinese |
34 | | es | Spanish |
35 |
36 |
37 | ### Screenshot shows how to use the script
38 | 
39 |
40 | ## *Author Name*
41 | Azhad Ghufran
42 |
--------------------------------------------------------------------------------
/projects/Language_translator/Shot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Language_translator/Shot.png
--------------------------------------------------------------------------------
/projects/Language_translator/requirements.txt:
--------------------------------------------------------------------------------
1 | googletrans==3.0.0
2 |
--------------------------------------------------------------------------------
/projects/Leap_Year_Checker/README.md:
--------------------------------------------------------------------------------
1 | # Script Title
2 |
3 | With the help of this program, you can check whether a year is leap year or not.
4 | ### Prerequisites
5 |
6 | No pre-requisites are required...😀😀
7 | ### How to run the script
8 |
9 | You can run this on any ide or online compiler.
10 |
11 | ## *Author Name*
12 |
13 | [Hariom1509](https://github.com/Hariom1509)
14 |
--------------------------------------------------------------------------------
/projects/Leap_Year_Checker/leapyear.py:
--------------------------------------------------------------------------------
1 | year = int(input("Enter a year:- ")) # Here, you take the input from the user
2 |
3 | if(((year % 4 == 0) and (year % 100 != 0)) or (year % 400 == 0)):
4 | """
5 | if a year is a multiple of four and a multiple of 100 i.e. if it is a multiple of 400 it is not a leap year
6 | """
7 | print("{0} is a leap year!!".format(year))
8 | """
9 | printing the output
10 | """
11 | else:
12 | print("{0} is not a leap year!!".format(year))
13 |
--------------------------------------------------------------------------------
/projects/Merge_csv_files/README.md:
--------------------------------------------------------------------------------
1 | # Merge CSV files
2 | With the help of the following simple python script, one would be able to merge CSV files present in the directory.
3 |
4 | ## Dependencies
5 | Requires Python 3 and `pandas`
6 |
7 | Install requirements: `pip install -r "requirements.txt"`
8 | OR
9 | Install pandas: `pip install pandas`
10 |
11 | ## How to use
12 | ### Running
13 | Put all the CSVs which are to be merged in a directory containing the script.
14 | either run it from your code editor or IDE or type `python merge_csv_files.py` in your command line.
15 |
16 | The final output would be a `combined_csv.csv` file in the same directory.
17 |
--------------------------------------------------------------------------------
/projects/Merge_csv_files/merge_csv_files.py:
--------------------------------------------------------------------------------
1 | import os
2 | import glob
3 | import pandas as pd
4 |
5 | extension = 'csv'
6 | all_filenames = [i for i in glob.glob('*.{}'.format(extension))]
7 |
8 | combined_csv = pd.concat([pd.read_csv(f) for f in all_filenames ])
9 | combined_csv.to_csv( "combined_csv.csv", index=False, encoding='utf-8-sig')
--------------------------------------------------------------------------------
/projects/Merge_csv_files/requirements.txt:
--------------------------------------------------------------------------------
1 | pandas==1.1.0
2 |
--------------------------------------------------------------------------------
/projects/Merge_pdfs/README.md:
--------------------------------------------------------------------------------
1 | ## Merge_pdfs
2 |
3 | A simple python script which when executed merges two pdfs
4 |
5 | ## Prerequisites
6 |
7 | Run - "pip install PyPDF2"
8 |
9 | ## How to run the script
10 |
11 | It can be executed by running "python merge_pdfs.py"
12 |
13 | ## Author Name
14 |
15 | ShivSt
16 |
--------------------------------------------------------------------------------
/projects/Merge_pdfs/merge_pdfs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | from PyPDF2 import PdfFileMerger
4 |
5 |
6 | # By appending in the end
7 | def by_appending():
8 | merger = PdfFileMerger()
9 | # Either provide file stream
10 | f1 = open("samplePdf1.pdf", "rb")
11 | merger.append(f1)
12 | # Or direct file path
13 | merger.append("samplePdf2.pdf")
14 |
15 | merger.write("mergedPdf.pdf")
16 |
17 |
18 | # By inserting at after an specified page no.
19 | def by_inserting():
20 | merger = PdfFileMerger()
21 | merger.append("samplePdf1.pdf")
22 | merger.merge(0, "samplePdf2.pdf")
23 | merger.write("mergedPdf1.pdf")
24 |
25 |
26 | if __name__ == "__main__":
27 | by_appending()
28 | by_inserting()
29 |
--------------------------------------------------------------------------------
/projects/Merge_pdfs/mergedPdf.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Merge_pdfs/mergedPdf.pdf
--------------------------------------------------------------------------------
/projects/Merge_pdfs/mergedPdf1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Merge_pdfs/mergedPdf1.pdf
--------------------------------------------------------------------------------
/projects/Merge_pdfs/requirements.txt:
--------------------------------------------------------------------------------
1 | PyPDF2==1.26.0
2 |
--------------------------------------------------------------------------------
/projects/Merge_pdfs/samplePdf1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Merge_pdfs/samplePdf1.pdf
--------------------------------------------------------------------------------
/projects/Merge_pdfs/samplePdf2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Merge_pdfs/samplePdf2.pdf
--------------------------------------------------------------------------------
/projects/Movie Information Scraper/README.md:
--------------------------------------------------------------------------------
1 | # Movie Information Scraper
2 | This script obtains movie details by scraping IMDB website.
3 |
4 | ### Prerequisites
5 | * beautifulsoup4
6 | * requests
7 | * Run `pip install -r requirements.txt` to install required external modules.
8 |
9 | ### How to run the script
10 | Execute `python3 movieInfoScraper.py` and type in the movie name when prompted.
11 |
12 | ### Screenshot/GIF showing the sample use of the script
13 |
14 | 
15 |
16 | ## Author Name
17 | Anandha Krishnan Aji
--------------------------------------------------------------------------------
/projects/Movie Information Scraper/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Movie Information Scraper/Screenshot.png
--------------------------------------------------------------------------------
/projects/Movie Information Scraper/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4
2 | requests==2.23.0
3 |
--------------------------------------------------------------------------------
/projects/News_website_scraper/README.md:
--------------------------------------------------------------------------------
1 | # Financial-news-scraper
2 | A scraper made using beautiful soup 4 in python. Tailor made for extracting news from moneycontrol.com. Issue pull request for different scrapers.
3 |
4 | __The main page to start scraping from: https://www.moneycontrol.com/news/technical-call-221.html__
5 | 
6 |
7 | __The program scrapes news from next pages too by extracting website link in these buttons__
8 | 
9 |
10 | __Resulting JSON file includes heading, date and image link, indexed by page number__
11 | 
12 |
--------------------------------------------------------------------------------
/projects/News_website_scraper/images/README.md:
--------------------------------------------------------------------------------
1 | home.jpg - main news page
2 |
3 | nextpage.jpg - links to next pages
4 |
5 | result.jpg - Snapshot of result json file
6 |
--------------------------------------------------------------------------------
/projects/News_website_scraper/images/home.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/News_website_scraper/images/home.JPG
--------------------------------------------------------------------------------
/projects/News_website_scraper/images/nextpage.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/News_website_scraper/images/nextpage.JPG
--------------------------------------------------------------------------------
/projects/News_website_scraper/images/result.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/News_website_scraper/images/result.JPG
--------------------------------------------------------------------------------
/projects/News_website_scraper/moneycontrol_scrapper.py:
--------------------------------------------------------------------------------
1 | import re
2 | import json
3 | import requests
4 | import datetime
5 | from tqdm import tqdm
6 | from bs4 import BeautifulSoup
7 | from collections import defaultdict
8 |
9 | submission = defaultdict(list)
10 | #main url
11 | src_url = 'https://www.moneycontrol.com/news/technical-call-221.html'
12 |
13 | #get next page links and call scrap() on each link
14 | def setup(url):
15 | nextlinks = []
16 | src_page = requests.get(url).text
17 | src = BeautifulSoup(src_page, 'lxml')
18 |
19 | #ignore with void js as href
20 | anchors = src.find("div", attrs={"class": "pagenation"}).findAll(
21 | 'a', {'href': re.compile('^((?!void).)*$')})
22 | nextlinks = [i.attrs['href'] for i in anchors]
23 | for idx, link in enumerate(tqdm(nextlinks)):
24 | scrap('https://www.moneycontrol.com'+link, idx)
25 |
26 | #scraps passed page url
27 | def scrap(url, idx):
28 | src_page = requests.get(url).text
29 | src = BeautifulSoup(src_page, 'lxml')
30 |
31 | span = src.find("ul", {"id": "cagetory"}).findAll('span')
32 | img = src.find("ul", {"id": "cagetory"}).findAll('img')
33 |
34 | #
has alt text attr set as heading of news, therefore get img link and heading from same tag
35 | imgs = [i.attrs['src'] for i in img]
36 | titles = [i.attrs['alt'] for i in img]
37 | date = [i.get_text() for i in span]
38 |
39 | #list of dicts as values and indexed by page number
40 | submission[str(idx)].append({'title': titles})
41 | submission[str(idx)].append({'date': date})
42 | submission[str(idx)].append({'img_src': imgs})
43 |
44 | #save data as json named by current date
45 | def json_dump(data):
46 | date = datetime.date.today().strftime("%B %d, %Y")
47 | with open('moneycontrol_'+str(date)+'.json', 'w') as outfile:
48 | json.dump(submission, outfile)
49 |
50 | setup(src_url)
51 | json_dump(submission)
52 |
53 |
--------------------------------------------------------------------------------
/projects/Number_guessing_game/README.md:
--------------------------------------------------------------------------------
1 | # Number Guessing Game
2 |
3 | This game allows you to check your luck and intuition :)
4 | You should find the number computer guessed
5 |
6 | ### Usage
7 | Just run "python main.py" in cmd command line after setting the project directory
8 |
9 | ### Here you can see sample
10 | 
11 |
12 | ## *Author Name*
13 |
14 | [Javokhir](https://github.com/leader2one/)
15 |
--------------------------------------------------------------------------------
/projects/Number_guessing_game/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Number_guessing_game/image.png
--------------------------------------------------------------------------------
/projects/Number_guessing_game/main.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 | print("Number guessing game")
4 |
5 | # randint function to generate the
6 | # random number b/w 1 to 9
7 | number = random.randint(1, 9)
8 |
9 | # number of chances to be given
10 | # to the user to guess the number
11 | # or it is the inputs given by user
12 | # into input box here number of
13 | # chances are 5
14 | chances = 0
15 |
16 | print("Guess a number (between 1 and 9):")
17 |
18 | # While loop to count the number
19 | # of chances
20 | while True:
21 |
22 | # Enter a number between 1 to 9
23 | guess = int(input())
24 |
25 | # Compare the user entered number
26 | # with the number to be guessed
27 | if guess == number:
28 |
29 | # if number entered by user
30 | # is same as the generated
31 | # number by randint function then
32 | # break from loop using loop
33 | # control statement "break"
34 | print(
35 | f'CONGRATULATIONS! YOU HAVE GUESSED THE \
36 | NUMBER {number} IN {chances} ATTEMPTS!')
37 | # Printing final statement using the f-strings method;
38 | break
39 |
40 | # Check if the user entered
41 | # number is smaller than
42 | # the generated number
43 | elif guess < number:
44 | print("Your guess was too low: Guess a number higher than", guess)
45 |
46 | # The user entered number is
47 | # greater than the generated
48 | # number
49 | else:
50 | print("Your guess was too high: Guess a number lower than", guess)
51 |
52 | # Increase the value of chance by 1
53 | chances += 1
54 |
55 |
--------------------------------------------------------------------------------
/projects/Organized_download_folder_with_different_categories/README.md:
--------------------------------------------------------------------------------
1 | # Files-Sorter
2 | This is python script that sort the files in Download directory to other directories depending on extention.
3 |
--------------------------------------------------------------------------------
/projects/Organized_download_folder_with_different_categories/file-sortor.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shutil
3 | os.chdir("E:\downloads")
4 | #print(os.getcwd())
5 |
6 | #check number of files in directory
7 | files = os.listdir()
8 |
9 | #list of extension (You can add more if you want)
10 | extentions = {
11 | "images": [".jpg", ".png", ".jpeg", ".gif"],
12 | "videos": [".mp4", ".mkv"],
13 | "musics": [".mp3", ".wav"],
14 | "zip": [".zip", ".tgz", ".rar", ".tar"],
15 | "documents": [".pdf", ".docx", ".csv", ".xlsx", ".pptx", ".doc", ".ppt", ".xls"],
16 | "setup": [".msi", ".exe"],
17 | "programs": [".py", ".c", ".cpp", ".php", ".C", ".CPP"],
18 | "design": [".xd", ".psd"]
19 |
20 |
21 | }
22 |
23 |
24 | #sort to specific folder depend on extenstions
25 | def sorting(file):
26 | keys = list(extentions.keys())
27 | for key in keys:
28 | for ext in extentions[key]:
29 | # print(ext)
30 | if file.endswith(ext):
31 | return key
32 |
33 |
34 | #iterat through each file
35 | for file in files:
36 | dist = sorting(file)
37 | if dist:
38 | try:
39 | shutil.move(file, "../download-sorting/" + dist)
40 | except:
41 | print(file + " is already exist")
42 | else:
43 | try:
44 | shutil.move(file, "../download-sorting/others")
45 | except:
46 | print(file + " is already exist")
47 |
48 |
--------------------------------------------------------------------------------
/projects/Python_auto_draw/pyautoguidemo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Python_auto_draw/pyautoguidemo.gif
--------------------------------------------------------------------------------
/projects/Python_auto_draw/python-auto-draw.py:
--------------------------------------------------------------------------------
1 | import pyautogui
2 | import time
3 |
4 | # time to change tabs from editor to paint;
5 | time.sleep(10)
6 |
7 | # it will remain clicked till program ends;
8 | pyautogui.click()
9 |
10 | # can be varied according to convininence
11 | distance = 250
12 |
13 | while distance > 0:
14 | # right
15 | pyautogui.dragRel(distance, 0, duration = 0.1)
16 |
17 | distance -= 5
18 |
19 | # down
20 | pyautogui.dragRel(0, distance, duration = 0.1)
21 |
22 | # left
23 | pyautogui.dragRel(-distance, 0, duration = 0.1)
24 |
25 | distance -= 5
26 |
27 | #up
28 | pyautogui.dragRel(0, -distance, duration = 0.1)
29 |
30 |
--------------------------------------------------------------------------------
/projects/Qr_code_generator/README.md:
--------------------------------------------------------------------------------
1 | # QR code generator using Python
2 | This script take a link of any URL and generate a QR code corresponding to it.
3 |
4 | ## Library Used
5 | * qrcode
6 |
7 | ### To install required external modules
8 | * Run `pip install qrcode`
9 |
10 | ### How to run the script
11 | - Provide your desired URL in the script
12 | - Execute `python3 generate_qrcode.py`
13 |
14 | ### Screenshot/GIF showing the sample use of the script
15 |
16 | 
17 |
--------------------------------------------------------------------------------
/projects/Qr_code_generator/generate_qrcode.py:
--------------------------------------------------------------------------------
1 | import qrcode
2 |
3 | input_URL = "https://www.google.com/"
4 |
5 | qr = qrcode.QRCode(
6 | version=1,
7 | error_correction=qrcode.constants.ERROR_CORRECT_L,
8 | box_size=15,
9 | border=4,
10 | )
11 |
12 | qr.add_data(input_URL)
13 | qr.make(fit=True)
14 |
15 | img = qr.make_image(fill_color="red", back_color="white")
16 | img.save("url_qrcode.png")
17 |
18 | print(qr.data_list)
19 |
--------------------------------------------------------------------------------
/projects/Qr_code_generator/url_qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Qr_code_generator/url_qrcode.png
--------------------------------------------------------------------------------
/projects/Random_Wikipedia_Article/README.md:
--------------------------------------------------------------------------------
1 | # Random Wikipedia Article
2 | An application to save any random article from Wikipedia to a text file.
3 |
4 | Use:
5 | ``` pip install htmlparser``` and ``` pip install beautifulsoup4```
6 |
--------------------------------------------------------------------------------
/projects/Random_Wikipedia_Article/requirements.txt:
--------------------------------------------------------------------------------
1 | HTMLParser==0.0.2
2 |
--------------------------------------------------------------------------------
/projects/Random_Wikipedia_Article/wiki_random.py:
--------------------------------------------------------------------------------
1 | from bs4 import BeautifulSoup
2 | import requests
3 |
4 | # Trying to open a random wikipedia article
5 | # Special:Random opens random articles
6 | res = requests.get("https://en.wikipedia.org/wiki/Special:Random")
7 | res.raise_for_status()
8 |
9 | # pip install htmlparser
10 | wiki = BeautifulSoup(res.text, "html.parser")
11 |
12 | r = open("random_wiki.txt", "w+", encoding='utf-8')
13 |
14 | # Adding the heading to the text file
15 | heading = wiki.find("h1").text
16 |
17 | r.write(heading + "\n")
18 | for i in wiki.select("p"):
19 | # Optional Printing of text
20 | # print(i.getText())
21 | r.write(i.getText())
22 |
23 | r.close()
24 | print("File Saved as random_wiki.txt")
25 |
26 |
--------------------------------------------------------------------------------
/projects/Random_password_generator/README.md:
--------------------------------------------------------------------------------
1 | # Python Password Generator
2 | ##### THIS SIMPLE PROJECT WAS MADE USING PYTHON LIBRARY FUNCTIONS LIKE `string` & `random`.
3 |
4 | * `string.ascii_letters`
5 | - The concatenation of the ascii_lowercase and ascii_uppercase constants described below. This value is not locale-dependent.
6 |
7 | * `string.ascii_lowercase`
8 | - The lowercase letters abcdefghijklmnopqrstuvwxyz. This value is not locale-dependent and will not change.
9 |
10 | * `string.ascii_uppercase`
11 | - The uppercase letters ABCDEFGHIJKLMNOPQRSTUVWXYZ. This value is not locale-dependent and will not change.
12 |
13 | * `string.digits`
14 | - The string 0123456789.
15 |
16 | * `string.hexdigits`
17 | - The string 0123456789abcdefABCDEF.
18 |
19 | * `string.octdigits`
20 | The string 01234567.
21 |
22 | * `string.punctuation`
23 | - String of ASCII characters which are considered punctuation characters in the C locale: `!"#$%&'()*+,-./:;<=>?@[\]^_{|}~`
24 |
--------------------------------------------------------------------------------
/projects/Random_password_generator/python-password-generator.py:
--------------------------------------------------------------------------------
1 | import random
2 | import string
3 |
4 | total = string.ascii_letters + string.digits + string.punctuation
5 |
6 | length = 16
7 |
8 | password = "".join(random.sample(total, length))
9 |
10 | print(password)
11 |
--------------------------------------------------------------------------------
/projects/Random_password_generator/random_password_gen.py:
--------------------------------------------------------------------------------
1 | import random
2 | import math
3 |
4 | alpha = "abcdefghijklmnopqrstuvwxyz"
5 | num = "0123456789"
6 | special = "@#$%&*"
7 |
8 | # pass_len=random.randint(8,13) #without User INput
9 | pass_len = int(input("Enter Password Length"))
10 |
11 | # length of password by 50-30-20 formula
12 | alpha_len = pass_len//2
13 | num_len = math.ceil(pass_len*30/100)
14 | special_len = pass_len-(alpha_len+num_len)
15 |
16 |
17 | password = []
18 |
19 |
20 | def generate_pass(length, array, is_alpha=False):
21 | for i in range(length):
22 | index = random.randint(0, len(array) - 1)
23 | character = array[index]
24 | if is_alpha:
25 | case = random.randint(0, 1)
26 | if case == 1:
27 | character = character.upper()
28 | password.append(character)
29 |
30 |
31 | # alpha password
32 | generate_pass(alpha_len, alpha, True)
33 | # numeric password
34 | generate_pass(num_len, num)
35 | # special Character password
36 | generate_pass(special_len, special)
37 | # suffle the generated password list
38 | random.shuffle(password)
39 | # convert List To string
40 | gen_password = ""
41 | for i in password:
42 | gen_password = gen_password + str(i)
43 | print(gen_password)
44 |
--------------------------------------------------------------------------------
/projects/Random_word_from_list/README.md:
--------------------------------------------------------------------------------
1 | # Random word from list
2 |
3 | This is a useful program that chooses a random word from a given list.
4 |
5 | #### How to run script
6 | ``` bash
7 | python Random_word_from_list.py
8 | ```
9 | Make sure you have a file in the same directory you wish to choose a random word from.
10 |
--------------------------------------------------------------------------------
/projects/Random_word_from_list/Random_word_from_list.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import random
3 |
4 | # check if filename is supplied as a command line argument
5 | if sys.argv[1:]:
6 | filename = sys.argv[1]
7 | else:
8 | filename = input("What is the name of the file? (extension included): ")
9 |
10 | try:
11 | file = open(filename)
12 | except (FileNotFoundError, IOError):
13 | print("File doesn't exist!")
14 | exit()
15 | # handle exception
16 |
17 | # get number of lines
18 | num_lines = sum(1 for line in file if line.rstrip())
19 |
20 | # generate a random number between possible interval
21 | random_line = random.randint(0, num_lines)
22 |
23 | # re-iterate from first line
24 | file.seek(0)
25 |
26 | for i, line in enumerate(file):
27 | if i == random_line:
28 | print(line.rstrip()) # rstrip removes any trailing newlines :)
29 | break
30 |
--------------------------------------------------------------------------------
/projects/Recursive_password_generator/README.md:
--------------------------------------------------------------------------------
1 | # Recursive Password Generator
2 |
3 | Generates a random password with the length specified using recursivity
4 |
5 | ### Prerequisites
6 |
7 | None
8 |
9 | ### How to run the script
10 |
11 | Execute `python3 generator.py`
12 |
13 | ### Screenshot/GIF showing the sample use of the script
14 |
15 | 
16 |
17 | ## *Author Name*
18 |
19 | Erfan Saberi
20 |
--------------------------------------------------------------------------------
/projects/Recursive_password_generator/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Recursive_password_generator/Screenshot.png
--------------------------------------------------------------------------------
/projects/Recursive_password_generator/generator.py:
--------------------------------------------------------------------------------
1 | import random
2 | import string
3 |
4 | def stretch(text,maxlength):
5 | if len(text) < maxlength:
6 | randomChar = get_random_char()
7 | return stretch(text+randomChar,maxlength)
8 | else:
9 | return text
10 |
11 | def get_random_char():
12 | chars = string.printable
13 | randomChar = chars[random.randint(0,len(chars)-1)]
14 | return randomChar
15 |
16 | while 1:
17 | maxlen = input(' [?] Enter a length for your password (e for exit): ')
18 | try:
19 | maxlength = int(maxlen)
20 | print("'",stretch('',maxlength),"'\n")
21 | except:
22 | if maxlen == 'e':
23 | break
24 | print('Please Enter an integer')
25 |
--------------------------------------------------------------------------------
/projects/Reduce_image_file_size/README.md:
--------------------------------------------------------------------------------
1 | # Script Title
2 | #### Script to reduce the size of image file using the openCV library of python.
3 |
4 | ### Prerequisites
5 | openCV library
6 |
7 | `pip install opencv-python`
8 |
9 | ### How to run the script
10 | - Add the image in jpg format with name as 'input.jpg' in this folder.
11 | - Run reduce_image_size.py script.
12 | - resized output image will be generated in this folder.
13 |
14 | ## *Author Name*
15 | ### *Vipul Verma*
16 |
--------------------------------------------------------------------------------
/projects/Reduce_image_file_size/input.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Reduce_image_file_size/input.jpg
--------------------------------------------------------------------------------
/projects/Reduce_image_file_size/reduce_image_size.py:
--------------------------------------------------------------------------------
1 | # import openCV library for image handling
2 | import cv2
3 |
4 | # read image to be resized by imread() function of openCV library
5 | img = cv2.imread('input.jpg')
6 | print(img.shape)
7 |
8 | # set the ratio of resized image
9 | k = 5
10 | width = int((img.shape[1])/k)
11 | height = int((img.shape[0])/k)
12 |
13 | # resize the image by resize() function of openCV library
14 | scaled = cv2.resize(img, (width, height), interpolation=cv2.INTER_AREA)
15 | print(scaled.shape)
16 |
17 | # show the resized image using imshow() function of openCV library
18 | cv2.imshow("Output", scaled)
19 | cv2.waitKey(500)
20 | cv2.destroyAllWindows()
21 |
22 | # get the resized image output by imwrite() function of openCV library
23 | cv2.imwrite('resized_output_image.jpg', scaled)
24 |
--------------------------------------------------------------------------------
/projects/Reduce_image_file_size/resized_output_image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Reduce_image_file_size/resized_output_image.jpg
--------------------------------------------------------------------------------
/projects/RockPaperScissors_Game/README.md:
--------------------------------------------------------------------------------
1 | ## A Simple Rock Paper Scissors Game:
2 | ##### To be Played with a Computer.
3 | * You can enter the number of games you want to play.
4 | * There is also a score window which is displayed after every turn.
5 |
6 | ### Example Game:
7 | 
8 |
--------------------------------------------------------------------------------
/projects/RockPaperScissors_Game/Rock_Paper_Scissors_Game.py:
--------------------------------------------------------------------------------
1 | #START;
2 |
3 | import random
4 |
5 | #DEFAULT;
6 | my_dict={'R':"Rock",'P':"Paper",'S':"Scissors"}
7 | user_count=0
8 | comp_count=0
9 |
10 | #INPUT;
11 | games=int(input("\nEnter the number of games you want to play: "))
12 |
13 | while(comp_count+user_countcomp_count:
52 | print("\n\tCONGRATULATIONS! YOU WON!")
53 | elif user_count
14 | 
15 |
16 | ## Author Name
17 | Anandha Krishnan Aji
--------------------------------------------------------------------------------
/projects/Scrape_quotes/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Scrape_quotes/Screenshot.png
--------------------------------------------------------------------------------
/projects/Scrape_quotes/quote_scraper.py:
--------------------------------------------------------------------------------
1 | from bs4 import BeautifulSoup
2 | import requests
3 | import csv
4 |
5 | # URL to the website
6 | url='http://quotes.toscrape.com'
7 |
8 | # Getting the html file and parsing with html.parser
9 | html=requests.get(url)
10 | bs=BeautifulSoup(html.text,'html.parser')
11 |
12 | # Tries to open the file
13 | try:
14 | csv_file=open('quote_list.csv','w')
15 | fieldnames=['quote','author','tags']
16 | dictwriter=csv.DictWriter(csv_file,fieldnames=fieldnames)
17 |
18 | # Writes the headers
19 | dictwriter.writeheader()
20 |
21 | #While next button is found in the page the loop runs
22 | while True:
23 | # Loops through quote in the page
24 | for quote in bs.findAll('div',{'class':'quote'}):
25 | #Extract the text part of quote, author and tags
26 | text=quote.find('span',{'class':'text'}).text
27 | author=quote.find('small',{'class':'author'}).text
28 | tags=[]
29 | for tag in quote.findAll('a',{'class':'tag'}):
30 | tags.append(tag.text)
31 | #Writes the current quote,author and tags to a csv file
32 | dictwriter.writerow({'quote':text,'author':author,'tags':tags})
33 |
34 | #Finds the link to next page
35 | next=bs.find('li',{'class':'next'})
36 | if not next:
37 | break
38 |
39 | #Gets and parses the html file of next page
40 | html=requests.get(url+next.a.attrs['href'])
41 | bs=BeautifulSoup(html.text,'html.parser')
42 | except:
43 | print('Unknown Error!!!')
44 | finally:
45 | csv_file.close()
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/projects/Scrape_quotes/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4
2 | requests==2.23.0
3 |
--------------------------------------------------------------------------------
/projects/Scraping Medium Articles/README.md:
--------------------------------------------------------------------------------
1 | # Scraping Medium Articles
2 | Well [Medium](https://medium.com/) is a website containing great articles and used by many programmers.
3 |
This script asks the user for the url of a medium article, scrapes it's text and saves it to a text file into a folder named scraped_articles in the same directory.
4 |
There are 3 text files in the folder scraped_articles as an example of how the article is scraped.
5 |
6 | ### Prerequisites
7 | `pip` install the modules given in requirements.txt
8 |
Have a working network connection on the device
9 |
10 | ### How to run the script
11 | Run it like any other python file
12 |
13 | ## *Author Name*
14 | [Naman Shah](https://github.com/namanshah01)
15 |
--------------------------------------------------------------------------------
/projects/Scraping Medium Articles/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4==4.9.1
2 | requests==2.23.0
3 |
--------------------------------------------------------------------------------
/projects/Send_email_from_csv/Readme.md:
--------------------------------------------------------------------------------
1 | # Send Emails from CSV File
2 |
3 | This project contains a simple bulk email script
4 | which sends the same message to a list of recipients.
5 |
6 |
7 | ## Dependencies
8 |
9 | This project only requires the Python standard library
10 | (more specifically, the `csv`, `email`, and `smtplib` modules).
11 |
12 |
13 | ## Running the script
14 |
15 | The script requires two configuration files:
16 |
17 | * `emails.csv` should contain the email addresses to send the message to.
18 | * `credentials.txt` should contain your SMTP server login credentials,
19 | with your user name and your password on sepate lines,
20 | with no additional whitespace or other decorations.
21 |
22 | The project's directory contains two example files which you'll
23 | probably both want and need to edit.
24 |
25 | Once you have these files set up, simply
26 |
27 | ```
28 | python Send_emails.py
29 | ```
30 |
31 |
32 | ## Development ideas
33 |
34 | A proper email sender would use `Cc:` or `Bcc:` and send the same
35 | message just once.
36 |
37 | Don't play frivolously with this; your email provider,
38 | and/or the recipient's,
39 | may have automatic filters which quickly block anyone who sends
40 | multiple identical messages.
41 |
42 | The script simply hardcodes the conventions for Gmail.com.
43 | Other providers may use a different port number and authentication regime.
44 |
--------------------------------------------------------------------------------
/projects/Send_email_from_csv/Sending_mail.py:
--------------------------------------------------------------------------------
1 | import csv
2 | from email.message import EmailMessage
3 | import smtplib
4 |
5 |
6 | def get_credentials(filepath):
7 | with open("credentials.txt", "r") as f:
8 | email_address = f.readline()
9 | email_pass = f.readline()
10 | return (email_address, email_pass)
11 |
12 |
13 | def login(email_address, email_pass, s):
14 | s.ehlo()
15 | # start TLS for security
16 | s.starttls()
17 | s.ehlo()
18 | # Authentication
19 | s.login(email_address, email_pass)
20 | print("login")
21 |
22 |
23 | def send_mail():
24 | s = smtplib.SMTP("smtp.gmail.com", 587)
25 | email_address, email_pass = get_credentials("./credentials.txt")
26 | login(email_address, email_pass, s)
27 |
28 | # message to be sent
29 | subject = "Welcome to Python"
30 | body = """Python is an interpreted, high-level,
31 | general-purpose programming language.\n
32 | Created by Guido van Rossum and first released in 1991,
33 | Python's design philosophy emphasizes code readability\n
34 | with its notable use of significant whitespace"""
35 |
36 | message = EmailMessage()
37 | message.set_content(body)
38 | message['Subject'] = subject
39 |
40 | with open("emails.csv", newline="") as csvfile:
41 | spamreader = csv.reader(csvfile, delimiter=" ", quotechar="|")
42 | for email in spamreader:
43 | s.send_message(email_address, email[0], message)
44 | print("Send To " + email[0])
45 |
46 | # terminating the session
47 | s.quit()
48 | print("sent")
49 |
50 |
51 | if __name__ == "__main__":
52 | send_mail()
53 |
--------------------------------------------------------------------------------
/projects/Send_email_from_csv/credentials.txt:
--------------------------------------------------------------------------------
1 | YourEmail
2 | Yourpass
--------------------------------------------------------------------------------
/projects/Send_email_from_csv/emails.csv:
--------------------------------------------------------------------------------
1 | mithilesh24m@gmail.com
2 | mithilesh24m@gmail.com
3 | mithilesh24m@gmail.com
4 | mithilesh24m@gmail.com
5 |
--------------------------------------------------------------------------------
/projects/Set_Alarm/README.md:
--------------------------------------------------------------------------------
1 | # Set Alarm
2 |
3 | This script lets you set an alarm and plays your selected music after the selected time.
4 | **THIS SCRIPT ONLY WORKS ON WINDOWS**
5 |
6 | ### Usage
7 | ```
8 | $ python alarm.py
9 | ```
10 |
11 | ### Sample output
12 | ```
13 | $ python3 alarm.py
14 |
15 | ###########################
16 | ###### Alarm Program ######
17 | ###########################
18 |
19 | Set the alarm time (e.g. 01:10): 00:01
20 |
21 | Select any alarm music:
22 |
23 | 1. The Four Seasons
24 | 2. Carnival
25 | 3. Renaissance
26 | 4. Variations
27 | 5. Dreamy Nights
28 | 6. Lakhau Hajarau
29 | 7. New Horizon
30 | 8. Crusade
31 | 9. Mozart Wakes
32 | 10. Morning Calm
33 |
34 |
35 | Enter the index of the listed musics (e.g. 1): 1
36 | >> Alarm music has been set --> The Four Seasons
37 |
38 | >>> Alarm has been set successfully for 00:01! Please dont close the program! <<<
39 | ```
40 |
41 | ## *Author Name*
42 |
43 | [Kai Reichart](https://github.com/KaiReichart)
44 |
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/Carnival.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/Carnival.ogg
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/Crusade.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/Crusade.ogg
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/Renaissance.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/Renaissance.ogg
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/Variations.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/Variations.ogg
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/dreamy_nights.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/dreamy_nights.ogg
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/lakhau_hajarau.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/lakhau_hajarau.mp3
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/morning_calm.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/morning_calm.ogg
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/mozart_wakes.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/mozart_wakes.ogg
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/new_horizon.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/new_horizon.ogg
--------------------------------------------------------------------------------
/projects/Set_Alarm/musics/the_four_seasons.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Set_Alarm/musics/the_four_seasons.ogg
--------------------------------------------------------------------------------
/projects/Shutdown_or_restart_your_device/PowerOptions.py:
--------------------------------------------------------------------------------
1 | import os
2 | import platform
3 |
4 | def shutdown():
5 | if platform.system() == "Windows":
6 | os.system('shutdown -s')
7 | elif platform.system() == "Linux" or platform.system() == "Darwin":
8 | os.system("shutdown -h now")
9 | else:
10 | print("Os not supported!")
11 |
12 | def restart():
13 | if platform.system() == "Windows":
14 | os.system("shutdown -t 0 -r -f")
15 | elif platform.system() == "Linux" or platform.system() == "Darwin":
16 | os.system('reboot now')
17 | else:
18 | print("Os not supported!")
19 |
20 |
21 | command = input("Use \'r\' for restart and \'s\' for shutdown: ").lower()
22 |
23 | if command == "r":
24 | restart()
25 | elif command == "s":
26 | shutdown()
27 | else:
28 | print("Wrong letter")
29 |
--------------------------------------------------------------------------------
/projects/Shutdown_or_restart_your_device/README.md:
--------------------------------------------------------------------------------
1 | # Power Options
2 |
3 | This script shuts down or restarts your computer
4 |
5 | ### Prerequisites
6 |
7 | None
8 |
9 | ### How to run the script
10 |
11 | Steps on how to run the script along with suitable examples.
12 | 1. Type the following on the command line:
13 | python PowerOptions.py
14 |
15 | 2. Press enter and wait for prompt. Type “r” to restart or “s” to shut down
16 |
17 | Example:
18 | python PowerOptions.py
19 | Use 'r' for restart and 's' for shutdown: r
20 |
21 | ### Screenshot/GIF showing the sample use of the script
22 |
23 | python PowerOptions.py
24 | Use 'r' for restart and 's' for shutdown: r
25 |
26 | ## *Author Name*
27 |
28 | Hannah Machado
29 |
30 |
--------------------------------------------------------------------------------
/projects/Snapshot_of_given_website/README.md:
--------------------------------------------------------------------------------
1 | # snapshot of given website
2 |
3 | ## Set up
4 | `pip install selenium`
5 | `pip install chromedriver-binary==XX.X.XXXX.XX.X`
6 |
7 | - 'XX.X.XXXX.XX.X' is chrome driver version.
8 | - The version of 'chrome driver' need to match the version of your google chrome.
9 |
10 | *How to find your google chrome version*
11 | 1. Click on the Menu icon in the upper right corner of the screen.
12 | 2. Click on Help, and then About Google Chrome.
13 | 3. Your Chrome browser version number can be found here.
14 |
15 |
16 | ## Execute
17 | `python snapshot_of_given_website.py `
18 | Snapshot is in current directory after this script runs.
19 |
--------------------------------------------------------------------------------
/projects/Snapshot_of_given_website/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium==3.141.0
2 | chromedriver-binary==85.0.4183.38.0
3 |
--------------------------------------------------------------------------------
/projects/Snapshot_of_given_website/snapshot_of_given_website.py:
--------------------------------------------------------------------------------
1 | # -*- cofing: utf-8 -*-
2 | import sys
3 | from selenium import webdriver
4 | from selenium.webdriver.chrome.options import Options
5 | import chromedriver_binary
6 |
7 |
8 | script_name = sys.argv[0]
9 |
10 | options = Options()
11 | options.add_argument('--headless')
12 | driver = webdriver.Chrome(options=options)
13 |
14 | try:
15 | url = sys.argv[1]
16 |
17 | driver.get(url)
18 | page_width = driver.execute_script('return document.body.scrollWidth')
19 | page_height = driver.execute_script('return document.body.scrollHeight')
20 | driver.set_window_size(page_width, page_height)
21 | driver.save_screenshot('screenshot.png')
22 | driver.quit()
23 | print("SUCCESS")
24 |
25 | except IndexError:
26 | print('Usage: %s URL' % script_name)
--------------------------------------------------------------------------------
/projects/Speech_to_text/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Speech-to-Text Converter
3 |
4 | This Python script converts the Speech input into Text using NLP(Natural Langauge Processing).
5 |
6 | ### Requirements
7 |
8 | **Installation Required** :
9 |
10 | Python Speech Recognition module:
11 |
12 | `pip install speechrecognition`
13 |
14 | PyAudio: Use the following command for linux users
15 |
16 | `sudo apt-get install python3-pyaudio`
17 |
18 | Windows users can install pyaudio by executing the following command in a terminal
19 |
20 | `pip install pyaudio`
21 |
22 | Python pyttsx3 module:
23 |
24 | `pip install pyttsx3`
25 |
26 | ### How to run the script
27 |
28 |
29 | - Enter the audio input by speaking into the microphone.
30 | - Run converter_terminal.py script
31 | - Output Text will be displayed
32 |
33 |
34 | ## *Author Name*
35 |
36 | Devansh Agarwal
37 |
38 |
--------------------------------------------------------------------------------
/projects/Speech_to_text/requirements.txt:
--------------------------------------------------------------------------------
1 | PyAudio==0.2.11
2 | SpeechRecognition==3.8.1
3 |
--------------------------------------------------------------------------------
/projects/Speech_to_text/speech_to_text.py:
--------------------------------------------------------------------------------
1 | import speech_recognition
2 |
3 | def record_voice():
4 | microphone = speech_recognition.Recognizer()
5 |
6 | with speech_recognition.Microphone() as live_phone:
7 | microphone.adjust_for_ambient_noise(live_phone)
8 |
9 | print("I'm trying to hear you: ")
10 | audio = microphone.listen(live_phone)
11 | try:
12 | phrase = microphone.recognize_google(audio, language='en')
13 | return phrase
14 | except speech_recognition.UnkownValueError:
15 | return "I didn't understand what you said"
16 |
17 | if __name__ == '__main__':
18 | phrase = record_voice()
19 |
20 | with open('you_said_this.txt','w') as file:
21 | file.write(phrase)
22 |
23 | print('the last sentence you spoke was saved in you_said_this.txt')
24 |
--------------------------------------------------------------------------------
/projects/Spell_checker/README.md:
--------------------------------------------------------------------------------
1 | # Script Title
2 |
3 | Here, you can input any word and check if it is having a correct spelling or not.
4 |
5 | ### Prerequisites
6 |
7 | First thing which you need to install is textblob library
8 |
9 | >pip install textblob
10 |
11 | You need to run this command in your terminal or your ide terminal.
12 |
13 | If you are using Jupyter Notebook you need to use the below command
14 |
15 | >import sys
16 |
17 | >!{sys.executable} -m pip install textblob
18 |
19 | ### How to run the script
20 |
21 | You can first install the textblob library and then you can run the python script.
22 |
23 | ## *Author Name*
24 |
25 | [Hariom1509](https://github.com/Hariom1509)
26 |
--------------------------------------------------------------------------------
/projects/Spell_checker/spell_checker.py:
--------------------------------------------------------------------------------
1 | from textblob import TextBlob # importing textblob library
2 |
3 | t = 1
4 | while t:
5 | a = input("Enter the word to be checked:- ") # incorrect spelling
6 | print("original text: "+str(a)) #printing original text
7 |
8 | b = TextBlob(a) #correcting the text
9 |
10 | # prints the corrected spelling
11 | print("corrected text: "+str(b.correct()))
12 | t = int(input("Try Again? 1 : 0 "))
13 |
--------------------------------------------------------------------------------
/projects/Split_File/README.md:
--------------------------------------------------------------------------------
1 | # Split Files
2 | ##### About
3 | This accepts split index and file name than spilts it according to the index provided.
4 |
5 | ### Prerequisites
6 | To execute this script python must be installed the host system.
7 |
8 | ### How to run the script
9 | just type this in the terminal:-
10 | `python split_files.py `
11 |
12 | ## *Author Name*
13 | Kanishk Gupta
14 |
--------------------------------------------------------------------------------
/projects/Split_File/requirements.txt:
--------------------------------------------------------------------------------
1 | pandas==1.1.0
2 |
--------------------------------------------------------------------------------
/projects/Split_a_video_file_by_given_time_period/README.md:
--------------------------------------------------------------------------------
1 | ## split a video file by given time period
2 |
3 | This script will split the video into two files when valid time periods are given.
4 |
5 |
6 | ### Requirements
7 | Install python in the host system
8 | Install [ffmpeg-python](https://github.com/kkroening/ffmpeg-python)
9 |
10 | ```
11 | pip install ffmpeg-python
12 | ```
13 |
14 | ### usage
15 |
16 | ```python
17 | python videosplitter.py test.mp4 0 50 out1.mp4 out2.mp4
18 | ```
19 | OR
20 |
21 | ```python
22 | python videosplitter.py -h
23 | ```
24 |
25 |
--------------------------------------------------------------------------------
/projects/Split_a_video_file_by_given_time_period/requirements.txt:
--------------------------------------------------------------------------------
1 | ffmpeg==1.4
2 |
--------------------------------------------------------------------------------
/projects/Split_a_video_file_by_given_time_period/videosplitter.py:
--------------------------------------------------------------------------------
1 | import ffmpeg
2 | import argparse
3 |
4 |
5 | parser = argparse.ArgumentParser(description='''Split A media file
6 | into two chunks''')
7 | parser.add_argument('inputfile', help="Input filename")
8 | parser.add_argument('starttime', type=float, help="Start time in seconds")
9 | parser.add_argument('endtime', type=float, help="End time in seconds")
10 | parser.add_argument('outputfile1', help="Output filename")
11 | parser.add_argument('outputfile2', help="Output filename")
12 |
13 | args = parser.parse_args()
14 |
15 | in1 = ffmpeg.input(args.inputfile)
16 |
17 | v1 = in1.filter('trim', start=float(args.starttime), end=(args.endtime))
18 | v2 = in1.filter('trim', start=float(args.endtime))
19 |
20 | out1 = ffmpeg.output(v1, args.outputfile1)
21 | out2 = ffmpeg.output(v2, args.outputfile2)
22 |
23 | out1.run()
24 | out2.run()
25 |
--------------------------------------------------------------------------------
/projects/Split_folder_into_subfolders/Readme.md:
--------------------------------------------------------------------------------
1 | ## Split folder into subfolders
2 |
3 | ### Execute
4 | python
5 |
--------------------------------------------------------------------------------
/projects/Split_folder_into_subfolders/split_and_copy.py:
--------------------------------------------------------------------------------
1 | import glob
2 | import os
3 | from shutil import copy2
4 | import sys
5 |
6 |
7 | def get_files(path):
8 | '''
9 | return a list of files avialable in given folder
10 | '''
11 | files = glob.glob(f'{path}/*')
12 | return files
13 |
14 |
15 | def getfullpath(path):
16 | '''
17 | Return absolute path of given file
18 | '''
19 | return os.path.abspath(path)
20 |
21 |
22 | def copyfiles(src, dst):
23 | '''
24 | This function copy file from src to dst
25 | if dst dir is not there it will create new
26 | '''
27 | if not os.path.isdir(dst):
28 | os.makedirs(dst)
29 | copy2(src, dst)
30 |
31 |
32 | def split(data, count):
33 | '''
34 | Split Given list of files and return generator
35 | '''
36 | for i in range(1, len(data), count):
37 | if i + count-1 > len(data):
38 | start, end = (i-1, len(data))
39 | else:
40 | start, end = (i-1, i+count-1)
41 | yield data[start:end]
42 |
43 |
44 | def start_process(path, count):
45 | files = get_files(path)
46 | splited_data = split(files, count)
47 |
48 | for idx, folder in enumerate(splited_data):
49 | name = f'data_{idx}'
50 | for file in folder:
51 | copyfiles(getfullpath(file), getfullpath(name))
52 |
53 |
54 | if __name__ == "__main__":
55 | '''
56 | driver code
57 | To run this script
58 | python split_and_copy.py <20>
59 | '''
60 |
61 | if len(sys.argv) != 3:
62 | print("Please provide correct parameters \
63 | \npython split_and_copy.py ")
64 | sys.exit(0)
65 |
66 | if len(sys.argv) == 3:
67 | path = sys.argv[1]
68 | if os.path.isdir(path):
69 | count = sys.argv[2]
70 | start_process(path, int(count))
71 | else:
72 | print('Given directory name is not an valid directory')
73 | else:
74 | print('Wrong paramter are provided')
75 |
--------------------------------------------------------------------------------
/projects/Store_emails_in_csv/README.md:
--------------------------------------------------------------------------------
1 | # Store mails in your inbox in csv format
2 |
3 | 1)This script takes your email and password as input.
4 |
5 | 2)Return a csv containing following attributes:
6 |
7 | -Date
8 |
9 | -From(Sender)
10 |
11 | -Subject
12 |
13 | -Mail Text
14 |
15 |
16 | ## Prerequisites
17 |
18 | You only need Python to run this script. You can visit [here](https://www.python.org/downloads/) to download Python.
19 |
20 |
21 | ## How to run the script
22 |
23 | Running the script is really simple! Just open a terminal in the folder where your script is located and run the following command :
24 |
25 | `pip install -r requirements.txt`
26 | `python store_emails.py`
27 |
28 |
29 | ## *Author Name*
30 |
31 | gpriya32(Priyanka)
32 |
--------------------------------------------------------------------------------
/projects/Store_emails_in_csv/credentials.txt:
--------------------------------------------------------------------------------
1 | yourEmailID
2 | yourPassword
--------------------------------------------------------------------------------
/projects/Store_emails_in_csv/mails.csv:
--------------------------------------------------------------------------------
1 | Date,From,Subject,Text mail
2 | "Mon, 10 Aug 2020 13:24:18 +0530",Sachin Raina ,For testing emails fetching from python imaplib and email libraries ,"Hi, this is body text and i am alson attaching an attachment.
3 | Thanks"
4 | "Mon, 10 Aug 2020 05:32:03 +0000","""shivguddu@ymail.com"" ",Testing purposes,"Hi check if you are able to get plain text out of thia one.
5 | Thanks"
6 |
--------------------------------------------------------------------------------
/projects/Store_emails_in_csv/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4
2 |
--------------------------------------------------------------------------------
/projects/String_search_from_multiple_files/README.md:
--------------------------------------------------------------------------------
1 |
2 | # String search from multiple files
3 | Finds a file with the inputted string in the specified folder of your choice.
4 |
5 | ### Prerequisites
6 | Python3 is the only prerequisites! No external modules are needed to run.
7 |
8 | ### How to run the script
9 | In order to run this script you must have Python3 installed, not Python2. The command to run this is simply `python3 findstring.py`, and you'll be prompted with two questions, the string to search, and where to look.
10 |
11 | ### Screenshot/GIF showing the sample use of the script
12 | 
13 |
14 | ## *Author Name*
15 | README: [Alex Munoz](https://github.com/AlexMunoz905)
16 |
--------------------------------------------------------------------------------
/projects/String_search_from_multiple_files/files/file1.txt:
--------------------------------------------------------------------------------
1 | this is file one
2 | this is file one this is file one this is file one this is file one this is file one this is file one
--------------------------------------------------------------------------------
/projects/String_search_from_multiple_files/files/file2.txt:
--------------------------------------------------------------------------------
1 | this is file two
--------------------------------------------------------------------------------
/projects/String_search_from_multiple_files/files/file3.txt:
--------------------------------------------------------------------------------
1 | this is file three
--------------------------------------------------------------------------------
/projects/String_search_from_multiple_files/files/folder1/hello.txt:
--------------------------------------------------------------------------------
1 | this is hello world
--------------------------------------------------------------------------------
/projects/String_search_from_multiple_files/files/folder1/python.txt:
--------------------------------------------------------------------------------
1 | this is python file
2 | learn python
--------------------------------------------------------------------------------
/projects/String_search_from_multiple_files/findstring.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | text = input("input text : ")
4 |
5 | path = input("path : ")
6 |
7 | # os.chdir(path)
8 |
9 |
10 | def getfiles(path):
11 | f = 0
12 | os.chdir(path)
13 | files = os.listdir()
14 | # print(files)
15 | for file_name in files:
16 | abs_path = os.path.abspath(file_name)
17 | if os.path.isdir(abs_path):
18 | getfiles(abs_path)
19 | if os.path.isfile(abs_path):
20 | f = open(file_name, "r")
21 | if text in f.read():
22 | f = 1
23 | print(text + " found in ")
24 | final_path = os.path.abspath(file_name)
25 | print(final_path)
26 | return True
27 |
28 | if f == 1:
29 | print(text + " not found! ")
30 | return False
31 |
32 |
33 | getfiles(path)
34 |
--------------------------------------------------------------------------------
/projects/Terminal_Based_Hangman_Game/README.md:
--------------------------------------------------------------------------------
1 | ## Script Title
2 | This project contains a simple python script to play terminal-based hangman game.
3 |
4 | ## Prerequisites
5 | None
6 |
7 | ## How to run the script
8 | - Run the hangman.py script.
9 | - Start to guess the word.
10 |
11 | ## Author Name
12 | Neoh Boon Yee
13 |
--------------------------------------------------------------------------------
/projects/Terminal_progress_bar_with_images_resizing/Readme.md:
--------------------------------------------------------------------------------
1 | # Terminal Progress bar with image Resizing
2 |
3 | Here I just take example of image resizing for displaying progress bar.
4 | when we convert lots of images at time we can use progress bar to show how many images are resized.
5 |
6 | ### For this purpose I am using tqdm librabry
7 | ` pip install tqdm `
8 |
9 | This Library is for showing progress bar
10 |
11 | ### For Resizing images
12 | ` pip install Pillow `
--------------------------------------------------------------------------------
/projects/Terminal_progress_bar_with_images_resizing/progress_bar_ with_images_resizing.py:
--------------------------------------------------------------------------------
1 | from tqdm import tqdm
2 | from PIL import Image
3 | import os
4 | from time import sleep
5 |
6 |
7 | def Resize_image(size, image):
8 | if os.path.isfile(image):
9 | try:
10 | im = Image.open(image)
11 | im.thumbnail(size, Image.ANTIALIAS)
12 | im.save("resize/" + str(image) + ".jpg")
13 | except Exception as ex:
14 | print(f"Error: {str(ex)} to {image}")
15 |
16 |
17 | path = input("Enter Path to images : ")
18 | size = input("Size Height , Width : ")
19 | size = tuple(map(int, size.split(",")))
20 |
21 | os.chdir(path)
22 |
23 | list_images = os.listdir(path)
24 | if "resize" not in list_images:
25 | os.mkdir("resize")
26 |
27 | for image in tqdm(list_images, desc="Resizing Images"):
28 | Resize_image(size, image)
29 | sleep(0.1)
30 | print("Resizing Completed!")
31 |
--------------------------------------------------------------------------------
/projects/Terminal_progress_bar_with_images_resizing/requirements.txt:
--------------------------------------------------------------------------------
1 | tqdm==4.48.2
2 | PIL==1.1.6
3 |
--------------------------------------------------------------------------------
/projects/Text_to_speech/README.md:
--------------------------------------------------------------------------------
1 | # txtToSpeech.py
2 |
3 | When executed the text from abc.txt will be turned into an mp3, saved and then played on your device.
4 |
5 | ### Prerequisites
6 | - abc.txt with your text
7 | - the gTTS==2.1.1 module (pip install gTTS to download)
8 | - the os module (pip install os)
9 |
10 | ### How to run the script
11 | Write your desired text into the abc.txt file
12 | then execute the txtToSpeech.py file. This can be
13 | done by typing 'python txtToSpeech.py' into your Terminal.
14 |
15 |
16 | ## *Author Name*
17 | Simon Hanrath
18 |
--------------------------------------------------------------------------------
/projects/Text_to_speech/abc.txt:
--------------------------------------------------------------------------------
1 | Thanks to Gail Cleaver, Beth Barrack, Bingo Nightly, Emily Webber and Sharon Counts. Finally, special thanks to Casey Cromwell. Radio Lab is produced by WNYC New York public radio, and distributed by NPR, National Public Radio.
--------------------------------------------------------------------------------
/projects/Text_to_speech/requirements.txt:
--------------------------------------------------------------------------------
1 | gTTS==2.1.1
2 |
--------------------------------------------------------------------------------
/projects/Text_to_speech/txtToSpeech.py:
--------------------------------------------------------------------------------
1 | from gtts import gTTS
2 | import os
3 | file = open("abc.txt", "r").read()
4 |
5 | speech = gTTS(text=file, lang='en', slow=False)
6 | speech.save("voice.mp3")
7 | os.system("voice.mp3")
8 |
9 | #print(file)
--------------------------------------------------------------------------------
/projects/Text_to_speech/voice.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Text_to_speech/voice.mp3
--------------------------------------------------------------------------------
/projects/Textfile_analysis/README.md:
--------------------------------------------------------------------------------
1 | # Textfile analysis
2 | ##### Execute
3 | `python textfile_analysis.py `
4 |
--------------------------------------------------------------------------------
/projects/Textfile_analysis/textfile_analysis.py:
--------------------------------------------------------------------------------
1 | # -*- cofing: utf-8 -*-
2 | import os
3 | import sys
4 | import collections
5 | import string
6 | import re
7 |
8 | script_name = sys.argv[0]
9 |
10 | res = {
11 | "total_lines":"",
12 | "total_characters":"",
13 | "total_words":"",
14 | "unique_words":"",
15 | "special_characters":""
16 | }
17 |
18 | try:
19 | textfile = sys.argv[1]
20 | with open(textfile, "r", encoding = "utf_8") as f:
21 |
22 | data = f.read()
23 | res["total_lines"] = data.count(os.linesep)
24 | res["total_characters"] = len(data.replace(" ","")) - res["total_lines"]
25 | counter = collections.Counter(data.split())
26 | d = counter.most_common()
27 | res["total_words"] = sum([i[1] for i in d])
28 | res["unique_words"] = len([i[0] for i in d])
29 | special_chars = string.punctuation
30 | res["special_characters"] = sum(v for k, v in collections.Counter(data).items() if k in special_chars)
31 |
32 | except IndexError:
33 | print('Usage: %s TEXTFILE' % script_name)
34 | except IOError:
35 | print('"%s" cannot be opened.' % textfile)
36 |
37 | print(res)
--------------------------------------------------------------------------------
/projects/Tic_tac_toe/README.md:
--------------------------------------------------------------------------------
1 | ## Description:
2 |
3 | A python based 2 player Tic Tac Toe game. It takes input for the respective x and y coordinates of the two players.. The two players are named as X and O and will enter their desired coordinates alternatively to win the game.
4 |
5 |
6 | ## Prerequisites:
7 |
8 | Use any python online compiler of download python IDE from https://www.python.org/
9 |
10 | ## How to run:
11 |
12 | `Just run tic_tac_toe.py`
13 |
14 | ## Screenshots/Demo:
15 |
16 | ## Author:
17 |
18 | Akashdt
19 |
--------------------------------------------------------------------------------
/projects/Tic_tac_toe_with_ai/.replit:
--------------------------------------------------------------------------------
1 | language = "python3"
2 | run = "python tic-tac-toe-AI.py"
3 |
--------------------------------------------------------------------------------
/projects/Tic_tac_toe_with_ai/README.md:
--------------------------------------------------------------------------------
1 | # Tic-Tac-Toe-AI
2 |
3 | [](https://repl.it/github/tusharnankani/Tic-Tac-Toe-AI)
4 |
5 | Adding a simple AI to the Tic-Tac-Toe Game:
6 |
7 | ## 3 modes:
8 | - Player vs. Player (2 - player mode)
9 | - Player vs. AI (1 - player mode)
10 | - AI vs. AI (*for fun*)
11 |
12 | ### To view this project on a live terminal:
13 | - Click [here.](https://repl.it/github/tusharnankani/Tic-Tac-Toe-AI)
14 | - And then, click on Run!
15 |
16 |
17 | ## *References*
18 | #### *Logic*
19 | - Optimal Tic Tac Toe Moves
20 |
21 |
22 | 
23 |
24 | - Videos:
25 | - [Tic Tac Toe - Never Lose (Usually Win)](https://www.youtube.com/watch?v=5n2aQ3UQu9Y&feature=youtu.be)
26 | - [Tic Tac Toe AI with Minimax Algorithm](https://www.youtube.com/watch?v=trKjYdBASyQ&feature=youtu.be)
27 | - [Minimax Algorithm in Game Theory](https://www.geeksforgeeks.org/minimax-algorithm-in-game-theory-set-1-introduction/)
28 | - [Algorithms Explained – minimax and alpha-beta pruning](https://www.youtube.com/watch?v=l-hh51ncgDI)
29 |
30 |
31 | ## DEMO:
32 | #### The board will be printed out every time a player makes a move.
33 | The board will look like this!
34 | The positions of this 3 x 3 board is same as the **keypad on the right side of your key board**.
35 |
36 |
37 | #### You just have to input the position(1-9).
38 | 
39 |
40 |
41 | # *Author*:
42 | - Tushar Nankani (tusharnankani, tusharnankani3@gmail.com)
43 | - [Github](https://www.github.com/tusharnankani)
44 | - [LinkedIn](https://www.linkedin.com/in/tusharnankani)
--------------------------------------------------------------------------------
/projects/Tic_tac_toe_with_ai/tic_tac_toe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Tic_tac_toe_with_ai/tic_tac_toe.png
--------------------------------------------------------------------------------
/projects/Time_to_load_website/README.md:
--------------------------------------------------------------------------------
1 | ## Time to load website
2 |
3 | This script takes a url from the user and returns the time taken to load that website.
4 |
5 | ## How to use this ?
6 |
7 | 1. Just type the following on the command prompt:
8 |
9 | python time_to_load_website.py
10 |
11 | 2. It will reuest you to provide a url. Provide the url and hit enter to see the script in action.
12 |
13 | ## Sample use:
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/projects/Time_to_load_website/sample.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Time_to_load_website/sample.PNG
--------------------------------------------------------------------------------
/projects/Time_to_load_website/time_to_load_website.py:
--------------------------------------------------------------------------------
1 | from urllib.request import urlopen
2 | import time
3 |
4 |
5 | def get_load_time(url):
6 | """This function takes a user defined url as input
7 | and returns the time taken to load that url in seconds.
8 |
9 | Args:
10 | url (string): The user defined url.
11 |
12 | Returns:
13 | time_to_load (float): The time taken to load the website in seconds.
14 | """
15 |
16 | if ("https" or "http") in url: # Checking for presence of protocols
17 | open_this_url = urlopen(url) # Open the url as entered by the user
18 | else:
19 | open_this_url = urlopen("https://" + url) # Adding https to the url
20 | start_time = time.time() # Time stamp before the reading of url starts
21 | open_this_url.read() # Reading the user defined url
22 | end_time = time.time() # Time stamp after the reading of the url
23 | open_this_url.close() # Closing the instance of the urlopen object
24 | time_to_load = end_time - start_time
25 |
26 | return time_to_load
27 |
28 |
29 | if __name__ == '__main__':
30 | url = input("Enter the url whose loading time you want to check: ")
31 | print(f"\nThe time taken to load {url} is {get_load_time(url):.2} seconds.")
32 |
--------------------------------------------------------------------------------
/projects/Todo_app/Readme.md:
--------------------------------------------------------------------------------
1 | # Todo App using flask
2 | ## Perform Operation like
3 | 1. Add Task
4 | 2. Delete Task
5 | 3. Update Task
6 |
7 | # To run app
8 | - Create virtual Environment
9 | - Install requirements
10 | `pip install requirements.txt`
11 | - run app
12 | `py app.py`
13 |
--------------------------------------------------------------------------------
/projects/Todo_app/requirements.txt:
--------------------------------------------------------------------------------
1 | Flask==1.1.2
2 | Flask-SQLAlchemy==2.4.4
3 |
--------------------------------------------------------------------------------
/projects/Todo_app/static/css/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | }
--------------------------------------------------------------------------------
/projects/Todo_app/templates/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
12 |
13 | TODO App
14 | {% block head %}
15 | {% endblock %}
16 |
17 |
18 |
19 |
20 | {% block body %}
21 | {% endblock %}
22 |
23 |
24 |
25 |
26 |
27 |
30 |
33 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/projects/Todo_app/test.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Todo_app/test.db
--------------------------------------------------------------------------------
/projects/Unique_words_in_a_file/README.md:
--------------------------------------------------------------------------------
1 | # Unique words in text file
2 | Script to display unique words in a given text file.
--------------------------------------------------------------------------------
/projects/Unique_words_in_a_file/unique.py:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | # script to fetch unique sorted words from a text file.
4 | list_of_words = []
5 |
6 | # Alternate Method to insert file
7 | # filename = input("Enter file name: ")
8 | filename = "text_file.txt"
9 |
10 | with open(filename, "r") as f:
11 | for line in f:
12 | # if case is ignored then Great and great are same words
13 | list_of_words.extend(re.findall(r"[\w]+", line.lower()))
14 | # else use this alternate method:
15 | # list_of_words.extend(re.findall(r"[\w]+", line))
16 |
17 |
18 | # Creating a dictionary to store the number of occurence of a word
19 | unique = {}
20 | for each in list_of_words:
21 | if each not in unique:
22 | unique[each] = 0
23 | unique[each] += 1
24 |
25 | # Creating a list to sort the final unique words
26 | s = []
27 |
28 | # If occurence of a word(val) is 1 then it is unique
29 | for key, val in unique.items():
30 | if val == 1:
31 | s.append(key)
32 |
33 | print(sorted(s))
34 |
35 |
36 |
--------------------------------------------------------------------------------
/projects/Unstructured Supplemenrary Service Data/README.md:
--------------------------------------------------------------------------------
1 | # USSD
2 | Unstructured Supplementary Service Data (USSD), sometimes referred to as "Quick Codes" or "Feature codes", is a communications protocol used by GSM cellular telephones to communicate with the mobile network operator's computers. USSD can be used for WAP browsing, prepaid callback service, mobile-money services, location-based content services, menu-based information services, and as part of configuring the phone on the network
3 |
4 | MODULES REQUIRED
5 | 1. random
6 | 2.time
7 | 3. sys
8 |
9 | EXECUTION PROCESS
10 | 1. fork code
11 | 2. git clone SSH
12 | 3. open on device using a python IDE
13 | 4. run the script
14 |
15 |
16 | AUTHOR
17 |
18 | Ajayi Raymond Tomisin (ART)
19 |
--------------------------------------------------------------------------------
/projects/Unstructured Supplemenrary Service Data/Screenshot_20200910-134857.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Unstructured Supplemenrary Service Data/Screenshot_20200910-134857.png
--------------------------------------------------------------------------------
/projects/Web_page_summation/requirements.txt:
--------------------------------------------------------------------------------
1 | utils==1.0.1
2 | sumeval==0.2.2
3 | tensorflow==2.3.0
4 | wget==3.2
5 | sumy==0.8.1
6 | model==0.6.0
7 | numpy==1.19.1
8 | newspaper==0.1.0.7
9 | nltk==3.5
10 | gensim==3.8.3
11 |
--------------------------------------------------------------------------------
/projects/Web_page_summation/utils/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Web_page_summation/utils/__init__.py
--------------------------------------------------------------------------------
/projects/Web_page_summation/utils/comparison.py:
--------------------------------------------------------------------------------
1 |
2 | # https://github.com/chakki-works/sumeval
3 | # https://github.com/Tian312/awesome-text-summarization
4 |
5 | from sumeval.metrics.rouge import RougeCalculator
6 | from sumeval.metrics.bleu import BLEUCalculator
7 |
8 |
9 | def eval_rouges(refrence_summary, model_summary):
10 | # refrence_summary = "tokyo shares close up #.## percent"
11 | # model_summary = "tokyo stocks close up # percent to fresh record high"
12 |
13 | rouge = RougeCalculator(stopwords=True, lang="en")
14 |
15 | rouge_1 = rouge.rouge_n(
16 | summary=model_summary,
17 | references=refrence_summary,
18 | n=1)
19 |
20 | rouge_2 = rouge.rouge_n(
21 | summary=model_summary,
22 | references=[refrence_summary],
23 | n=2)
24 |
25 | rouge_l = rouge.rouge_l(
26 | summary=model_summary,
27 | references=[refrence_summary])
28 |
29 | # You need spaCy to calculate ROUGE-BE
30 |
31 | rouge_be = rouge.rouge_be(
32 | summary=model_summary,
33 | references=[refrence_summary])
34 |
35 | bleu = BLEUCalculator()
36 | bleu_score = bleu.bleu(summary=model_summary,
37 | references=[refrence_summary])
38 |
39 | # print("ROUGE-1: {}, ROUGE-2: {}, ROUGE-L: {}, ROUGE-BE: {}".format(
40 | # rouge_1, rouge_2, rouge_l, rouge_be
41 | # ).replace(", ", "\n"))
42 |
43 | return rouge_1, rouge_2, rouge_l, rouge_be, bleu_score
44 |
45 | # rouge_1, rouge_2,rouge_l,rouge_be = eval_rouges( "tokyo shares close up #.## percent",
46 | # "tokyo stocks close up # percent to fresh record high")
47 | #
48 | # print("ROUGE-1: {}, ROUGE-2: {}, ROUGE-L: {}, ROUGE-BE: {}".format(
49 | # rouge_1, rouge_2, rouge_l, rouge_be
50 | # ).replace(", ", "\n"))
51 |
--------------------------------------------------------------------------------
/projects/Web_page_summation/utils/prepare.py:
--------------------------------------------------------------------------------
1 | import gzip
2 |
3 | default_path = '.'
4 |
5 | with gzip.open(default_path + "sumdata/train/train.article.txt.gz", "rb") as gz:
6 | with open(default_path + "sumdata/train/train.article.txt", "wb") as out:
7 | out.write(gz.read())
8 |
9 | with gzip.open(default_path + "sumdata/train/train.title.txt.gz", "rb") as gz:
10 | with open(default_path + "sumdata/train/train.title.txt", "wb") as out:
11 | out.write(gz.read())
12 |
--------------------------------------------------------------------------------
/projects/Web_page_summation/utils/summarize.py:
--------------------------------------------------------------------------------
1 | from __future__ import absolute_import
2 | from __future__ import division, print_function, unicode_literals
3 | from sumy.parsers.html import HtmlParser
4 | from sumy.nlp.tokenizers import Tokenizer
5 | from sumy.summarizers.lex_rank import LexRankSummarizer as Summarizer
6 | from sumy.nlp.stemmers import Stemmer
7 | from sumy.utils import get_stop_words
8 | import sys
9 |
10 |
11 | def summarize(url=None, LANGUAGE='English', SENTENCES_COUNT=2):
12 | parser = HtmlParser.from_url(url, Tokenizer(LANGUAGE))
13 | stemmer = Stemmer(LANGUAGE)
14 | summarizer = Summarizer(stemmer)
15 | summarizer.stop_words = get_stop_words(LANGUAGE)
16 | result = ''
17 | for sentence in summarizer(parser.document, SENTENCES_COUNT):
18 | result = result + ' ' + str(sentence)
19 | try:
20 | result = result + ' ' + str(sentence)
21 |
22 | except:
23 | print(
24 | '\n\n Invalid Entry!, please Ensure you enter a valid web link \n\n')
25 | sys.stdout.flush()
26 | return (
27 | '\n\n Invalid Entry!, please Ensure you enter a valid web link \n\n')
28 | print('\n\n'+str(url)+'\n\n'+str(result))
29 | sys.stdout.flush()
30 | return result
31 |
--------------------------------------------------------------------------------
/projects/Web_scraping_a_youtube_comment/README.md:
--------------------------------------------------------------------------------
1 | # Web Scrapping Comment
2 | - This script will take a url of youtube video and it will give csv file for users and comments .
3 |
4 | ### Prerequisites
5 | - You only need to have installed selenium which is used for automation.
6 | - Run the below script to install selenium
7 | - $ pip install selenium
8 |
9 | ### How to run the script
10 | - Simply replace your own youtube video url in the webscrapindcomment.py
11 | - And run command in the same directory
12 | - python webscrapindcomment.py
13 |
14 | ### Screenshot/GIF showing the sample use of the script
15 | 
16 |
17 | ## *Author Name*
18 | - Azhad Ghufran
19 |
--------------------------------------------------------------------------------
/projects/Web_scraping_a_youtube_comment/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Web_scraping_a_youtube_comment/demo.gif
--------------------------------------------------------------------------------
/projects/Web_scraping_a_youtube_comment/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium==3.141.0
2 |
--------------------------------------------------------------------------------
/projects/Web_scraping_a_youtube_comment/webscrapindcomment.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Tue Jul 21 16:55:39 2020
4 |
5 | @author: hp
6 | """
7 |
8 | from selenium import webdriver
9 | import csv
10 | import time
11 |
12 | items=[]
13 | driver=webdriver.Chrome(r"C:/Users/hp/Anaconda3/chromedriver.exe")
14 |
15 | driver.get('https://www.youtube.com/watch?v=iFPMz36std4')
16 |
17 | driver.execute_script('window.scrollTo(1, 500);')
18 |
19 | #now wait let load the comments
20 | time.sleep(5)
21 |
22 | driver.execute_script('window.scrollTo(1, 3000);')
23 |
24 |
25 | username_elems = driver.find_elements_by_xpath('//*[@id="author-text"]')
26 | comment_elems = driver.find_elements_by_xpath('//*[@id="content-text"]')
27 | for username, comment in zip(username_elems, comment_elems):
28 | item = {}
29 | item['Author'] = username.text
30 | item['Comment'] = comment.text
31 | items.append(item)
32 | filename = 'C:/Users/hp/Desktop/commentlist.csv'
33 | with open(filename, 'w', newline='', encoding='utf-8') as f:
34 | w = csv.DictWriter(f,['Author','Comment'])
35 | w.writeheader()
36 | for item in items:
37 | w.writerow(item)
38 |
--------------------------------------------------------------------------------
/projects/Website_blocker/README.md:
--------------------------------------------------------------------------------
1 | # Website Blocker
2 |
3 | This script lets you block websites on your computer by editing your hosts file.
4 |
5 |
6 | ### Usage
7 | First add your Blocked Websites to the array in both scripts.
8 |
9 | On Linux: `sudo python website_blocker.py`
10 | On Windows, run the script as Administrator
11 |
12 | To unblock the websites, run the `website_unblocker.py` script.
13 |
14 |
15 | ## *Author Name*
16 |
17 | [Kai Reichart](https://github.com/KaiReichart)
18 |
--------------------------------------------------------------------------------
/projects/Website_blocker/website_blocker.py:
--------------------------------------------------------------------------------
1 | import platform
2 |
3 | if platform.system() == "Windows":
4 | pathToHosts=r"C:\Windows\System32\drivers\etc\hosts"
5 | elif platform.system() == "Linux":
6 | pathToHosts=r"/etc/hosts"
7 |
8 | redirect="127.0.0.1"
9 | websites=["https://www.sislovesme.com/","https://motherless.com/","https://xhamster.com/","https://www.xnxx.com/","https://www.xvideos.com/","https://www.pornhub.com/"]
10 |
11 | with open(pathToHosts,'r+') as file:
12 | content=file.read()
13 | for site in websites:
14 | if site in content:
15 | pass
16 | else:
17 | file.write(redirect+" "+site+"\n")
18 |
--------------------------------------------------------------------------------
/projects/Website_blocker/website_unblocker.py:
--------------------------------------------------------------------------------
1 | import platform
2 |
3 | if platform.system() == "Windows":
4 | pathToHosts=r"C:\Windows\System32\drivers\etc\hosts"
5 | elif platform.system() == "Linux":
6 | pathToHosts=r"/etc/hosts"
7 |
8 | websites=["https://www.sislovesme.com/","https://motherless.com/","https://xhamster.com/","https://www.xnxx.com/","https://www.xvideos.com/","https://www.pornhub.com/"]
9 |
10 | with open(pathToHosts,'r+') as file:
11 | content=file.readlines()
12 | file.seek(0)
13 | for line in content:
14 | if not any(site in line for site in websites):
15 | file.write(line)
16 | file.truncate()
17 |
--------------------------------------------------------------------------------
/projects/Wikipedia_search_wordcloud/README.md:
--------------------------------------------------------------------------------
1 | # Wordcloud Images for Wikipedia Article
2 | Python script that prompts the user for an input, searches for the corresponding article on wikipedia and generates a wordcloud based on the searched article.
3 |
4 | ### Prerequisites
5 | `pip install` the models in `requirements.txt` from your command prompt.
6 |
7 | ### How to run the script
8 | Run like any other python file. Upon executing, the wordcloud image will be saved to the current directory. The script will also prompt a y/n if the user wants to see the generated image during execution.
9 | 
10 |
11 | ## *Author Name*
12 | [Naman Shah](https://github.com/namanshah01)
--------------------------------------------------------------------------------
/projects/Wikipedia_search_wordcloud/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4==4.9.1
2 | certifi==2020.6.20
3 | chardet==3.0.4
4 | cycler==0.10.0
5 | idna==2.10
6 | kiwisolver==1.2.0
7 | matplotlib==3.3.1
8 | numpy==1.19.1
9 | Pillow==7.2.0
10 | pyparsing==2.4.7
11 | python-dateutil==2.8.1
12 | requests==2.24.0
13 | six==1.15.0
14 | soupsieve==2.0.1
15 | urllib3==1.25.10
16 | wikipedia==1.4.0
17 | wordcloud==1.8.0
18 |
--------------------------------------------------------------------------------
/projects/Wikipedia_search_wordcloud/script_execution.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Wikipedia_search_wordcloud/script_execution.jpg
--------------------------------------------------------------------------------
/projects/Wikipedia_search_wordcloud/wiki-search-cloud.py:
--------------------------------------------------------------------------------
1 | from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
2 | import matplotlib.pyplot as plt
3 | import wikipedia
4 | import sys
5 | import warnings
6 | # supressing unnecessary warnings
7 | warnings.filterwarnings("ignore")
8 |
9 |
10 | # function to search the wikipedia article and generate the wordcloud
11 | def gen_cloud(topic):
12 | try:
13 | content = str(wikipedia.page(topic).content)
14 | except:
15 | print("Error, try searching something else...")
16 | sys.exit()
17 | STOPWORDS.add('==')
18 | stopwords = set(STOPWORDS)
19 | wordcloud = WordCloud(stopwords=stopwords, max_words=200, background_color="black", width=600, height=350).generate(content)
20 | return wordcloud
21 |
22 |
23 | # function to save the wordcloud to current directory
24 | def save_cloud(wordcloud):
25 | wordcloud.to_file("./wordcloud.png")
26 |
27 |
28 | # function to display the wordcloud with matplotlib
29 | def show_cloud(wordcloud):
30 | plt.imshow(wordcloud, interpolation='bilinear')
31 | plt.axis("off")
32 | plt.show()
33 |
34 |
35 | # driver code
36 | if __name__ == '__main__':
37 | topic = input("What do you want to search: ").strip()
38 | wordcloud = gen_cloud(topic)
39 | save_cloud(wordcloud)
40 | print("Wordcloud saved to current directory as wordcloud.png")
41 | desc = input("Do you wish to see the output(y/n): ")
42 | if desc == 'y':
43 | show_cloud(wordcloud)
44 | sys.exit()
45 |
--------------------------------------------------------------------------------
/projects/Wikipedia_search_wordcloud/wordcloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/Wikipedia_search_wordcloud/wordcloud.png
--------------------------------------------------------------------------------
/projects/WishList/README.md:
--------------------------------------------------------------------------------
1 | # WishList(Django-CRUD)
2 | Simple wishlist CRUD application to save, update delete the wish
3 |
4 |
5 | ## Installation
6 |
7 | Clone This Repository or Download on your local machine
8 | ```
9 | git clone https://github.com/chavarera/Django-CRUD.git
10 | ```
11 | Change Directory Path (Or Open Terminal in Project Directory where **manage.py** file is located)
12 | ```
13 | cd Django-CRUD/
14 | ```
15 |
16 | Activate Your Virtual Enviornment Then Type
17 | ```
18 | python manage.py migrate
19 | ```
20 |
21 | Install **Requirements.txt** file
22 | ```
23 | pip install -r requirements.txt
24 | ```
25 |
26 | Now Run Your Server
27 | ```
28 | python manage.py runserver
29 | ```
30 | 
31 |
32 | Visit Following Url in Any Browser
33 | ```
34 | http://127.0.0.1:8000/
35 | ```
36 |
37 | Output:
38 |
39 | 
40 |
41 |
42 | Full Working Demo
43 | 
44 |
45 |
46 | ## Contributor
47 | [Ravishankar Chavare](http://github.com/chavarera)
48 |
--------------------------------------------------------------------------------
/projects/Write_a_script_to_download_a_random_image_from_unsplash_and_set_it_as_wallpaper/README.md:
--------------------------------------------------------------------------------
1 | ## Set a Random desktop background
2 |
3 | This script will download a random image from [unsplash](https://source.unsplash.com/random) and set it as the desktop background.
4 |
5 | **The image will be saved as "random.jpg" makesure that there are no files saved as "random.jpg" in the current directory**
6 |
7 | ### Requirements
8 |
9 | #### Linux
10 |
11 | Install [Nitrogen](https://wiki.archlinux.org/index.php/Nitrogen)
12 |
13 | ```
14 | pip install requests
15 | ```
16 |
17 | ### Usage
18 |
19 | ```python
20 | python background_linux.py
21 | ```
22 | OR
23 |
24 | ```python
25 | python background_windows.py
26 | ```
27 |
--------------------------------------------------------------------------------
/projects/Write_a_script_to_download_a_random_image_from_unsplash_and_set_it_as_wallpaper/background_linux.py:
--------------------------------------------------------------------------------
1 | from requests import get # to make GET request
2 | from os import system, getcwd, path
3 |
4 |
5 | url = "https://source.unsplash.com/random"
6 | filename = "random.jpg"
7 |
8 |
9 | def download(url, file_name):
10 | '''
11 | downloading the file and saving it
12 | '''
13 | with open(file_name, "wb") as file:
14 | response = get(url)
15 | file.write(response.content)
16 |
17 |
18 | def setup(pathtofile):
19 | '''
20 | setting the up file
21 | '''
22 | system("nitrogen --set-auto {}".format(path.join(getcwd(), pathtofile)))
23 |
24 |
25 | if __name__ == "__main__":
26 | download(url, filename)
27 | setup(filename)
28 |
--------------------------------------------------------------------------------
/projects/Write_a_script_to_download_a_random_image_from_unsplash_and_set_it_as_wallpaper/background_windows.py:
--------------------------------------------------------------------------------
1 | from requests import get
2 | import os
3 | import ctypes
4 | import argparse
5 | import sys
6 |
7 | url = "https://source.unsplash.com/random"
8 | file_name = "random.jpg"
9 |
10 | def is_64bit():
11 | return sys.maxsize > 2 ** 32
12 |
13 |
14 | def download(url, file_name):
15 | '''
16 | downloading the file and saving it
17 | '''
18 | with open(file_name, "wb") as file:
19 | response = get(url)
20 | file.write(response.content)
21 |
22 |
23 | def setup(pathtofile,version):
24 | name_of_file = pathtofile
25 | path_to_file = os.path.join(os.getcwd(), name_of_file)
26 | SPI_SETDESKWALLPAPER = 20
27 | if is_64bit():
28 | ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, path_to_file, 0)
29 | else:
30 | ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, path_to_file, 0)
31 |
32 |
33 | if __name__ == "__main__":
34 | try:
35 | download(url, file_name)
36 | setup(file_name)
37 | except Exception as e:
38 | print(f"Error {e}")
39 | raise NotImplementedError
40 |
--------------------------------------------------------------------------------
/projects/Write_script_to_compress_folder_and_files/README.md:
--------------------------------------------------------------------------------
1 | ## write script to compress folder and files
2 |
3 | ### usage
4 |
5 | python zipfiles.py file_name(or folder name)
6 |
7 | example:
8 | python zipfiles.py test.txt
9 | python zipfiles.py ./test (folder)
10 |
11 | A Compressed file("filename.zip") will be generated after the program is run
--------------------------------------------------------------------------------
/projects/Write_script_to_compress_folder_and_files/zipfiles.py:
--------------------------------------------------------------------------------
1 | import zipfile
2 | import sys
3 | import os
4 |
5 |
6 | # compress file function
7 | def zip_file(file_path):
8 | compress_file = zipfile.ZipFile(file_path + '.zip', 'w')
9 | compress_file.write(path, compress_type=zipfile.ZIP_DEFLATED)
10 | compress_file.close()
11 |
12 |
13 | # Declare the function to return all file paths of the particular directory
14 | def retrieve_file_paths(dir_name):
15 | # setup file paths variable
16 | file_paths = []
17 |
18 | # Read all directory, subdirectories and file lists
19 | for root, directories, files in os.walk(dir_name):
20 | for filename in files:
21 | # Create the full file path by using os module.
22 | file_path = os.path.join(root, filename)
23 | file_paths.append(file_path)
24 |
25 | # return all paths
26 | return file_paths
27 |
28 |
29 | def zip_dir(dir_path, file_paths):
30 | # write files and folders to a zipfile
31 | compress_dir = zipfile.ZipFile(dir_path + '.zip', 'w')
32 | with compress_dir:
33 | # write each file separately
34 | for file in file_paths:
35 | compress_dir.write(file)
36 |
37 |
38 | if __name__ == "__main__":
39 | path = sys.argv[1]
40 |
41 | if os.path.isdir(path):
42 | files_path = retrieve_file_paths(path)
43 | # print the list of files to be zipped
44 | print('The following list of files will be zipped:')
45 | for file_name in files_path:
46 | print(file_name)
47 | zip_dir(path, files_path)
48 | elif os.path.isfile(path):
49 | print('The %s will be zipped:' % path)
50 | zip_file(path)
51 | else:
52 | print('a special file(socket,FIFO,device file), please input file or dir')
53 |
--------------------------------------------------------------------------------
/projects/Write_script_to_move_files_into_alphabetically_ordered_folder/README.md:
--------------------------------------------------------------------------------
1 | ## Script to organize files in a directory (alphabetical order)
2 |
3 | ### usage
4 |
5 | ```python
6 | python main.py
7 | ```
8 |
9 | Folder will be generated and files will be moved accordingly.
10 |
--------------------------------------------------------------------------------
/projects/XKCD_downloader/README.md:
--------------------------------------------------------------------------------
1 | ## XKCD Downloader
2 |
3 | ### This script can be used to download any issue of the xkcd comics with just a simple command.
4 |
5 | ### How to use this script?
6 |
7 | ## 1. Install the requirements with the following line:
8 |
9 | pip install -r requirements.txt
10 |
11 | ## 2. Run the following command from your terminal
12 |
13 | python3 xkcd_downloader.py -l 'issue-number'
14 |
15 | Example :
16 |
17 | python3 xkcd_downloader.py -l 956
18 |
19 |
--------------------------------------------------------------------------------
/projects/XKCD_downloader/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4==4.9.1
2 | certifi==2020.6.20
3 | chardet==3.0.4
4 | idna==2.10
5 | requests==2.24.0
6 | soupsieve==2.0.1
7 | urllib3==1.25.10
8 |
--------------------------------------------------------------------------------
/projects/XKCD_downloader/xkcd_dowloader.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from bs4 import BeautifulSoup as bs
3 | import shutil
4 | import argparse
5 |
6 | # Code to add the cli
7 |
8 | parser = argparse.ArgumentParser()
9 | parser.add_argument("-l", "--issue", required=True, help="Comics Issue Number")
10 | args = vars(parser.parse_args())
11 |
12 |
13 | #Storing the comic issue number provided by the user
14 | issue_number = args['issue']
15 |
16 | #Complete url for the issue
17 | url = "https://xkcd.com/"+ issue_number
18 |
19 |
20 | response = requests.get(url)
21 |
22 | #Checking if we can fetch the url or not
23 | if response.status_code ==200:
24 | soup = bs(response.content, 'html.parser')
25 | image_link = soup.find_all('img')[2]['src']
26 | image_name = image_link.split('/')[-1]
27 | image_url = "https:" + image_link
28 | r = requests.get(image_url, stream=True)
29 | if r.status_code == 200:
30 | #This ensures the image file is loaded correctly
31 | r.raw.decode_content = True
32 |
33 | # Creating the image file
34 | with open(image_name, 'wb') as f:
35 | shutil.copyfileobj(r.raw, f)
36 |
37 | print('Image successfully Downloaded: ', image_name)
38 | else:
39 | print('Image Couldn\'t be retreived')
40 | else:
41 | print("Issue number is invalid")
42 |
--------------------------------------------------------------------------------
/projects/capture_screenshot/README.md:
--------------------------------------------------------------------------------
1 | # Capture Screenshot
2 |
3 | captures screenshot at regular interval of time.
4 |
5 | ## Dependencies
6 |
7 | ```bash
8 | pip install -r requirements.txt
9 | ```
10 |
11 | ## Usage
12 |
13 | ```bash
14 | python screenshot.py # takes screenshot at interval of 1 hour
15 | python screenshot.py -t m -f 5 # takes 5 screenshots in 1 minute
16 | python screenshot.py -p path_to_directory # screenshots will be saved to path_to_directory
17 | ```
18 |
--------------------------------------------------------------------------------
/projects/capture_screenshot/requirements.txt:
--------------------------------------------------------------------------------
1 | PyAutoGUI==0.9.50
2 |
--------------------------------------------------------------------------------
/projects/capture_screenshot/screenshot.py:
--------------------------------------------------------------------------------
1 | import os
2 | import argparse
3 | import pyautogui
4 | import time
5 |
6 | parser = argparse.ArgumentParser()
7 |
8 | parser.add_argument("-p", "--path", help="absolute path to store screenshot.", default=r"./images")
9 | parser.add_argument("-t", "--type", help="h (in hour) or m (in minutes) or s (in seconds)", default='h')
10 | parser.add_argument("-f", "--frequency", help="frequency for taking screenshot per h/m/s.", default=1, type=int)
11 |
12 | args = parser.parse_args()
13 |
14 |
15 | sec = 0.
16 |
17 | if args.type == 'h':
18 | sec = 60 * 60 / args.frequency
19 | elif args.type == 'm':
20 | sec = 60 / args.frequency
21 |
22 | if sec < 1.:
23 | sec = 1.
24 |
25 |
26 | if os.path.isdir(args.path) != True:
27 | os.mkdir(args.path)
28 |
29 |
30 | try:
31 | while True:
32 | t = time.localtime()
33 | current_time = time.strftime("%H_%M_%S", t)
34 | file = current_time + ".jpg"
35 | image = pyautogui.screenshot(os.path.join(args.path,file))
36 | print(f"{file} saved successfully.\n")
37 | time.sleep(sec)
38 |
39 | except KeyboardInterrupt:
40 | print("End of script by user interrupt")
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/projects/cli_proxy_tester/README.md:
--------------------------------------------------------------------------------
1 | # mini-projects-python - cli based proxy tester (#77)
2 |
3 | *Author:* Ingo Kleiber (ingo@kleiber.me)
4 |
5 | This mini project is a proxy tester based on `requests`. It utilized `pandas` for handling csv files and
6 | `click` for the CLI.
7 |
8 | ## Usage
9 |
10 | This script tests proxies by querying (GET request) a testing website that returns the IP of the client. If the returned IP matches the IP of the proxy, we consider the proxy to be good.
11 |
12 | ### Testing Single Proxies
13 |
14 | `python cli.py single http://1.1.1.1`
15 |
16 | This will test the HTTP proxy 1.1.1.1 against the default testing website [iptest.ingokleiber.de](http://iptest.ingokleiber.de).
17 | You can run your own testing service using the PHP script in `/ipinfo`. This service should be offered both via HTTP and HTTPs.
18 |
19 | `python cli.py single http://1.1.1.1 --iptest iptest.yourdomain.com`
20 |
21 | ### (Re)Testing a CSV File
22 |
23 | `python cli.py csv-file proxies.csv`
24 |
25 | This will (re)test all proxies in the given file.
26 |
27 | ### Adding and Testing Proxies From a Text File
28 |
29 | `python cli.py add-from-txt-file proxy_candidates.txt`
30 |
31 | This will add and test each proxy (one per line) in `proxy_candidates.txt`.
32 |
--------------------------------------------------------------------------------
/projects/cli_proxy_tester/cli.py:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | import click
4 |
5 | from proxytest import add_from_text_file
6 | from proxytest import test_csv_file
7 | from proxytest import test_single_proxy
8 |
9 |
10 | def validate_proxy(ctx, param, value):
11 | '''Validate proxy input. The RegEx crudely matches both IPv4 and URLs.'''
12 | validator = re.compile(r'(https|http|socks4|socks5):\/\/'
13 | r'((?:[0-9]{1,3}\.){3}[0-9]{1,3}(:[0-9]{2,5})?'
14 | r'|([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?)')
15 |
16 | if not validator.match(value):
17 | raise click.BadParameter('Please provide a proxy in the format'
18 | 'type://address (e.g., https://42.42.42.42)')
19 | else:
20 | return value
21 |
22 |
23 | @click.group()
24 | def cli():
25 | pass
26 |
27 |
28 | @cli.command()
29 | @click.argument('proxy', callback=validate_proxy)
30 | @click.option('--iptest', default='iptest.ingokleiber.de',
31 | help='iptest address')
32 | @click.option('--csv', default='proxies.csv', help='CSV path')
33 | def single(proxy, iptest, csv):
34 | test_single_proxy(proxy, iptest, csv)
35 |
36 |
37 | @cli.command()
38 | @click.argument('csv')
39 | @click.option('--iptest', default='iptest.ingokleiber.de',
40 | help='iptest address')
41 | def csv_file(iptest, csv):
42 | test_csv_file(iptest, csv)
43 |
44 |
45 | @cli.command()
46 | @click.argument('txt')
47 | @click.option('--iptest', default='iptest.ingokleiber.de',
48 | help='iptest address')
49 | @click.option('--csv', default='proxies.csv', help='CSV path')
50 | def add_from_txt_file(iptest, txt, csv):
51 | add_from_text_file(iptest, txt, csv)
52 |
53 |
54 | if __name__ == '__main__':
55 | cli()
56 |
--------------------------------------------------------------------------------
/projects/cli_proxy_tester/ipinfo/index.php:
--------------------------------------------------------------------------------
1 | $_SERVER['REMOTE_ADDR'],
6 | "xff" => $_SERVER['HTTP_X_FORWARDED_FOR'],
7 | "useragent" => $_SERVER['HTTP_USER_AGENT']
8 | );
9 |
10 | echo json_encode($client_information);
11 | ?>
--------------------------------------------------------------------------------
/projects/cli_proxy_tester/requirements.txt:
--------------------------------------------------------------------------------
1 | click==7.1.2
2 | proxytest==0.5.4
3 | pandas==1.0.5
4 |
--------------------------------------------------------------------------------
/projects/convert pdf to text/README.md:
--------------------------------------------------------------------------------
1 | # PDF to TXT converter
2 | This script takes in a .pdf file and outputs a .txt file
3 |
4 | ### Requirements
5 | - Python
6 | - PyPDF2
7 |
8 |
9 | ### Steps
10 | In this program you have to provide the path for the pdf file that you want to convert into text and you may also provide the path where you want your output text file to be stored.
11 | By default the output files created will be stored in temp folder in the same directory.
12 |
13 | ## *Author Name*
14 | pi1814
15 |
--------------------------------------------------------------------------------
/projects/convert pdf to text/converter1.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 |
4 | import PyPDF2
5 | import os
6 |
7 |
8 | if(os.path.isdir("temp") == False):
9 | os.mkdir("temp")
10 |
11 | txtpath = ""
12 | pdfpath = ""
13 |
14 |
15 |
16 | pdfpath = input("Enter the name of your pdf file - please use backslash when typing in directory path: ") #Provide the path for your pdf here
17 | txtpath = input("Enter the name of your txt file - please use backslash when typing in directory path: ") #Provide the path for the output text file
18 |
19 | BASEDIR = os.path.realpath("temp") # This is the sample base directory where all your text files will be stored if you do not give a specific path
20 | print(BASEDIR)
21 |
22 |
23 | if(len(txtpath) == 0):
24 | txtpath = os.path.join(BASEDIR,os.path.basename(os.path.normpath(pdfpath)).replace(".pdf", "")+".txt")
25 | pdfobj = open(pdfpath, 'rb')
26 |
27 | pdfread = PyPDF2.PdfFileReader(pdfobj)
28 |
29 | x = pdfread.numPages
30 |
31 |
32 | for i in range(x):
33 | pageObj = pdfread.getPage(i)
34 | with open(txtpath, 'a+') as f:
35 | f.write((pageObj.extractText()))
36 | print(pageObj.extractText()) #This just provides the overview of what is being added to your output, you can remove it if want
37 |
38 |
39 |
40 |
41 | pdfobj.close()
42 |
43 |
44 |
--------------------------------------------------------------------------------
/projects/convert pdf to text/samplePdf1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/convert pdf to text/samplePdf1.pdf
--------------------------------------------------------------------------------
/projects/convert_Imgs/JPGtoPNG.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 |
3 | im = Image.open("naruto_first.jpg").convert("RGB")
4 | im.save("naruto.png", "png")
5 |
--------------------------------------------------------------------------------
/projects/convert_Imgs/PNGtoJPG.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 |
3 | im = Image.open("naruto_first.png").convert("RGB")
4 | im.save("naruto.jpg", "jpeg")
5 |
--------------------------------------------------------------------------------
/projects/convert_Imgs/README.md:
--------------------------------------------------------------------------------
1 | # Convert Image Format
2 |
3 | These scripts can change format of images from PNG to JPG and JPG to PNG
4 |
5 | ### Prerequisites
6 |
7 | Required Modules
8 | - PIL==1.1.6
9 |
10 | to install:
11 | ```
12 | $ pip install -r requirements.txt
13 | ```
14 |
15 | ### How to run the script
16 |
17 | - Dynamic Change
18 | Copy the script convertDynamic.py into the directory where images are (PNG and/or JPG). And run:
19 | ``` bash
20 | $ python convertDynamic.py
21 | ```
22 | This will convert all JPG images to PNG and PNG images to JPG in present directory tree recursively(.i.e. will change format in images inside sub-directories too.)
23 | - JPG to PNG (single image)
24 | 1. Copy the JPG image in directory where `JPGtoPNG.py` exists
25 | 2. Replace file name `naruto_first.jpg` inside `JPGtoPNG.py`(line 3) to input file name(JPG).
26 | 3. Replace file name `naruto.png` inside `JPGtoPNG.py`(line 4) to output file name(PNG).
27 | 4. Run following command:
28 | ```
29 | $ python JPGtoPNG.py
30 | ```
31 | - PNG to JPG (single image)
32 | 1. Copy the PNG image in directory where `PNGtoJPG.py` exists
33 | 2. Replace file name `naruto_first.png` inside `PNGtoJPG.py`(line 3) to input file name(PNG).
34 | 3. Replace file name `naruto.jpg` inside `PNGtoJPG.py`(line 4) to output file name(JPG).
35 | 4. Run following command:
36 | ```
37 | $ python PNGtoJPG.py
38 | ```
39 |
40 | ## *Author Name*
41 |
42 | Xordux
43 |
--------------------------------------------------------------------------------
/projects/convert_Imgs/convertDynamic.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | import sys
3 | import os
4 |
5 | try:
6 | im = None
7 | for root, dirs, files in os.walk("."):
8 | for filename in files:
9 | if filename.endswith('.jpg'):
10 | im = Image.open(filename).convert("RGB")
11 | im.save(filename.replace('jpg', 'png'), "png")
12 | elif filename.endswith('.png'):
13 | im = Image.open(filename).convert("RGB")
14 | im.save(filename.replace('png', 'jpg'), "jpeg")
15 | else:
16 | print('dont have image to convert')
17 | except IOError:
18 | print('directory empty!')
19 | sys.exit()
20 |
--------------------------------------------------------------------------------
/projects/convert_Imgs/naruto_first.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/convert_Imgs/naruto_first.jpg
--------------------------------------------------------------------------------
/projects/convert_Imgs/naruto_first.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/convert_Imgs/naruto_first.png
--------------------------------------------------------------------------------
/projects/convert_Imgs/naruto_last.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/convert_Imgs/naruto_last.jpg
--------------------------------------------------------------------------------
/projects/convert_Imgs/naruto_last.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/convert_Imgs/naruto_last.png
--------------------------------------------------------------------------------
/projects/convert_Imgs/requirements.txt:
--------------------------------------------------------------------------------
1 | PIL==1.1.6
2 |
--------------------------------------------------------------------------------
/projects/convert_dictionary_to_python_object/README.md:
--------------------------------------------------------------------------------
1 | # Dictionary to Python Object
2 |
3 | A Class in python to convert dictionary to a object
4 |
5 | ### Prerequisites
6 |
7 | None, only a running Python installation is required.
8 |
9 | ### How to run the script
10 |
11 | - Add the `class obj` in your code.
12 | - Modify the code according to your need or use it directly:
13 | `ob = obj({'a':1, 'b': 2, 'c':3})`
14 |
15 | ## *Author Name*
16 |
17 | Xordux
18 |
--------------------------------------------------------------------------------
/projects/convert_dictionary_to_python_object/conversion.py:
--------------------------------------------------------------------------------
1 | class obj(object):
2 | def __init__(self, d):
3 | for x, y in d.items():
4 | setattr(self, x, obj(y) if isinstance(y, dict) else y)
5 | data = {'a':5,'b':7,'c':{'d':8}}
6 | ob = obj(data)
7 |
--------------------------------------------------------------------------------
/projects/convert_png_images_to_ico_format/README.md:
--------------------------------------------------------------------------------
1 | # CONVERT_PNG_to_ICO
2 |
3 | This project contains a simple python script to convert a .png image to .ICO format
4 |
5 | ## Requirements
6 | Pillow module
7 |
8 | `pip install pillow`
9 |
10 | ## Two methods:
11 |
12 | The conversion can be done in two ways:
13 | ### Using Terminal
14 | - Add the image in png format with name as 'input' in this folder.
15 | - Run the convert.py script.
16 | - output image will be generated and saved in this folder with the name 'output'.
17 |
18 | ### Using GUI
19 | - Run the convertUI.py script.
20 | - Select the 'Import PNG File' button and pick any png image from any location.
21 | - Select the 'Convert PNG to ICO' button and pick the location where the file will be saved.
22 |
--------------------------------------------------------------------------------
/projects/convert_png_images_to_ico_format/convert.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | # Take input image from present folder
3 | img = Image.open('input.png')
4 | # Generate and save output image to present folder
5 | img.save('output.ico')
--------------------------------------------------------------------------------
/projects/convert_png_images_to_ico_format/convertUI.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 | from tkinter import filedialog, messagebox
3 | from PIL import Image
4 |
5 | # Initialize Tkinter window
6 | root = tk.Tk()
7 | # Initialize variable to store image path
8 | img = None
9 | # Initialize font, background color, foreground color and width for the buttons
10 | font = ('helvetica', 12, 'bold')
11 | bg = 'blue'
12 | fg = 'white'
13 | width = 15
14 |
15 | def getPNG():
16 | '''Function to get png image location and open it with pillow'''
17 | global img
18 | import_file_path = filedialog.askopenfilename(filetypes=[("PNG File",'.png')])
19 | img = Image.open(import_file_path)
20 |
21 | def convertToICO():
22 | global img
23 | '''Function to convert image from png to ico format with pillow and save to user specified location'''
24 | if img is None:
25 | tk.messagebox.showerror("Error", "No File selected")
26 | else:
27 | export_file_path = filedialog.asksaveasfilename(defaultextension='.ico')
28 | img.save(export_file_path)
29 | tk.messagebox.showinfo("Success", "File converted and saved")
30 |
31 | # Set the window title
32 | root.title('PNG to ICO Converter')
33 | canvas1 = tk.Canvas(root, width=500, height=350, bg='lightblue')
34 | canvas1.pack()
35 | # Set the screen title
36 | label1 = tk.Label(root, text='PNG to ICO Converter', bg='lightblue')
37 | label1.config(font=('helvetica', 20))
38 | canvas1.create_window(250, 100, window=label1)
39 | # Browse button to browse for image
40 | browseButton = tk.Button(text="Import PNG File", command=getPNG, bg=bg, fg=fg, font=font, width=width)
41 | canvas1.create_window(250, 150, window=browseButton)
42 | # Convert button to convert selected image and save
43 | saveAsButton = tk.Button(text='Convert PNG to ICO', command=convertToICO, bg=bg, fg=fg, font=font, width=width)
44 | canvas1.create_window(250, 200, window=saveAsButton)
45 | root.mainloop()
--------------------------------------------------------------------------------
/projects/convert_png_images_to_ico_format/input.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/convert_png_images_to_ico_format/input.png
--------------------------------------------------------------------------------
/projects/convert_png_images_to_ico_format/output.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/convert_png_images_to_ico_format/output.ico
--------------------------------------------------------------------------------
/projects/convert_png_images_to_ico_format/requirements.txt:
--------------------------------------------------------------------------------
1 | Pillow==7.2.0
--------------------------------------------------------------------------------
/projects/download GeeksForGeeks articles/downloader.py:
--------------------------------------------------------------------------------
1 | # !/usr/bin/env python
2 | from selenium import webdriver
3 | from webdriver_manager.chrome import ChromeDriverManager
4 | import json
5 | import requests
6 |
7 |
8 | # article url
9 | # URL = "https://www.geeksforgeeks.org/what-can-i-do-with-python/"
10 |
11 |
12 | def get_driver():
13 | # chrome options settings
14 | chrome_options = webdriver.ChromeOptions()
15 | settings = {
16 | "recentDestinations": [
17 | {"id": "Save as PDF", "origin": "local", "account": ""}
18 | ],
19 | "selectedDestinationId": "Save as PDF",
20 | "version": 2,
21 | }
22 | prefs = {
23 | "printing.print_preview_sticky_settings.appState": json.dumps(settings)
24 | }
25 | chrome_options.add_experimental_option("prefs", prefs)
26 | chrome_options.add_argument("--kiosk-printing")
27 |
28 | # launch browser with predefined settings
29 | browser = webdriver.Chrome(
30 | executable_path=ChromeDriverManager().install(), options=chrome_options
31 | )
32 | return browser
33 |
34 |
35 | def download_article(URL):
36 | browser = get_driver()
37 | browser.get(URL)
38 |
39 | # launch print and save as pdf
40 | browser.execute_script("window.print();")
41 | browser.close()
42 |
43 |
44 | if __name__ == "__main__":
45 | URL = input("provide article URL: ")
46 | # check if the url is valid/reachable
47 | if requests.get(URL).status_code == 200:
48 | try:
49 | download_article(URL)
50 | print("Your article is successfully downloaded")
51 | except Exception as e:
52 | print(e)
53 | else:
54 | print("Enter a valid working URL")
55 |
--------------------------------------------------------------------------------
/projects/download GeeksForGeeks articles/readme.md:
--------------------------------------------------------------------------------
1 | # Download GeeksForGeeks Articles as pdf
2 |
3 | This script take a link of GeeksForGeeks article as input and download the complete article as a pdf at default download location.
4 |
5 | ### Prerequisites
6 |
7 | * selenium
8 | * requests
9 | * webdriver-manager
10 | * Run `pip install -r requirements.txt` to install required external modules.
11 |
12 | ### How to run the script
13 |
14 | - Execute `python3 downloader.py`
15 | - Type in URL of article when prompted.
16 |
17 | ### Screenshot/GIF showing the sample use of the script
18 |
19 | 
20 |
21 | ## *Author Name*
22 |
23 | [Shiv Thakur](https://github.com/ShivSt)
24 |
--------------------------------------------------------------------------------
/projects/download GeeksForGeeks articles/requirements.txt:
--------------------------------------------------------------------------------
1 | requests==2.24.0
2 | selenium==3.141.0
3 | webdriver-manager==3.2.2
--------------------------------------------------------------------------------
/projects/download GeeksForGeeks articles/screenshot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/download GeeksForGeeks articles/screenshot.jpg
--------------------------------------------------------------------------------
/projects/racing_barchart_animation/README.md:
--------------------------------------------------------------------------------
1 | # Racing Bar Chart Animation
2 |
3 | 
4 |
5 | ## Packages Needed
6 |
7 | **Make sure you are using a python virtual environment**
8 |
9 | `pip install jupyterlab`
10 |
11 | `pip install pandas`
12 |
13 | `pip install requests`
14 |
15 | OR
16 |
17 | `pip install -r requirements.txt`
18 |
19 |
20 |
--------------------------------------------------------------------------------
/projects/racing_barchart_animation/images/deceased.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdityaJ7/python-mini-projects/7e17a2414ddebb3194d575b0768171f9b989c492/projects/racing_barchart_animation/images/deceased.gif
--------------------------------------------------------------------------------
/projects/racing_barchart_animation/requirements.txt:
--------------------------------------------------------------------------------
1 | jupyterlab==2.2.2
2 | matplotlib==3.3.0
3 | notebook==6.1.1
4 | numpy==1.19.1
5 | pandas==1.1.0
6 | requests==2.24.0
7 |
--------------------------------------------------------------------------------
/requirementsALL.txt:
--------------------------------------------------------------------------------
1 | ExifRead==2.3.1
2 | Flask-SQLAlchemy==2.4.4
3 | Flask==1.1.2
4 | HTMLParser==0.0.2
5 | PIL==1.1.6
6 | Pillow==7.2.0
7 | PyAudio==0.2.11
8 | PyAutoGUI==0.9.50
9 | PyPDF2==1.26.0
10 | SpeechRecognition==3.8.1
11 | beautifulsoup4==4.9.1
12 | certifi==2020.6.20
13 | chardet==3.0.4
14 | chromedriver-binary==85.0.4183.38.0
15 | click==7.1.2
16 | cycler==0.10.0
17 | dnspython==2.0.0
18 | emoji==0.6.0
19 | ffmpeg==1.4
20 | ffpyplayer==4.3.1
21 | gTTS==2.1.1
22 | gensim==3.8.3
23 | geopy==2.0.0
24 | googletrans==3.0.0
25 | idna==2.10
26 | img2pdf==0.4.0
27 | jupyterlab==2.2.2
28 | kiwisolver==1.2.0
29 | lxml==4.5.1
30 | matplotlib==3.3.0
31 | model==0.6.0
32 | newspaper==0.1.0.7
33 | nltk==3.5
34 | notebook==6.1.1
35 | numpy==1.19.1
36 | opencv-python==4.3.0.36
37 | pandas==1.0.5
38 | pathlib==1.0.1
39 | proxytest==0.5.4
40 | psutil==5.7.2
41 | py-notifier==0.1
42 | pycryptodome==3.9.8
43 | pyparsing==2.4.7
44 | python-dateutil==2.8.1
45 | pytz==2020.1
46 | requests==2.23.0
47 | selenium==3.141.0
48 | six==1.15.0
49 | soupsieve==2.0.1
50 | sumeval==0.2.2
51 | sumy==0.8.1
52 | tensorflow==2.3.0
53 | tqdm==4.48.2
54 | tweepy==3.9.0
55 | urllib3==1.25.10
56 | utils==1.0.1
57 | webdriver-manager==3.2.2
58 | wget==3.2
59 | wikipedia==1.4.0
60 | win10toast==0.9
61 | wordcloud==1.8.0
62 | xmltodict==0.12.0
63 |
--------------------------------------------------------------------------------