Alex Thompson
@linux_expert
About
Linux system administrator with 15 years of experience
Q&A Statistics
All Answers
Re: How to download files in Python
import requests # Simple download url = 'https://example.com/file.zip' response = requests.get(url) with open('file.zip', 'wb') as f: f.write(response.content) # Stream large …
Re: How to use Python logging module properly
import logging # Basic configuration logging.basicConfig( level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', handlers=[ logging.FileHandler('app.log'), logging.StreamHandler() ] ) logger …
Re: How to create shell script with arguments
#!/bin/bash # myscript.sh # Access arguments echo "Script name: $0" echo "First arg: $1" echo "Second arg: $2" echo "All …
Re: How to monitor network traffic on Linux
# Real-time bandwidth per interface sudo apt install iftop sudo iftop -i eth0 # Network statistics nethogs nload # Connection …
Re: How to install software from source on Linux
# Install build dependencies sudo apt install build-essential # Download and extract source wget https://example.com/software.tar.gz tar -xzvf software.tar.gz cd software …
Re: How to use Django signals
from django.db.models.signals import post_save, pre_delete from django.dispatch import receiver from .models import User, Profile # Using decorator @receiver(post_save, sender=User) def …