DEV Community

Prahlad Yeri
Prahlad Yeri

Posted on

gar-cron: A python script to remind you about your github activity

Dear Folks,

Since last few days, I've been working on a side project called gar-cron and in this post I'd like to share with you its details.

If you are like most coders (at least the open source enthusiastic ones), you want your github commits activity look like this, isn't it?

good committer

But sometimes, we get involved in some personal issues or loose interest in coding altogether which isn't good, especially if your career depends on coding. Programming is 90% a practical science and the more you practice, the better you'll be in your trade.

If you loose track, it then turns into a cycle - you don't code, so you get depressed and depression further keeps you away from writing more code. This is quite similar to a phenomena called writer's block which is quite common among fiction writers, writing and coding has lots of similarities, after all!

It has happened to me also several times and in times like these, I wish there was some guardian angel who'd simply command me to start a project and get coding (and keeps nagging until I actually start coding).

gar-cron (or github activity reminder cron) is an attempt to create that guardian angel! Simply speaking, gar-cron is a python script which monitors your github activity and shoots you an email if you haven't committed anything since last 3 days. It does this each time it runs, so you can schedule this to run once or twice per day.

You can configure it to run as a cron on your linux machine by running crontab -e, or using the scheduler through control panel on your windows machine.

You'll also need an email account with an email provider who supports email sending through SMTP. Popular ones like GMail/Hotmail don't support this without oAuth, but you can register one at gmx.com or something.

Installation of the cron is as simple as:

pip install gar-cron
Enter fullscreen mode Exit fullscreen mode

And to run it, you can simply:

gar-cron
Enter fullscreen mode Exit fullscreen mode

When you run gar-cron for the first time, it will prompt you to set values in config.json along with its path. The values you need to set should be as follows:

{
    "github_username": "<your github username>",
    "alert_email": "<your email address>",
    "smtp_server":"<smtp server>",
    "smtp_email": "<smtp sending email>",
    "smtp_username": "<smtp username>",
    "smtp_password": "<smtp password>",
    "smtp_port": "<smtp port>"
}
Enter fullscreen mode Exit fullscreen mode

Once you do this, run gar-cron again to ensure that it works. You may then configure it as a user cron job on linux by running crontab -e or on windows by scheduling it through the control panel.

For testing of email reminder, you may temporarily configure someone else's github_username in config.json who hasn't committed since a long time before running it. If you face any issues, you may raise them on the github issue tracker.

Happy coding!

Top comments (0)