Giter VIP home page Giter VIP logo

github-leetcode-stats's Introduction

README build

GitHub and LeetCode Stats Generator

This repository contains a tool that generates dynamically updated statistics for your GitHub profile and LeetCode account.

last automatic update: Monday, 11 March at 19:02 CET

chart-bar

chart-bar

chart-bar

chart-bar


About this project

The idea of this project was to write a script that could display statistics about projects on GitHub and statistics from Leetcode. The challenge was to present this information in the form of a graph in the README.md file. In reality, README.md supports embedding HTML code, but it can be quite cumbersome when trying to create a graph and insert it into the documentation file. Therefore, an alternative approach was chosen where the script would periodically retrieve the latest statistics using API requests and generate an SVG file, which can be displayed nicely in the README.md file.


Features:

  • Generates a chart showing your GitHub contributions
  • Generates a chart showing your GitHub language usage
  • Generates a chart showing your LeetCode statistics
  • Runs automatically every 6 hours through a GitHub Action
  • Supports generated color

Code Structuring:

  • Entry point in the file src/index.js.
  • The file simple.env is used to run the script locally. It needs to be renamed to .env and requires the addition of a GitHub token from step 2 of "How to Use:"
  • The file main.mustache.simple needs to be renamed to main.mustache.
  • The file src/config.js contains a set of colors and parameter names for searching information on GitHub and LeetCode.
  • The file utils/utils.js contains a set of utility functions.
  • The files src/generators/*.js contain builders that assemble the code of SVG files.
  • The files src/services/*.js use requests to the GitHub and LeetCode websites to retrieve up-to-date information.
  • The files in src/templates/ serve as static components for constructing SVG files.

How to Use:

  1. Fork this repository.

  2. Generate a new Personal Access Token (classic) on GitHub and name it GH_TOKEN. Save the token for later use.

    2.1 We're on the GitHub website, and at the top left, you see your avatar. Click and select Settings; 2.2 In the right sidebar choose Developer Settings, click on it; 2.3 Select "Personal access tokens," and then "Tokens (classic)."; 2.4 Click Generate new token
    Screenshot 2023-06-19 at 10 32 39 2.5 Name this token as GH_TOKEN and choose settings: - repo (all) - workflow - write: packages - notifications - user: read:user Screenshot 2023-06-19 at 10 34 41 Screenshot 2023-06-19 at 10 34 58 2.6 Save this new created token in the memory or localy Screenshot 2023-06-19 at 10 35 44
    2.7 Finally you can see your token in the tokens list Screenshot 2023-06-19 at 10 36 25

  3. Create a new secret named GH_TOKEN in your repository's settings under "Secrets and Variables" with your GH_TOKEN value.

    3.1 Open page on your repo and choose Settings Screenshot 2023-06-19 at 10 36 42 3.2 In opened page please see right sidebar and choose Secrets and Variables Screenshot 2023-06-19 at 10 36 54 3.3 Create new secret Screenshot 2023-06-19 at 10 37 08 3.4 Name this secret as GH_TOKEN and put you saved token ghp_HY....... to the Secret... and click "Add Secret" Screenshot 2023-06-19 at 10 38 02

  4. Edit the ./src/config.js file to include your GitHub and LeetCode usernames.

  5. Delete my template mustache file main.mustache and rename main.mustache.simple to main.mustache. main.mustache.simple presents Date values and generated svg charts: bicycle, sledge, circles. You can edit this file as you see fit.

  6. The actions will run automatically every 6 hours. You can see it in .github/workflows/mail.yml

! When you want to start this script locally, need to create a .env file in your forked repository and copy the contents from simple.env. Add the GH_TOKEN, that generated in step 2 to the .env file.

Dependencies:

Future Plans:

  • Adding more animated SVG and statistics
  • Support more color palletes

Author

This project was created by meugenom


License: MIT

github-leetcode-stats's People

Contributors

meugenom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

monik2002

github-leetcode-stats's Issues

Update Readme

Could you please provide more details under the "How to use" tag? I'm finding it challenging to make things work, and I would greatly appreciate it if you could personally get in touch with me. I'd like to discuss the problems I am facing, and your assistance would be highly valued. Thank you.

Need to fix all colours by one pallet

  • Adding other colors to the bicycle SVG image will be very good,
  • Drawing an SVG bicyclist and animations,
  • Adding some color pallets to the GitHub Total Stats.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.