Code Monkey home page Code Monkey logo

advent-of-babashka's Introduction

Advent of Babashka

A project for doing Advent of Code using babashka and nbb.

To install babashka, check here. It is recommended to use version 1.0.167 or higher. To install nbb: npm install -g nbb@latest. Nbb 1.1.151 or higher is required.

The first puzzle is in src/aoc22/day01.cljc. You can execute part 1 in both bb and nbb using:

$ bb -x aoc22.day01/part-1 [...args]
$ nbb -x aoc22.day01/part-1 [...args]

Each solution can take parameters from the command line if necessary. Arguments are parsed using babashka.cli:

$ bb -x clojure.core/prn --flag --option 1
{:flag true, :option 1}

You can also use Clojure JVM with the same argument parsing:

clj -M:cli clojure.core/prn --flag --option 1
{:flag true, :option 1}

Generating stub for new day

To generate a stub for a new day, run:

$ bb new-day --year 22 --day 2

The --year currently defaults to 22.

Downloading input

To download your puzzle input from the Advent of Code website automatically, set the AOC_SESSION environment variable to your Advent of Code session cookie. You can find this by going to your browser's developer console.

You can also just download your puzzle input manually.

Github Codespaces

To use this template in Github Codespaces, click Use this template > Open in a codespace.

To install babashka, run

sudo bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)

To install nbb, run:

npm install -g nbb@latest

Nbb startup

If you want to install nbb locally in the project, run npm install nbb@latest and use node_modules/.bin/nbb instead run nbb (this starts faster than npx nbb).

External tools

License

This code is unlicensed, you can fork / clone it and use it however you want.

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.