top of page
Search

Is the GitHub Calendar the mark of success?

For awhile, I underestimated the power and importance of GitHub. A friend of mine at Hamline told me about it, and that it was mentioned to him during an interview as an important part of any data scientist-wannabe's online portfolio. He pitched it to me as "social media for people who code". At that time I knew nothing about Git and version control, so it seemed like a relatively nuanced thing to me: basically a place to show off the code you had written, and say "Hey, look at this cool thing I did", and effectively some of that still applies, but the overarching point I'm trying to make is the created importance of the Contribution Calendar.


If you use GitHub, or have perused someone's profile, you've definitely seen the 53 columns of 7 squares showing someone's contributions to their profile. Certain profiles have tons of contributions, while most others have just a few. For some reason this seems like the mark of quality for anyone who codes, although it inherently isn't; it's a mark of how many times someone has pushed something to their profile.


This finally came full circle to me today when I was in a call with some people I was working with. They had seen my profile and said I "didn't have the output" they expected. Part of me felt besmirched by this, but the other part felt that this was a stupid comment (no offense). As a data scientist, so much of what you do is applied and private. Sure, ML researchers and more software engineering types have the ability to push commits daily akin to each local save, thus filling their contribution calendars.


So today, after hearing that I decided to look for a way to force change the date of commits. I knew about the extension --allow-empty for blank commits, but then thanks to a StackOverflow thread, I found that you can add --date to the commit line and force Git to add the commit under the specified date. So naturally, I broke out Python and Git Bash to make some commits.


I had used PyAutoGUI before for stupid things, like texting my mom the script of The Bee Movie word for word. Basically, it's a module for programmatically making your computer act like you were naturally using it. It can "type" what you tell it, and this was my use case for it. I also hacked together some code to pick a random date within an interval.


import pyautogui
import random
import time

def str_time_prop(start, end, format, prop):

    stime = time.mktime(time.strptime(start, format))
    etime = time.mktime(time.strptime(end, format))

    ptime = stime + prop * (etime - stime)

    return time.strftime(format, time.localtime(ptime))


def random_date(start, end, prop):
 return str_time_prop(start, end, '%Y-%m-%d', prop)

time.sleep(5)

pyautogui.typewrite("""cd C:/RScripts/contribution-dump
""")
time.sleep(1)
pyautogui.typewrite('git init')

for i in range(250):
   date = random_date("2020-01-01""2020-11-09", random.random())

   message = f"""git commit --allow-empty --date "{date}" -m "{date}"
   git push
   """
   pyautogui.typewrite(message)

Basically, the gist of the code is to pick a random date in the interval specified, insert that into the commit command, make python paste that into CMD and paste the push statement. Iterate that a bunch, and congrats, you have a cool Contribution Calendar.

 
 
 

Recent Posts

See All
On Doing Data While Studying Data

Despite all the drawbacks of the ongoing COVID pandemic, one of its main highlights has been its effect on my career. I started work at...

 
 
 

Commentaires


ARGEROS

© 2021 by Andrew Argeros

bottom of page