├── .gitignore ├── LICENSE ├── README.md ├── data.json ├── index.js ├── package-lock.json └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional stylelint cache 58 | .stylelintcache 59 | 60 | # Microbundle cache 61 | .rpt2_cache/ 62 | .rts2_cache_cjs/ 63 | .rts2_cache_es/ 64 | .rts2_cache_umd/ 65 | 66 | # Optional REPL history 67 | .node_repl_history 68 | 69 | # Output of 'npm pack' 70 | *.tgz 71 | 72 | # Yarn Integrity file 73 | .yarn-integrity 74 | 75 | # dotenv environment variable files 76 | .env 77 | .env.development.local 78 | .env.test.local 79 | .env.production.local 80 | .env.local 81 | 82 | # parcel-bundler cache (https://parceljs.org/) 83 | .cache 84 | .parcel-cache 85 | 86 | # Next.js build output 87 | .next 88 | out 89 | 90 | # Nuxt.js build / generate output 91 | .nuxt 92 | dist 93 | 94 | # Gatsby files 95 | .cache/ 96 | # Comment in the public line in if your project uses Gatsby and not Next.js 97 | # https://nextjs.org/blog/next-9-1#public-directory-support 98 | # public 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # vuepress v2.x temp and cache directory 104 | .temp 105 | .cache 106 | 107 | # Docusaurus cache and generated files 108 | .docusaurus 109 | 110 | # Serverless directories 111 | .serverless/ 112 | 113 | # FuseBox cache 114 | .fusebox/ 115 | 116 | # DynamoDB Local files 117 | .dynamodb/ 118 | 119 | # TernJS port file 120 | .tern-port 121 | 122 | # Stores VSCode versions used for testing VSCode extensions 123 | .vscode-test 124 | 125 | # yarn v2 126 | .yarn/cache 127 | .yarn/unplugged 128 | .yarn/build-state.yml 129 | .yarn/install-state.gz 130 | .pnp.* 131 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Harsh Mehta 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🌱 goGreen 2 | 3 | With **goGreen**, you can make your profile look like you've been hard at work... even if you haven't. 4 | NodeJs script to make commits to the past (or the future) to go green on GitHub. 5 | 6 | ## About 7 | 8 | **goGreen** helps you create commits on your GitHub profile for any date in the past. Whether you want to fill up your contribution graph or even make cool patterns and artwork. 9 | 10 | ## Getting Started 11 | 12 | Follow these steps to bring your contribution graph to life: 13 | 14 | 1. **Clone this repository** 15 | ```bash 16 | git clone https://github.com/fenrir2608/goGreen.git 17 | cd goGreen 18 | ``` 19 | 3. **Set up your project** 20 | Initialize a new Node.js project: 21 | ```bash 22 | npm init -y 23 | ``` 24 | 3. **Install the required npm modules** 25 | You'll need a few modules to get everything running smoothly. Install them all with: 26 | ```bash 27 | npm install moment simple-git random 28 | ``` 29 | 4. **Create your commit script** 30 | - Create a JavaScript file to manage your commits. 31 | - Create a JSON file to store all the commit timestamp data. 32 | 33 | ## Room for Improvement 34 | 35 | So, you've got the basics down. What's next? 36 | 37 | - **Custom Patterns:** Experiment with different patterns on your contribution graph. Maybe spell out your name or create some cool designs. 38 | - **Density Control:** Play around with the number of commits per day to adjust the shades of green. 39 | - **Input Strings:** Convert input strings to X-Y mapped contributions. 40 | 41 | ## npm Modules Used 42 | 43 | - [`moment`](https://www.npmjs.com/package/moment) - Handles date and time manipulation. 44 | - [`simple-git`](https://www.npmjs.com/package/simple-git) - For easy Git commands. 45 | - [`random`](https://www.npmjs.com/package/random) - To generate random numbers for the commits. 46 | 47 | ## Credits 48 | 49 | Huge thanks to [Akshay Saini](https://github.com/akshaymarch7) for the original video behind this project. 50 | -------------------------------------------------------------------------------- /data.json: -------------------------------------------------------------------------------- 1 | {"date":"2024-01-29T18:45:15+05:00"} 2 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import jsonfile from "jsonfile"; 2 | import moment from "moment"; 3 | import simpleGit from "simple-git"; 4 | import random from "random"; 5 | 6 | const path = "./data.json"; 7 | 8 | const markCommit = (x, y) => { 9 | const date = moment() 10 | .subtract(1, "y") 11 | .add(1, "d") 12 | .add(x, "w") 13 | .add(y, "d") 14 | .format(); 15 | 16 | const data = { 17 | date: date, 18 | }; 19 | 20 | jsonfile.writeFile(path, data, () => { 21 | simpleGit().add([path]).commit(date, { "--date": date }).push(); 22 | }); 23 | }; 24 | 25 | const makeCommits = (n) => { 26 | if(n===0) return simpleGit().push(); 27 | const x = random.int(0, 54); 28 | const y = random.int(0, 6); 29 | const date = moment().subtract(1, "y").add(1, "d").add(x, "w").add(y, "d").format(); 30 | 31 | const data = { 32 | date: date, 33 | }; 34 | console.log(date); 35 | jsonfile.writeFile(path, data, () => { 36 | simpleGit().add([path]).commit(date, { "--date": date },makeCommits.bind(this,--n)); 37 | }); 38 | }; 39 | 40 | makeCommits(100); 41 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "thomyorke", 3 | "version": "1.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "thomyorke", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "jsonfile": "^6.1.0", 13 | "moment": "^2.30.1", 14 | "random": "^4.1.0", 15 | "simple-git": "^3.27.0" 16 | } 17 | }, 18 | "node_modules/@kwsites/file-exists": { 19 | "version": "1.1.1", 20 | "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", 21 | "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", 22 | "dependencies": { 23 | "debug": "^4.1.1" 24 | } 25 | }, 26 | "node_modules/@kwsites/promise-deferred": { 27 | "version": "1.1.1", 28 | "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", 29 | "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==" 30 | }, 31 | "node_modules/debug": { 32 | "version": "4.3.7", 33 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", 34 | "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", 35 | "dependencies": { 36 | "ms": "^2.1.3" 37 | }, 38 | "engines": { 39 | "node": ">=6.0" 40 | }, 41 | "peerDependenciesMeta": { 42 | "supports-color": { 43 | "optional": true 44 | } 45 | } 46 | }, 47 | "node_modules/graceful-fs": { 48 | "version": "4.2.11", 49 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", 50 | "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", 51 | "optional": true 52 | }, 53 | "node_modules/jsonfile": { 54 | "version": "6.1.0", 55 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", 56 | "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", 57 | "dependencies": { 58 | "universalify": "^2.0.0" 59 | }, 60 | "optionalDependencies": { 61 | "graceful-fs": "^4.1.6" 62 | } 63 | }, 64 | "node_modules/moment": { 65 | "version": "2.30.1", 66 | "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", 67 | "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", 68 | "engines": { 69 | "node": "*" 70 | } 71 | }, 72 | "node_modules/ms": { 73 | "version": "2.1.3", 74 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 75 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 76 | }, 77 | "node_modules/random": { 78 | "version": "4.1.0", 79 | "resolved": "https://registry.npmjs.org/random/-/random-4.1.0.tgz", 80 | "integrity": "sha512-6Ajb7XmMSE9EFAMGC3kg9mvE7fGlBip25mYYuSMzw/uUSrmGilvZo2qwX3RnTRjwXkwkS+4swse9otZ92VjAtQ==", 81 | "dependencies": { 82 | "seedrandom": "^3.0.5" 83 | }, 84 | "engines": { 85 | "node": ">=14" 86 | } 87 | }, 88 | "node_modules/seedrandom": { 89 | "version": "3.0.5", 90 | "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", 91 | "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" 92 | }, 93 | "node_modules/simple-git": { 94 | "version": "3.27.0", 95 | "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.27.0.tgz", 96 | "integrity": "sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA==", 97 | "dependencies": { 98 | "@kwsites/file-exists": "^1.1.1", 99 | "@kwsites/promise-deferred": "^1.1.1", 100 | "debug": "^4.3.5" 101 | }, 102 | "funding": { 103 | "type": "github", 104 | "url": "https://github.com/steveukx/git-js?sponsor=1" 105 | } 106 | }, 107 | "node_modules/universalify": { 108 | "version": "2.0.1", 109 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", 110 | "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", 111 | "engines": { 112 | "node": ">= 10.0.0" 113 | } 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "thomyorke", 3 | "version": "1.0.0", 4 | "description": "nice dream", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "jsonfile": "^6.1.0", 15 | "moment": "^2.30.1", 16 | "random": "^4.1.0", 17 | "simple-git": "^3.27.0" 18 | } 19 | } 20 | --------------------------------------------------------------------------------