Skip to content

Instantly share code, notes, and snippets.

View R4YGULAR's full-sized avatar
💻
grinding

Ray R4YGULAR

💻
grinding
View GitHub Profile
@R4YGULAR
R4YGULAR / monitor.py
Created March 18, 2024 08:16
Kill program (like a game) after a certain period of time.
import psutil
import time
import argparse
import sys
def find_process_by_name(name: str):
process_list = []
for proc in psutil.process_iter():
try:
pinfo = proc.as_dict(attrs=['pid', 'name', 'create_time'])