Cooper Leong

Github LogoLogoLogo

cronPush - Lighting up my Github contributions

Bash, Cron Job

There is something ultimately satisfying about seeing a Github overview that offers a beautiful display of green tinted blocks. Take a look at Linus Torvalds Github overview:

Linus Torvalds Github Overview

Isn't that beautiful? I know that I couldn't be the next Linus Torvalds, but there would be a way to get that overview to light up like that.

The plan was simple: write a bash script that pushed something to Github that ran on a cron job. So that's exactly what I did! You can view the project here.

How the pipeline works is that it will randomly run a bash script that appends text to a .txt file, commits it and then pushed to Github. Now the issue was that if I were to do this, it would look awfully suspicious if I had a set number of commits pushed at the same time every day. To fix this, I added arguments to the cron job so that it would run randomly between the hours of 9 AM and 5 PM, giving an even distribution of commits throughout the work day, mimicking actual work.

Some may say that this is a cheat of the system, but it is all public for anyone to see, I'm not trying to fool anyone into hiring me or thinking that I am some unbound programmer, it was just a fun exercise to see if I could make my overview look as illuminated as others. For more peace of mind, during my full-time internship we used Bitbucket instead of Github, so there were a myriad of commits that were made to Bitbucket, but not shown on Github, if that gives me and justification.

I had a lot of fun on this project, it was my introduction to cron jobs and was the most involved I had been with writing bash scripts.

Here is a look at what cronPush achieved, while developing initially there was a day with 120 commits of just appending text! Still no Linus Torvalds, but we'll get there. Cooper Leong Github Overview


Mistakes and Lessons Learned

There are a number of things that I would change if I were to do it again. I didn't focus as much on the saving of the .txt files or implementing any nicer temporary files to run the script, it was more of a "if it works it works " project. This is something that came back to bite me a few months after I left cronPush running on my crontab, and the local files were no longer accessible in the path that I had chosen, so I had to reroute a lot of work and store files in different locations to allow cronPush to still be active (this is when there is a large gap in my overview, I just didn't get around to fixing it for a while).

I would also have looked more into having the cron job hosted somewhere other than my local machine, since it currently only runs when I am using my laptop, which isn't an issue because it is typically in use throughout the work day from 9 - 5. Although when it isn't in use, the script will not run.