Giter VIP home page Giter VIP logo

aoc_tiles's Introduction

AoC Tiles

This script creates a graphic for each day for each year of the Advent of Code. A tile is an image which represents both parts of a day, it looks like this:

AoC Tiles

It uses the personal AoC Leaderboard to get the data for each day using your cookie.

Installation

For this year (2023) I have rewritten this script to make it a lot easier to use. Now you only need to install pre-commit, add a pre-commit hook and add two HTML comments to your README. More details below.

Install pre-commit:

pip install pre-commit

or the more modern way below (either is fine, modern pip in Python 3.11+ will not allow the above command to run though):

# if you don't have pipx, install it with pip install pipx, or with your package manager
pipx install pre-commit  

Add pre-commit hook to your repository

Add this pre-commit hook to your .pre-commit-config.yaml (create it, if you don't have it):

repos:
    - repo: https://github.com/LiquidFun/aoc_tiles
      rev: 0.5.6
      hooks:
          - id: aoc-tiles
            # Optionally use these arguments. Auto add tiles to git adds the tiles to git,
            # possibly amends your commit by creating the tile images and updating the README.
            # Language sorting shows the preference of the order of the languages to use.
            # Exclude paterns are globs which can be used to exclude files when creating
            # the tiles. See the customization section in the README for more flags.
            # Simply remove the comments (#) below for args and the flags you want.
            # args:
            #     - --auto-add-tiles-to-git=amend
            #     - --language-sorting=jl,kt,py,rs
            #     - --exclude-patterns="2021/*/*.apl,2021/*/*.py,2021/*/*.cpp"

Now install the hook with:

pre-commit install --hook-type post-commit

and you are done! The --hook-type post-commit flag is important, otherwise the hook will not run.

There are a lot more flags, see config.py for all of them. Auto add tiles is recommended as it will automatically add the tiles to your git repository, otherwise you might forget it and the tiles will not be updated. Note that this will amend your just created commit. If you do not want this, remove that flag.

Set-up

Add this to your .gitignore:

.aoc_tiles/*
!.aoc_tiles/tiles/

Now add <!-- AOC TILES BEGIN --> and <!-- AOC TILES END --> in your README, everything between these 2 tags will always be replaced by the script, so do not add additional information there. Note that these are HTML comments, so they will not be visible in the rendered README.

Configuration

If you care about your submit-time and rank, you need to add your session cookie to the script. By default, if no session cookie is found, checkmarks will be used instead of the time and rank. Add it either in the root of the repository as session.cookie or in the .aoc_tiles directory as session.cookie. Make sure that this file is in your .gitignore! It should contain a single line, the "session" cookie from https://adventofcode.com when you are logged in. No prefix is needed, only the string of length 128.

Customization

There are various flags which can be set to change the look of your tiles. Some of them are listed here with examples showing how it changes the look.

  • --what-to-show-on-right-side=:
auto (default) checkmark time_and_rank
time_and_rank if cookie is available, else checkmark
  • --contrast-improvement-type=:
outline (default) dark none

aoc_tiles's People

Contributors

liquidfun avatar supertux88 avatar aurarius1 avatar cuteredpwnda avatar kittygiraudel avatar lionel-nj avatar lukefadedaway avatar

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.