Skip to content

Instantly share code, notes, and snippets.

View nitish6174's full-sized avatar

Nitish Garg nitish6174

View GitHub Profile
from crontab import CronTab
from datetime import datetime
cron = CronTab()
cmds = {
'python ~/code/reminder.py': '0/30 9-18 * * *',
'~/code/backup.sh': '0/30 9-18 * * *',
}
for cmd, cron_str in cmds.items():
"""
Module containing utility functions to time code snippets.
"""
import contextlib
import time
@contextlib.contextmanager
def timelogger(msg_prefix:str='Executed in : ', msg_suffix:str='s', logger=print):