We made it! Today is Day100 of 100 days of code!!
For the last day, I want to see when I made my commits. In other words, when did I actually post for each of the 100 days.
The R Markdown for this little project is found here.
Getting the data
But before I can get my answer, I need data. These posts were committed to Github using git (a version control system), which I can use to tracks when the commits where made. To get all the commits made on the master branch, I use:
git log master > git-commits.blog.2017-06-04.log
Now that I have the date and time information of all commits, further processing is needed to wrangle the data to a workable format:
# ------------------------------------------------------------------------------
# The following code reformats this input:
#
# commit ddf53d3b9054a537b16d2ad217c7435a976c871f
# Author: csiu
# Date: Sun Jun 4 02:19:12 2017 -0700
#
# constraints vs priors
#
# commit cd0160bf7f233d5e9bccff5bc7f3079852b43910
# Author: csiu
# Date: Sat Jun 3 01:55:02 2017 -0700
#
# more fixes -- doesn't help to be doing this at 2 in the morning
#
# ------------------------------------------------------------------------------
# To this output:
#
# Date: Sun Jun 4 02:19:12 2017 -0700 constraints vs priors
# Date: Sat Jun 3 01:55:02 2017 -0700 more fixes -- doesn't help to be doing this at 2 in the morning
cat git-commits.blog.2017-06-04.log |
grep -A2 ^Date |
perl -pe 's|^\s+||' |
grep -vE '^-{0,2}$' |
tr '\n' '\t' |
perl -pe 's|$|\n|; s|Date|\nDate|g' |
perl -pe 's|\t$||g; s|^Date:\s{4}||' |
grep -v "^$" > \
git-commits.blog.2017-06-04.txt
The bash one-liner is ugly, but it does its job.
Number of commits
Reading the data into R, I need to properly handle the date and time information. I do this by using functions from the lubridate
R package (see the R Markdown for details).
100 Days of Code: 2017-02-25 to 2017-06-04
Restricting the commits to be within the 100 days, I find 160 commits. Ideally there is one commit per day for each of the 100 days, but this was obviously not the case.
When I tally the commits, most commits in a day were made during the second week of April (a couple days before my Whistler trip).
Commit times
Another good question to ask is: what time do I generally make my commits.
Centering the commits around midnight, we can see there are a couple nice-let-me-sleep-early ones made around 10PM and some not-nice-I-probably-won’t-get-much-sleep-and-would-need-caffeine ones past 2 in the morning (such would be the case for Day 100 as well).
For the most part, commits to the 100 days of code were made past midnight.
*Sigh, at least I am consistent.
What next?
Now that this side project has reached its end, I will have time on my hand to concentrate on other projects. In the near future, I want to reorganize this project so that its nicely laid out and searchable.