Skip to content

In this repository there are small practical projects that can be used for educational models.

Notifications You must be signed in to change notification settings

Abbasmo72/Small-Projects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

Small Project

Gif

Click to see the descriptions in Persian language
Notice: Each section has a README file in English and Farsi in its respective file. By clicking on the links of each section, you can learn more in-depth information about the code and its function.


File Operations

1. Cerate PDF :

This code creates a graphical application using the Tkinter library in Python, allowing users to generate PDF files. Users can input their desired text into a text box, and by clicking a button, the program generates a PDF file. The ReportLab library is utilized to create the PDF, with support for Persian fonts. The entered text is retrieved from the text box and written line by line into the PDF, managing page positions dynamically. This program is suitable for creating simple textual documents with Persian language support. To view the file English README.md and Persian README.md And the complete code Python Code.

2. Chek Code Python :

This program creates a graphical interface using the Tkinter library, allowing users to check the syntax validity of Python code. It utilizes the ast module to parse the code and identify syntax errors, reporting any issues along with the line number to the user. Line numbers are displayed in a separate, non-editable text box and are automatically updated whenever the code text changes. Two text boxes are arranged side by side: one for line numbers and the other for the user to input code. Using the "Check Syntax" button, users can validate their code and view the results.
To view the file English README.md and Persian README.md And the complete code Python Code.

3. CSV Collector:

This program is designed to combine multiple CSV files from a specified folder into a single consolidated CSV file. The process begins by verifying the existence of the input folder and identifying all CSV files within it. Each file is then sequentially read using the pandas library and appended to a unified dataset while ensuring data integrity through proper error handling. Once all files are successfully processed, the program saves the combined data into a new CSV file specified by the user. Additionally, it provides informative messages during each step to keep the user informed of the progress and potential issues, ensuring a seamless and user-friendly experience.
To view the file English README.md and Persian README.md And the complete code Python Code.

4. PDF Image Saver:

This code is designed to extract images from PDF files using the PyPDF2, PIL, and tkinter libraries. It first creates a folder to store the extracted images if it doesn't already exist. Then, it opens the PDF file and scans its pages to locate images. If a page contains image objects, the image data is extracted and converted to an image using PIL. The images are saved in PNG format in the specified folder. Users can select their desired PDF file through a file selection dialog. A folder named "extracted_images" is created in the same directory as the PDF file, and the images are saved there. If no images are found in the PDF file, an appropriate message is displayed. In case of errors while processing images, the relevant error message is shown. This code provides a simple user interface using tkinter for file selection.
To view the file English README.md and Persian README.md And the complete code Python Code.


Network Utilities

1. Get IP :

This Python code is designed to fetch and display the user's public IP address. It uses the urllib.request library to send a request to the ipify API service, retrieving the user's IP in text format. If the request is successful, the public IP is printed to the console. In case of any error, an appropriate error message is displayed. The script is executable as a standalone program, controlled through the if name == "main": block.
To view the file English README.md and Persian README.md And the complete code Python Code.

2. SSL Shield :

The above code defines a function named is_secure_website that checks whether a website is secure using HTTPS. The function sends an HTTP request to the provided URL using the requests library and validates the certificate with the help of the certifi library. If the request is successful and the URL starts with https, the website is considered secure. In case of any errors, such as an invalid URL or connection issues, the website is deemed insecure. Finally, the user can input a website URL and see the result printed on the console.
To view the file English README.md and Persian README.md And the complete code Python Code.

3. Net Speed :

This Python script measures the network bandwidth by calculating the download and upload speeds. It uses psutil to get the initial and updated network statistics, then calculates the difference in bytes received and sent over a 1-second interval. The results are printed in kilobytes per second. The script also tracks the time taken to measure the bandwidth for performance insight.
To view the file English README.md and Persian README.md And the complete code Python Code.

4. Net Monitor :

This script monitors network traffic using the psutil library to fetch network statistics and the time library for timing control. It defines a function, monitor_network, which continuously calculates and displays the number of bytes sent, received, and the total bytes transferred at regular intervals (default is 1 second). Initially, the script fetches and stores the current network stats. Inside an infinite loop, it calculates the difference in sent and received bytes compared to the previous stats, prints the data in a formatted table, and updates the previous stats for the next iteration. The program runs continuously until manually stopped.
To view the file English README.md and Persian README.md And the complete code Python Code.

5. Net Sniffer :

This code is designed to monitor network traffic and detect unauthorized access through network packets. It uses the scapy library to capture and analyze packets, logging the details of each packet into a JSON file. The network monitoring runs in a separate thread for a specified duration, so the main program doesn't stop. The user can choose the network interface and packet filter. Finally, the execution time and the location of the logs are displayed.
To view the file English README.md and Persian README.md And the complete code Python Code.


System Oprations

1. Alarm Battrey :

The program uses the psutil and pygame libraries to monitor the battery status and power connection, playing an alert if necessary. The pygame.mixer.init initializes the sound playback setup. In an infinite loop, the program checks the battery and power connection status; if the power is disconnected, it continuously plays the sg.mp3 sound file. When the power is reconnected, the alarm playback stops. The status is checked every second.
To view the file English README.md and Persian README.md And the complete code Python Code.

2. Battery Monitor :

The code first retrieves battery information using the psutil.sensors_battery() function and checks if the information is available. If battery data exists, it prints the battery percentage and whether the device is plugged into power. A function named convertTime is defined to convert the remaining battery time from seconds to the format hours:minutes:seconds. The remaining battery time is then displayed using this function. If no battery information is available, it prints "No battery information available."
To view the file English README.md and Persian README.md And the complete code Python Code.

3. Cpu Guardian :

The provided code is a CPU monitoring program that utilizes the psutil library. The CpuMonitor class is designed with two main attributes: max_usage to define the maximum acceptable CPU usage and check_interval to set the interval between checks. The check_cpu_usage method monitors and displays the current CPU usage, while the monitor_cpu method continuously tracks CPU usage and triggers an alert if it exceeds the defined threshold, invoking the take_action method to manage the situation. The take_action method identifies high CPU-consuming processes, displays their details, and optionally terminates them if necessary. In the main program section (main), an instance of the class is created with customizable settings, and monitoring begins. This program effectively monitors and optimizes CPU usage in real time.
To view the file English README.md and Persian README.md And the complete code Python Code.

4. Disk Space :

The psutil library is imported to access system information. Then, the get_disk_usage function is defined to retrieve disk information, including total space, used space, free space, and percentage of used space, using the disk_usage method. The total, used, and free spaces are converted from bytes to gigabytes for better readability. The disk information is then printed in a formatted manner, and finally, the function get_disk_usage is executed if the script is run directly by checking the name == "main" condition.
To view the file English README.md and Persian README.md And the complete code Python Code.

5. Python FileFinder :

The os and tkinter libraries are imported for file management and GUI creation. The search_files function searches directories for files with a specific extension like .py. In the on_search_button_click function, the file name is retrieved from the input, and a warning is shown if it's empty. Then, .py files are searched, filtered for the search term, and displayed in the Listbox; if no files are found, an information message is shown. Finally, root.mainloop runs the GUI, starting the application.
To view the file English README.md and Persian README.md And the complete code Python Code.

6. Auto Shutdown :

The program begins by importing the os module for executing system commands and the time module for adding delays. It defines a function called schedule_shutdown, which encapsulates the logic for scheduling a system shutdown. Inside the function, the user is prompted to input the delay time in minutes. This input is then converted to seconds by multiplying it by 60. The program uses time.sleep to pause execution for the specified duration. Once the wait is complete, it checks the operating system type using the os.name attribute. If the operating system is Windows, the program runs the shutdown /s /t 1 command to shut down the system. For Linux or Mac, it executes the shutdown -h now command. If the user enters an invalid input, such as a non-numeric value, an error message is displayed, and the program gracefully exits.
To view the file English README.md and Persian README.md And the complete code Python Code.


Web Scripts

1. Find Table :

This code is a simple web scraping tool that uses Python libraries like requests, BeautifulSoup, and pandas to extract table data from a website. First, it fetches the HTML content of a webpage using requests.get. Then, it parses the content with BeautifulSoup to identify tables with the class wikitable. Each extracted table is converted into a DataFrame using pandas.read_html. Finally, these tables can be saved as CSV files for further analysis. This code is highly useful for collecting structured data from web pages.
To view the file English README.md and Persian README.md And the complete code Python Code.

2. Web Scraper :

This code uses the requests and BeautifulSoup libraries to send a request to a website and extract HTML data. It first sends an HTTP request to the specified URL and checks the response status. If the response is successful, it parses the HTML content and extracts all (hr) tags. Finally, it prints the text of the extracted tags line by line.
To view the file English README.md and Persian README.md And the complete code Python Code.

3. NetPics :

The script imports necessary libraries like os, requests, BeautifulSoup, urljoin, and re for handling files, HTTP requests, HTML parsing, and regular expressions. It ensures the specified folder exists or creates it to save downloaded images. The HTML content of the given URL is fetched using requests and parsed with BeautifulSoup to extract tags. The src attribute of each tag is extracted, and relative URLs are converted to absolute ones using urljoin. Only images with .png or .jpg extensions are processed further, ensuring valid file formats. Invalid characters in file names are replaced with underscores using re.sub to prevent errors during saving. Images are downloaded with requests.get and saved in the folder with cleaned names. Finally, the script prompts the user to input a website URL and folder name, then downloads all valid images into the specified folder.
To view the file English README.md and Persian README.md And the complete code Python Code.


Tools

1. Cal Viewer :

This code prompts the user to enter the desired year and month, then creates an object of the TextCalendar class with the week starting on Sunday. Using the formatmonth method, it generates a textual calendar for the specified month. Finally, the generated calendar is printed for the user to view. The display_calendar function is called to execute the entire process.
To view the file English README.md and Persian README.md And the complete code Python Code.

2. Country Info Finder :

This code uses the countryinfo library to provide detailed information about a country. It first takes the country name as input from the user and then retrieves various details, including the capital, population, area, geographical region, languages, currency, and neighboring countries, displaying the information in a readable format.
To view the file English README.md and Persian README.md And the complete code Python Code.

3. Daily Tasker :

This program is a simple task manager that stores tasks in a JSON file and allows adding new tasks with a name, due date, and completion status. Users can view all tasks, update their completion status, and delete tasks if needed. Changes are automatically saved to the file, and the program is managed through a main menu offering various options for task operations.
To view the file English README.md and Persian README.md And the complete code Python Code.

4. Data Faker :

This code uses the Faker library to generate and print random fake data such as name, address, text, email, country, geographic coordinates, and URL. It's useful for testing and simulation in software projects.
To view the file English README.md and Persian README.md And the complete code Python Code.

5. Easy Pad :

This program is a simple note-taking application that uses the notes.txt file to store and manage notes. Users can add new notes, view existing ones, or delete specific notes. The notes are managed interactively through a menu loop, and changes are saved to the file. If the notes file does not exist, the program creates it automatically. Available options include adding, viewing, deleting notes, and exiting the program.
To view the file English README.md and Persian README.md And the complete code Python Code.

6. Planet Tracker :

This code calculates and displays the position of a planet relative to the Greenwich Observatory's location at the current time using Astropy modules. By receiving the planet's name from the user, it provides the planet's position in terms of Right Ascension (RA) and Declination (Dec).
To view the file English README.md and Persian README.md And the complete code Python Code.

7. QR code :

This Python script generates a QR code for a given website URL. It prompts the user to input the website address (without the http or https prefix). The script then automatically prepends https:// to the input to create a valid URL. Using the qrcode module, a QR code is generated for the URL and displayed to the user. Additionally, the QR code is saved as a PNG image file in the current directory, and a success message is printed to inform the user that the QR code has been saved successfully.
To view the file English README.md and Persian README.md And the complete code Python Code.

8. Time Code :

This code measures the execution time of a specific code block using the time module. It records the start and end times, calculates the elapsed time, and displays it.
To view the file English README.md and Persian README.md And the complete code Python Code.

9. Timer :

The countdown_timer function creates a countdown from the given seconds, displaying the remaining time in MM:SS format every second. Once the time runs out, it shows the message "Time's up!".
To view the file English README.md and Persian README.md And the complete code Python Code.

10. Safe Pass Generator :

This program generates a strong and random password of a specified length. The password consists of uppercase and lowercase letters, digits, and special characters. The secrets module is used to ensure high-security random password generation.
To view the file English README.md and Persian README.md And the complete code Python Code.

11. KeyboardFixer :

This script takes user input and detects its language (English or Persian). It then converts the text to the correct language using a mapping dictionary. The corrected text is displayed and copied to the clipboard. Counter is used for character counting, and re.sub is used for character replacement. This tool is useful for fixing mistyped text due to incorrect keyboard settings.
To view the file English README.md and Persian README.md And the complete code Python Code.


About

In this repository there are small practical projects that can be used for educational models.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages