Skip to content

Commit 273b6b4

Browse files
committed
More tweaks.
1 parent bc508cf commit 273b6b4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

_posts/2024-06-28-github-paint.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A few years ago I encountered the GitHub profile of someone who created a fake c
1414
Since my contribution graph usually looks like this:
1515

1616
![a picture of a pretty empty contribution graph](/assets/img/github-paint/theos-usual-contribution-graph.png)
17-
_here, less is not more_
17+
_< tumbleweed emoji >_
1818

1919
\.\.\.I've always had it in the back of my mind as something I'd like to take a stab at. Primarily for the sake of solving an interesting problem, but also to fuck with recruiters who believe contribution activity strongly correlates with programming ability (*said with chip on shoulder as someone required to use a separate GitHub account for work*).
2020

@@ -26,20 +26,20 @@ a GitHub Action which\-\-given a string, a GitHub API token, and any optional pa
2626

2727
![the text "theo.lol" written in tbrockman's contribution graph](/assets/img/github-paint/example.png)
2828

29-
Since it's a GitHub Action, you can also configure it to run periodically such that your contribution graph always shows the same text as time goes on.
29+
Since it's a GitHub Action, you can also configure it to run periodically such that your contribution graph always shows the text in the same position as time goes on.
3030

3131
## how it works
3232

3333
The whole thing is a Python [Typer-CLI](https://typer.tiangolo.com/) that primarily makes calls to [`gh`](https://cli.github.com/) and [`git`](https://git-scm.com/), orchestrating the following:
3434

35-
1. First, we create a window where `x = number_of_weeks_in_timeframe` and `y = 7`.
35+
1. First, we create a pixel grid where `width = number_of_weeks_in_timeframe` and `height = 7`.
3636
1. Then, we take our (potentially repeated) text, determine its size given the font (and the dimensions of each glyph used), and position it within the window (given specified padding and alignment).
3737
1. Then, we map each pixel in the window to its corresponding date.
3838
1. Then, retrieving the users existing contribution activity for each date, we determine (given [some secret sauce](https://stackoverflow.com/a/78686095/23271846) on how commit activity correlates to pixel color) how many additional commits we need on that day.
3939
* If we actually need *fewer*, we can handle this by adding more commits to *other* days\-\-assuming our target isn't zero commits (that would be pretty hard to do).
4040
1. Then, after initializing a fresh `git` repository, for each day (in the appropriate chronological order\-\-though this doesn't seem to matter much to GitHub), we forge the necessary number of commits on each date (since `git` allows setting arbitrary commit timestamps).
4141
1. Finally, push the new repository and history (deleting the old one if it exists), and wait a bit for GitHub to render our shiny new contribution graph.
4242

43-
So far, it seems to work pretty well, but it's not *super* battle-tested, so if you run into issues feel free to create a pull request: [https://github.com/tbrockman/github-paint](https://github.com/tbrockman/github-paint).
43+
So far, it seems to work pretty well, but it's not *super* battle-tested. if you run into issues feel free to create a pull request: [https://github.com/tbrockman/github-paint](https://github.com/tbrockman/github-paint).
4444

4545
hope you like it!

0 commit comments

Comments
 (0)