Reference library

Automation & scripting

CLI tools, scheduled jobs, filesystem tasks, and glue scripts that save time.

2 matches
Automation & scripting easy

How to Check Website Status Codes in Python

This script checks the HTTP status codes of multiple URLs concurrently using a thread pool and prints the results.

requests threading http-status
Python
import requests
from concurrent.futures import ThreadPoolExecutor

URLS = [
    "https://www.google.com",
    "https://www.python.org",
    "https://www.nonexistent-site-12345.com",
    "https://www.github.com",
]

def check_status(url):
    try:
        response = requests.get(url, timeout=5)
        return url, resp…
11 0 Open
Automation & scripting easy

Stress CPU Threads with a Mock Compute in Python

Simulates CPU-intensive work across multiple threads to test how Python schedules parallel compute.

threading cpu-stress parallelism
Python
import threading
import time


def stress_cpu(iterations: int):
    result = 0
    for i in range(iterations):
        result += i * i % 1000
    return result


def run_mock_stress(thread_count: int, iterations: int):
    threads = []
    for tid in range(thread_count):
        t = threading.Thread(target=lambda: str…
12 0 Open

Browse by section

Each section groups closely related Python snippets.

Automation & scripting — Python code examples

What you will find here

This page collects automation & scripting snippets — short, copy-ready Python you can paste into our free online IDE and run without installing anything. Each sample includes a plain-English explanation and the full source code.

Samples vs tutorials and challenges

Samples are quick reference — one concept per page. For step-by-step teaching, use our Python tutorials. To test yourself, try quizzes or coding challenges. Clean up style with the Python formatter.