Skip to content

Instantly share code, notes, and snippets.

@GeoffreyHervet
Created July 24, 2023 12:29
Show Gist options
  • Save GeoffreyHervet/51e866d17252cf6741087a4dee41dd58 to your computer and use it in GitHub Desktop.
Save GeoffreyHervet/51e866d17252cf6741087a4dee41dd58 to your computer and use it in GitHub Desktop.
Fake contribution github
const dayjs = require("dayjs");
function generateRandomInteger(min, max) {
return Math.floor(min + Math.random() * (max - min + 1));
}
const today = dayjs();
let date = today.subtract(1, "year");
const cmd = `git init && git ci --allow-empty -m 'root' --date '${date.format("YYYY-MM-DD HH:mm:ss")}'`;
console.log(cmd);
while (date.isBefore(today)) {
for (let i = generateRandomInteger(0, 10); i--; i <= 0) {
const dateFormatted = date.format("YYYY-MM-DD HH:mm:ss");
const cmd = `git commit --allow-empty -m 'commit' --date "${dateFormatted}"`;
console.log(cmd);
date = date.add(1, "hour");
}
date = date.add(1, "day");
}
{
"name": "github",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"dayjs": "^1.11.9"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment