- Install the required dependencies by running the following command:
pip install pyscreenshot Pillow
- Run the script using the following command:
python screenshot.py
import pyscreenshot
import PIL
capture = pyscreenshot.grab() # to capture the screen
# to display captured screen
capture.show()
# to save screenshot
capture.save("capturedthroughscript.jpg")
Generates and prints random fun facts.
- Install the required dependencies by running the following command:
pip install randfacts
- Run the script using the following command:
python funfact.py
from randfacts import get_fact
print("Fact of the moment:", get_fact(filter_enabled=False))
print("Stay Silent with these facts:", get_fact(only_unsafe=True))
Implements a web crawler to find all links on a web page.
- Install the required dependencies by running the following command:
pip install requests beautifulsoup4
- Run the script using the following command:
python webcrawler.py
The script will crawl the web page specified in the url
variable and print out all the links found.
Automates sending WhatsApp messages using the pywhatkit
library.
- Install the required dependencies by running the following command:
pip install pywhatkit
-
Update the
phone_number
,message
,hour
, andminute
variables in the script with your desired values. -
Run the script using the following command:
python whatsappautomation.py
The script will send the specified message to the provided phone number at the specified time.
Captures an image from the default camera and saves it as a JPEG file.
- Install the required dependencies by running the following command:
pip install cv2
- Run the script using the following command:
python camimg.py
import cv2
imgcapture = cv2.VideoCapture(0)
result = True
while(result):
ret, frame = imgcapture.read()
cv2.imwrite("test.jpg", frame)
result = False
print("Image Captured...")
Implements a TCP chat server that allows clients to connect and send messages.
- Install the required dependencies by running the following command:
pip install socket
- Run the script using the following command:
python ServerScript.py
The script will start a TCP server on port 3000 and listen for incoming connections. When a client connects, the script will print the client's address and receive messages from the client. The script will also send messages to the client.
A game where you try to find the hidden gold on a 3x3 grid.
- Run the script using the following command:
python findthegold.py
Generates a random number and applies the FizzBuzz rules.
- Run the script using the following command:
python fizzbuzz.py
Simulates rolling two dice and displays the results.
- Run the script using the following command:
python twodicerolling.py
Randomly selects a person to pay the bill.
- Run the script using the following command:
python billroulette.py
Removes the background from an image and saves it as a transparent image.
- Install the required dependencies by running the following command:
pip install opencv-python
- Run the script using the following command:
python removebackground.py
The script will remove the background from the input image and save the result as a transparent image.