Skip to content

Instantly share code, notes, and snippets.

@mpadge
Created July 2, 2024 14:06
Show Gist options
  • Save mpadge/bc92edf3cfc1229df223ea4780950426 to your computer and use it in GitHub Desktop.
Save mpadge/bc92edf3cfc1229df223ea4780950426 to your computer and use it in GitHub Desktop.
GitHub commit history hack (in R)
# Hand-coded letter forms (created for 2024-07-02):
dates <- c (
# ->
"20230705",
"20230712",
"20230717",
"20230719",
"20230721",
"20230725",
"20230726",
"20230726",
"20230802",
# R
"20230821",
"20230822",
"20230823",
"20230824",
"20230825",
"20230826",
"20230827",
"20230830",
"20230821",
"20230903",
"20230906",
"20230908",
"20230910",
"20230911",
"20230912",
"20230913",
"20230916",
# O
"20230925",
"20230926",
"20230927",
"20230928",
"20230929",
"20231001",
"20231007",
"20231008",
"20231014",
"20231016",
"20231017",
"20231018",
"20231019",
"20231020",
# P
"20231029",
"20231030",
"20231031",
"20231101",
"20231102",
"20231103",
"20231104",
"20231105",
"20231108",
"20231112",
"20231115",
"20231120",
"20231121",
# E
"20231126",
"20231127",
"20231128",
"20231129",
"20231130",
"20231201",
"20231202",
"20231203",
"20231206",
"20231209",
"20231210",
"20231213",
"20231216",
"20231217",
"20231223",
# N
"20231231",
"20240101",
"20240102",
"20240103",
"20240104",
"20240105",
"20240106",
"20240108",
"20240109",
"20240110",
"20240117",
"20240118",
"20240119",
"20240121",
"20240122",
"20240123",
"20240124",
"20240125",
"20240126",
"20240127",
# S
"20240205",
"20240206",
"20240210",
"20240211",
"20240214",
"20240217",
"20240218",
"20240221",
"20240224",
"20240225",
"20240229",
"20240301",
# C
"20240311",
"20240312",
"20240313",
"20240314",
"20240315",
"20240317",
"20240323",
"20240324",
"20240330",
"20240331",
"20240406",
# I
"20240421",
"20240422",
"20240423",
"20240424",
"20240425",
"20240426",
"20240427",
# <-
"20240515",
"20240521",
"20240522",
"20240523",
"20240527",
"20240529",
"20240531",
"20240605",
"20240612",
"20240619"
)
dates <- as.character (lubridate::ymd (dates))
plus <- TRUE
n <- 200 # commits per day
for (d in dates) {
for (i in seq_len (n)) {
ts0 <- paste (d, hms::hms (i))
if (plus) {
writeLines ("plus", "file.txt")
plus <- FALSE
} else {
writeLines ("minus", "file.txt")
plus <- TRUE
}
withr::with_envvar (
list ("GIT_COMMITTER_DATE" = ts0, "GIT_AUTHOR_DATE" = ts0),
{
system ("git add file.txt")
system (paste0 ("git commit -m 'commit: ", ts0, "'"))
}
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment