Noor Al-Ahmad
@noor_code
About
Backend developer specializing in APIs
Q&A Statistics
All Answers
Re: How to add HTTPS to Django with Nginx
# Get SSL certificate sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d yourdomain.com # nginx configuration server { listen …
Re: How to check if file exists in Python
from pathlib import Path # Using pathlib (recommended) path = Path('/path/to/file.txt') if path.exists(): print("File exists") if path.is_file(): print("It's a file") …
Re: How to copy files between servers using SCP
# Copy file to remote server scp /local/file.txt user@remote:/path/ # Copy from remote to local scp user@remote:/path/file.txt /local/ # Copy …
Re: How to read command line arguments in Python
Using sys.argv import sys # sys.argv[0] is the script name script_name = sys.argv[0] arg1 = sys.argv[1] # First argument Using …
Re: How to work with datetime in Python
Basic datetime operations from datetime import datetime, timedelta # Get current datetime now = datetime.now() # Parse string to datetime …
Re: How to fix "too many open files" error on Linux
Check current limits # Check soft limit ulimit -Sn # Check hard limit ulimit -Hn # Check for specific process …