Hassan Ali
@hassan_ops
About
Site reliability engineer
Q&A Statistics
Recent Questions
How to install software from source on Linux
How to read CSV files in Python
How to sort a list of dictionaries in Python
How to redirect output to file in bash
How to schedule tasks with cron on Linux
Recent Answers
View all →Re: How to create and use Python decorators
import functools import time # Basic decorator def my_decorator(func): @functools.wraps(func) def wrapper(*args, **kwargs): print("Before function") result = func(*args, **kwargs) print("After …
Re: How to search text in files using grep
# Basic search grep "pattern" file.txt # Recursive search in directory grep -r "pattern" /path/ # Case insensitive grep -i …
Re: How to manage services with systemd
# Start/stop service sudo systemctl start nginx sudo systemctl stop nginx sudo systemctl restart nginx sudo systemctl reload nginx # …
Re: How to create a class in Python
class User: # Class variable user_count = 0 def __init__(self, name, email): self.name = name self.email = email User.user_count += …
Re: How to create custom Django management commands
Create command file structure myapp/ management/ __init__.py commands/ __init__.py mycommand.py Write the command # myapp/management/commands/mycommand.py from django.core.management.base import BaseCommand class …
Recent Articles
Open Source Projects
No projects yet.