DEV Community

Sameer Qaiser
Sameer Qaiser

Posted on

5 Python Scripts Every Tech Enthusiast Should Know for Automating Their Daily Life

As a tech enthusiast or gadget lover, you probably have a lot of devices: a smart laptop, a fast router, maybe some smart home appliances, and a phone that controls them all. You also probably spend a lot of time managing them—checking battery health, cleaning up messy download folders, or testing your Wi-Fi speed.

What if you could automate all of that with a few lines of code?

Python isn't just for building massive web apps or training AI models. It's a superpower for everyday tech users. Here are five Python scripts that will help you automate your digital life, make your gadgets run smoother, and save you hours of manual work.

1. The Instant File Organizer

If you are a developer or gadget lover, your "Downloads" folder is probably a graveyard of PDFs, images, zip files, and installers. Instead of organizing them manually, let Python do it.

Using Python's built-in os and shutil modules, you can write a script that looks at every file in a folder, checks its extension, and moves it to the correct subfolder (Images, Documents, Videos, etc.).

import os
import shutil

downloads_path = "/path/to/your/downloads"

extensions = {
    "Images": [".png", ".jpg", ".jpeg", ".gif"],
    "Documents": [".pdf", ".docx", ".txt"],
    "Videos": [".mp4", ".mkv"],
    "Archives": [".zip", ".rar"]
}

for filename in os.listdir(downloads_path):
    file_path = os.path.join(downloads_path, filename)
    if os.path.isfile(file_path):
        for folder, ext_list in extensions.items():
            if any(filename.lower().endswith(ext) for ext in ext_list):

                folder_path = os.path.join(downloads_path, folder)
                os.makedirs(folder_path, exist_ok=True)

                shutil.move(file_path, os.path.join(folder_path, filename))
                break
Enter fullscreen mode Exit fullscreen mode

2. The Wi-Fi Speed Tester

If you work with smart home gadgets or stream 4K video, your internet speed is everything. Instead of opening a browser and navigating to a website every time you want to test your router, you can build a quick Python script that tests it automatically.

Using the speedtest-cli library, you can ping the nearest server and output your download and upload speeds directly to your terminal.

import speedtest

st = speedtest.Speedtest()
print("Finding the best server...")
st.get_best_server()

down_speed = st.download() / 1_000_000 
up_speed = st.upload() / 1_000_000

print(f"Download Speed: {down_speed:.2f} Mbps")
print(f"Upload Speed: {up_speed:.2f} Mbps")
Enter fullscreen mode Exit fullscreen mode

3. The Laptop Battery Monitor

For gadget lovers, battery health is a constant obsession. If you want to know exactly how your laptop's battery is behaving (without relying on the default OS indicator), Python has a tool for that.

The psutil library can pull detailed hardware metrics. This script will tell you the battery percentage, whether it's plugged in, and the estimated time left until it dies.

import psutil

battery = psutil.sensors_battery()
percent = battery.percent
plugged = battery.power_plugged

if plugged:
    print(f"Battery is charging at {percent}%")
else:
    print(f"Battery is at {percent}%. Please plug in your charger!")
Enter fullscreen mode Exit fullscreen mode

4. Automated Weather Alerts for Your Smart Display

If you have a smart display on your desk, you want it to show the current weather. Instead of just checking a weather app, you can use Python to pull live data from an API.

Using the requests library and Open-Meteo (a free, no-key weather API), you can fetch the temperature for your city and print it out. You could even set this to run every morning when you boot up your PC.

import requests

lat, lon = 40.7128, -74.0060

url = f"https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}&current_weather=true"
response = requests.get(url).json()

temp = response["current_weather"]["temperature"]
print(f"The current temperature outside is {temp}°C.")
Enter fullscreen mode Exit fullscreen mode

5. The “Clean My Screen” Notifier

When you are deep into a coding project or gaming session, hours can pass. Python can act as your personal desktop assistant, reminding you to take a break or clean your screen.

Using the plyer library, you can send native desktop notifications on Windows, Mac, or Linux.

import time
from plyer import notification

def remind_me():
    notification.notify(
        title="Time to take a break!",
        message="You've been staring at the screen for an hour. Grab some water!",
        timeout=10
    )

remind_me()
Enter fullscreen mode Exit fullscreen mode

Conclusion

Python is more than just a language for web servers and data science—it is the ultimate automation tool for your digital life. Whether you are organizing files, testing your Wi-Fi, or building desktop notifications, these scripts prove that a little bit of code can save a whole lot of time.

You don't need to be a senior developer to use these. Copy the code, tweak it to fit your setup, and start automating.

Top comments (0)