diff options
author | Nat Lasseter <Nat Lasseter nathan@bytemark.co.uk> | 2017-12-05 09:47:10 +0000 |
---|---|---|
committer | Nat Lasseter <Nat Lasseter nathan@bytemark.co.uk> | 2017-12-05 09:47:10 +0000 |
commit | f108ad65874aea085825edd8548a615a90d26d7b (patch) | |
tree | 1bed3c1335cb1b8bf5ae23972a3235e0e86a8f88 | |
parent | d21e58f81d28b4e411f1188b1fa065b99e24378b (diff) |
Added new script
-rw-r--r-- | Readme.textile | 10 | ||||
-rwxr-xr-x | new | 29 |
2 files changed, 38 insertions, 1 deletions
diff --git a/Readme.textile b/Readme.textile index d859ccf..abd0e0f 100644 --- a/Readme.textile +++ b/Readme.textile @@ -1,11 +1,13 @@ h1. Advent of Code 2017 -These are my answers for the "2017 Advent of Code":http://adventofcode.com/2017 +These are my answers for the "2017 Advent of Code":http://adventofcode.com/2017. h2. Travis build !https://travis-ci.org/User4574/Advent-of-Code-2017.svg?branch=master!:https://travis-ci.org/User4574/Advent-of-Code-2017 +TODO: There should be some, like, tests or something. + h2. Running Use the run script in the root of the repo. @@ -14,3 +16,9 @@ Use the run script in the root of the repo. - ./run n := Run the code for -day- millisecond *n* - ./run := Run the code for today +h2. Starting a new day + +Use the new script to set up a skeleton directory for a new day. + +- ./new n := Create a skeleton for day *n* +- ./new := Create a skeleton for today @@ -0,0 +1,29 @@ +#!/bin/bash + +day=day$(date +%d) + +if [ "x$1" != "x" ] ; then + day=$(printf "day%02d" $1) +fi + +if [ -d $day ] ; then + echo "Directory exists" + exit 1 +fi + +echo "Creating $day..." + +mkdir $day + +cat > $day/part1 <<EOT +#!/usr/bin/env ruby + +input = gets.chomp +input = \$stdin.readlines.map(&:chomp) +EOT + +chmod +x $day/part1 +cp $day/part1 $day/part2 + +echo "Give input:" +cat > $day/input |