You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: _posts/2024-06-28-github-paint.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ A few years ago I encountered the GitHub profile of someone who created a fake c
14
14
Since my contribution graph usually looks like this:
15
15
16
16

17
-
_here, less is not more_
17
+
_< tumbleweed emoji >_
18
18
19
19
\.\.\.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*).
20
20
@@ -26,20 +26,20 @@ a GitHub Action which\-\-given a string, a GitHub API token, and any optional pa
26
26
27
27

28
28
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.
30
30
31
31
## how it works
32
32
33
33
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:
34
34
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`.
36
36
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).
37
37
1. Then, we map each pixel in the window to its corresponding date.
38
38
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.
39
39
* 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).
40
40
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).
41
41
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.
42
42
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).
0 commit comments