Skip to content

Instantly share code, notes, and snippets.

View R4YGUL4RiZ3's full-sized avatar
💀

Ray R4YGUL4RiZ3

💀
View GitHub Profile
@R4YGUL4RiZ3
R4YGUL4RiZ3 / 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'])