commit 465b5e047c1c3c664fedb9f1d8ac15a7c87e427b from: Rohan Verma date: Wed Sep 30 03:30:19 2026 UTC contrib chart: half-year version for phones commit - 345ec100b5ccad3d06f76def8bf4ad10e19bf36e commit + 465b5e047c1c3c664fedb9f1d8ac15a7c87e427b blob - 8b52a96285c3f5641afc0b80af3319368dde1c03 blob + 997f31d25d163cb25bb799bd71b700d31e59318c --- index.html +++ index.html @@ -103,6 +103,8 @@

Contributions

+ + Contribution graph for the last year across Got, sourcehut and GitHub blob - /dev/null blob + 5af78a44cfe82e3c9c74aaa5f3a54aaf6ecb5606 (mode 644) --- /dev/null +++ static/contrib-half-dark.svg @@ -0,0 +1,34 @@ + + +Apr +May +Jun +Jul +Aug +Sep +MonWedFri + + + + + + + + + + + + + + + + + + + + + + + +111 contributions in the last six months + blob - /dev/null blob + 7f12e056a05588daea8fdf5dbe4ed7a646e216a4 (mode 644) --- /dev/null +++ static/contrib-half.svg @@ -0,0 +1,34 @@ + + +Apr +May +Jun +Jul +Aug +Sep +MonWedFri + + + + + + + + + + + + + + + + + + + + + + + +111 contributions in the last six months + blob - 874827df3a2ec9591f84cd5c344889bcadd91980 blob + 326a1d7af1d1d14ff904d6f08fd59e98c52be391 --- tools/contrib.sh +++ tools/contrib.sh @@ -21,7 +21,8 @@ # SKIP repo names (without .git) that are also pushed to GitHub, so # their commits are not counted twice # OUT output SVG path (default static/contrib.svg); -# a dark version is written next to it as NAME-dark.svg +# a dark version is written next to it as NAME-dark.svg, and a +# half-year chart for phones as NAME-half.svg and NAME-half-dark.svg set -eu @@ -115,7 +116,9 @@ if [ -n "$GH_USER" ]; then fi fi -awk -v today="$(date +%Y-%m-%d)" ' +# chart WEEKS: the last WEEKS columns of days as an SVG, style left as @STYLE@ +chart() { +awk -v today="$(date +%Y-%m-%d)" -v weeks="$1" ' # days since 1970-01-01 (proleptic Gregorian) function days(s, p, y, m, d, era, yoe, doy) { split(s, p, "-"); y = p[1] + 0; m = p[2] + 0; d = p[3] + 0 @@ -143,7 +146,7 @@ END { split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", mon, " ") end = days(today) dow = (end + 4) % 7 # 0 = Sunday - start = end - dow - 52 * 7 # Sunday, 53 columns + start = end - dow - (weeks - 1) * 7 # Sunday, one column per week # shade with the level boundaries GitHub uses, so GitHub days match ghchart; # without GitHub data, fall back to quartiles of the non-zero days if (lvmax[1] && lvmax[2] && lvmax[3]) { @@ -159,23 +162,23 @@ END { } step = 12; left = 24; top = 15 - w = left + 53 * step - 2; h = top + 7 * step + 13 + w = left + weeks * step - 2; h = top + 7 * step + 13 printf "\n", w, h, w, h print "" # month labels where a new month starts within a column last = -1 - for (c = 0; c < 53; c++) { + for (c = 0; c < weeks; c++) { civil(start + c * 7) - if (CM != last && CD <= 7 && c < 52) printf "%s\n", left + c * step, mon[CM] + if (CM != last && CD <= 7 && c < weeks - 1) printf "%s\n", left + c * step, mon[CM] last = CM } printf "MonWedFri\n", top + 20, top + 44, top + 68 # empty days are a tiled pattern; only active days get their own square printf "\n", left, top, step, step - printf "\n", left, top, 52 * step - 2, 7 * step - 2 - printf "\n", left + 52 * step, top, step - 2, (dow + 1) * step - 2 + printf "\n", left, top, (weeks - 1) * step - 2, 7 * step - 2 + printf "\n", left + (weeks - 1) * step, top, step - 2, (dow + 1) * step - 2 total = 0 for (n = start; n <= end; n++) { v = cnt[n] + 0 @@ -184,11 +187,20 @@ END { l = v <= q1 ? 1 : v <= q2 ? 2 : v <= q3 ? 3 : 4 printf "\n", l, left + int(i / 7) * step, top + i % 7 * step } - printf "%d contribution%s in the last year\n", left, h - 2, total, (total == 1 ? "" : "s") + printf "%d contribution%s in the last %s\n", left, h - 2, total, (total == 1 ? "" : "s"), (weeks > 26 ? "year" : "six months") print "" -}' "$tmp/days" > "$tmp/chart" +}' "$tmp/days" +} -sed "s|@STYLE@|$LIGHT|" "$tmp/chart" > "$tmp/light.svg" -sed "s|@STYLE@|$DARK|" "$tmp/chart" > "$tmp/dark.svg" -mv "$tmp/light.svg" "$OUT" -mv "$tmp/dark.svg" "${OUT%.svg}-dark.svg" +# write NAME CHART: light and dark versions of CHART as NAME.svg and NAME-dark.svg +write() { + sed "s|@STYLE@|$LIGHT|" "$2" > "$tmp/light.svg" + sed "s|@STYLE@|$DARK|" "$2" > "$tmp/dark.svg" + mv "$tmp/light.svg" "$1.svg" + mv "$tmp/dark.svg" "$1-dark.svg" +} + +chart 53 > "$tmp/year" +chart 26 > "$tmp/half" +write "${OUT%.svg}" "$tmp/year" +write "${OUT%.svg}-half" "$tmp/half"