aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Readme.textile14
-rw-r--r--day01/Dockerfile7
-rw-r--r--day01/Makefile10
-rwxr-xr-xday01/entrypoint10
-rw-r--r--day01/input958
-rwxr-xr-xday01/part13
-rwxr-xr-xday01/part217
-rw-r--r--day02/Dockerfile7
-rw-r--r--day02/Makefile10
-rwxr-xr-xday02/entrypoint10
-rw-r--r--day02/input250
-rwxr-xr-xday02/part126
-rwxr-xr-xday02/part233
-rw-r--r--skel/Dockerfile7
-rw-r--r--skel/Makefile10
-rwxr-xr-xskel/entrypoint10
-rw-r--r--skel/input0
-rwxr-xr-xskel/part13
19 files changed, 1387 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d5a1572
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.swp
+build
diff --git a/Readme.textile b/Readme.textile
new file mode 100644
index 0000000..7f3b23f
--- /dev/null
+++ b/Readme.textile
@@ -0,0 +1,14 @@
+h1. Advent of Code 2018
+
+p. My answers thereto.
+
+h2. Running a day
+
+bc. cd day01
+make
+
+h2. Creating a new day
+
+bc. cp -r skel day01
+cd day01
+sed -ie 's/DAY = /DAY = 01/' Makefile
diff --git a/day01/Dockerfile b/day01/Dockerfile
new file mode 100644
index 0000000..5e0a8b7
--- /dev/null
+++ b/day01/Dockerfile
@@ -0,0 +1,7 @@
+FROM ruby:2.5-slim
+
+WORKDIR /opt
+
+COPY . .
+
+ENTRYPOINT ["./entrypoint"]
diff --git a/day01/Makefile b/day01/Makefile
new file mode 100644
index 0000000..4b5665a
--- /dev/null
+++ b/day01/Makefile
@@ -0,0 +1,10 @@
+DAY = 01
+
+.PHONY: run
+
+run: build
+ sudo docker run -it --rm aoc2018day$(DAY)
+
+build:
+ sudo docker build -t aoc2018day$(DAY) .
+ touch build
diff --git a/day01/entrypoint b/day01/entrypoint
new file mode 100755
index 0000000..cff9f4c
--- /dev/null
+++ b/day01/entrypoint
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ -x part1 ] ; then
+ echo -ne "Part 1:\n\t"
+ ./part1 < input
+fi
+if [ -x part2 ] ; then
+ echo -ne "Part 2:\n\t"
+ ./part2 < input
+fi
diff --git a/day01/input b/day01/input
new file mode 100644
index 0000000..7fc11dd
--- /dev/null
+++ b/day01/input
@@ -0,0 +1,958 @@
++19
+-13
++3
++3
++3
++8
++11
++20
+-19
++14
++13
++4
++18
++8
++17
++18
+-13
++4
++4
++6
++2
++10
++13
+-2
++1
+-7
++14
+-15
+-2
++16
++15
+-2
+-8
+-16
+-18
+-10
++20
++18
++9
++17
+-9
+-14
++7
+-3
++20
++8
++12
+-3
+-3
++11
++19
++6
+-2
+-1
+-10
++5
++11
++10
+-8
++16
++4
++17
+-9
+-3
+-8
++4
++11
++4
+-3
++15
+-6
++16
+-19
+-20
+-6
++9
++2
+-6
+-3
+-10
+-8
++4
+-16
++11
+-10
++4
+-2
++19
+-13
++18
+-13
+-8
++18
+-6
++1
++25
++18
++10
++13
+-6
+-18
++17
+-13
+-10
++15
+-2
++14
++18
+-5
+-15
++18
+-5
++6
++8
++2
+-1
+-2
++16
++16
+-6
++11
++11
+-15
++18
++1
+-7
++1
+-7
++8
+-12
++7
++1
++15
++4
++10
++15
++19
+-14
+-19
++10
++12
+-2
++4
++6
++8
++4
++17
+-10
++5
+-11
+-16
+-18
+-18
+-4
+-10
++18
+-7
++19
++9
+-5
+-18
+-3
++11
+-15
++6
+-9
++1
+-17
++15
+-6
+-20
+-4
+-3
++16
+-15
++1
+-20
++2
++13
++1
++7
+-20
++10
+-7
+-11
++16
++19
+-3
+-22
++9
+-4
+-16
+-2
+-8
+-3
+-7
++3
++9
+-19
+-19
++11
++2
+-15
++10
++9
+-11
++10
++15
++1
++21
++6
+-3
+-22
++5
+-14
+-7
++25
++2
+-36
+-18
+-7
++11
+-15
++21
+-13
++14
+-19
+-12
+-4
+-30
+-4
+-18
+-7
+-13
++8
+-15
++6
++2
+-9
++17
++3
++7
++4
++11
++5
+-9
++3
++10
+-18
++1
++2
++1
+-7
++14
++4
++6
++22
+-23
+-4
+-10
+-20
+-6
+-10
+-11
++1
++19
++12
++1
++18
+-17
++19
+-27
+-8
+-14
++10
+-25
+-24
+-5
++14
+-11
+-1
+-16
+-12
+-7
++17
+-4
+-18
++16
+-12
+-18
+-16
+-2
+-5
+-7
++1
++15
+-10
++18
++4
++1
++13
++8
++19
++3
+-9
++1
+-13
+-15
+-1
++5
+-18
+-11
+-3
+-17
++18
++8
++1
++3
++18
+-2
+-5
++1
++14
+-13
++7
++14
++21
+-19
++2
++8
+-15
++6
++15
++20
++5
++17
++14
+-25
+-10
++5
++18
+-7
+-13
+-2
+-9
+-15
++10
+-35
++15
++4
++37
+-24
++14
++15
++2
+-32
+-34
+-12
+-12
+-25
+-19
+-16
++10
+-7
+-10
++20
++17
++8
++16
+-8
+-1
+-2
+-12
++2
+-7
++3
+-5
+-27
+-8
+-8
+-2
++19
+-15
+-1
++24
+-15
+-3
+-1
++3
+-34
+-16
++8
+-24
++9
+-8
+-31
+-7
+-31
+-33
+-50
+-11
++70
++60
++61
++12
++1
++56
++18
++39
+-13
+-5
++54
+-48
+-47
++137
+-62
+-76
+-168
+-329
+-59773
+-19
++4
++16
+-6
+-13
++6
++16
++5
+-6
+-5
++13
++9
+-8
+-15
+-7
+-14
++1
+-10
+-6
++18
++14
+-18
++16
++19
+-14
++11
++6
++5
+-1
++18
+-14
+-15
++9
+-16
++9
+-3
+-13
++2
+-8
+-3
++1
+-10
+-19
+-17
+-13
+-3
+-12
+-14
+-13
++15
+-17
++8
+-5
+-7
+-7
+-3
+-12
++18
+-8
++4
++16
++3
+-2
++6
++14
++6
++14
+-8
++15
+-3
++4
+-17
+-12
++22
+-13
++7
+-10
+-8
++6
++19
++17
++2
++15
++18
+-12
++2
+-1
+-3
+-16
+-14
++15
+-19
++16
++15
++8
+-11
+-8
+-13
+-8
++15
+-2
+-4
+-3
+-18
++4
++1
+-4
++9
+-22
+-6
+-4
+-22
++18
+-13
+-8
+-15
+-14
+-5
+-2
+-3
+-4
+-11
+-17
+-18
+-8
++9
+-3
++11
++14
++15
+-1
+-9
+-11
++19
+-10
++8
++6
++16
+-12
+-13
++8
+-12
+-8
++6
+-1
+-11
++19
+-16
++6
+-14
+-5
++11
+-15
+-11
++14
+-19
+-12
+-1
++12
++4
++19
++7
+-6
+-17
++5
++10
+-9
+-2
+-6
++10
+-17
++16
+-24
+-13
++19
++1
+-18
+-1
++5
+-2
+-9
+-5
+-13
++5
+-16
++4
++16
+-12
++17
+-11
+-2
++14
+-17
+-2
++16
+-17
+-13
++1
+-5
++6
+-8
++4
+-9
+-5
+-15
+-15
++10
+-16
++15
+-16
+-18
++16
+-11
+-3
+-4
+-7
++17
++1
+-10
+-15
+-1
+-8
++2
++11
++9
++10
++8
+-4
+-19
++9
++12
+-10
++14
++19
+-9
++6
+-9
++14
++14
+-5
++16
+-9
++5
++21
+-4
+-14
+-17
+-15
++9
++19
+-15
+-15
+-16
+-6
+-12
++10
++22
++11
+-8
+-8
++10
+-8
++23
++10
+-3
++17
++23
++17
+-4
+-9
++11
+-8
++11
++18
+-14
+-16
++10
+-4
++12
++13
++13
+-16
++1
+-6
++16
+-12
++18
++19
++20
++21
+-18
++12
++17
++9
++4
++2
+-19
+-9
+-6
+-14
+-14
++5
++43
++5
++2
+-18
++24
+-3
+-9
+-23
++18
++7
+-12
++25
++2
++12
++18
++8
+-3
+-17
+-21
++5
++5
++16
++28
+-15
+-22
+-15
++11
+-24
+-10
++28
++22
++18
++8
++26
++16
+-4
++2
++17
+-14
++28
++2
+-32
+-16
+-6
+-22
+-18
+-4
++13
++45
+-6
++79
++7
++3
++8
+-4
+-5
++6
+-7
++16
+-20
+-24
+-24
+-13
++7
++52
++21
+-2
++21
++18
++17
+-8
++27
+-7
+-19
++8
++7
++20
++2
++12
+-16
+-11
+-20
++4
+-28
+-10
+-32
+-9
+-3
++129
+-7
++31
++2
++16
++27
+-68
+-45
+-222
+-27
+-27
++19
++4
+-58
++14
++27
+-1
+-119
+-15
++68
+-14
+-46
+-101
++16
+-25
++58
+-119
++11
+-251
+-59893
++1
+-4
++17
++16
+-12
+-13
++1
++7
+-6
++10
++11
+-13
+-16
+-17
++6
++16
+-12
++2
++15
+-6
+-19
++6
+-15
++14
+-16
+-12
+-15
+-1
++20
++9
+-5
+-16
+-4
++15
+-8
+-16
+-14
+-10
+-7
+-14
+-6
++15
+-4
+-1
+-12
+-12
++2
++5
++15
+-9
++6
+-2
++15
++5
++10
+-2
++4
++8
+-15
+-14
++20
+-4
++18
++17
++3
++11
++12
++5
+-18
+-16
++19
++6
+-17
++13
++14
+-9
++1
++13
+-12
+-16
+-5
+-19
+-18
++13
++14
++7
+-3
++14
++5
+-11
+-13
+-22
++4
++12
++2
+-15
+-13
++15
++1
+-13
+-12
+-8
+-5
+-9
++7
++19
+-8
++9
++16
++11
+-33
++3
++5
+-12
+-20
+-13
+-7
++121412
diff --git a/day01/part1 b/day01/part1
new file mode 100755
index 0000000..aba8398
--- /dev/null
+++ b/day01/part1
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+
+puts $stdin.readlines.map(&:to_i).sum
diff --git a/day01/part2 b/day01/part2
new file mode 100755
index 0000000..d48de47
--- /dev/null
+++ b/day01/part2
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+input = $stdin.readlines.map(&:to_i)
+
+lf = 0
+freq = [0]
+
+loop do
+ input.each do |i|
+ lf += i
+ if freq.include?(lf)
+ puts lf
+ exit
+ end
+ freq << lf
+ end
+end
diff --git a/day02/Dockerfile b/day02/Dockerfile
new file mode 100644
index 0000000..5e0a8b7
--- /dev/null
+++ b/day02/Dockerfile
@@ -0,0 +1,7 @@
+FROM ruby:2.5-slim
+
+WORKDIR /opt
+
+COPY . .
+
+ENTRYPOINT ["./entrypoint"]
diff --git a/day02/Makefile b/day02/Makefile
new file mode 100644
index 0000000..40af6b1
--- /dev/null
+++ b/day02/Makefile
@@ -0,0 +1,10 @@
+DAY = 02
+
+.PHONY: run
+
+run: build
+ sudo docker run -it --rm aoc2018day$(DAY)
+
+build:
+ sudo docker build -t aoc2018day$(DAY) .
+ touch build
diff --git a/day02/entrypoint b/day02/entrypoint
new file mode 100755
index 0000000..cff9f4c
--- /dev/null
+++ b/day02/entrypoint
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ -x part1 ] ; then
+ echo -ne "Part 1:\n\t"
+ ./part1 < input
+fi
+if [ -x part2 ] ; then
+ echo -ne "Part 2:\n\t"
+ ./part2 < input
+fi
diff --git a/day02/input b/day02/input
new file mode 100644
index 0000000..69850ae
--- /dev/null
+++ b/day02/input
@@ -0,0 +1,250 @@
+tjxmoewpqkyaiqvmndgflunszc
+tjxmobwpqkyaihvrndgfjubszm
+tjxmzewpqkyaihvrydgflrbszc
+tjxmoeypqkyvihvrndgflubsza
+tjcmoewpqkytihvrndgflgbszc
+tjvmoewpqkyanevrndgflubszc
+tjxmoewpqkdiihirndgflubszc
+tjxboewpqkyaihbrnogflubszc
+ojpmoewpqkyaihvjndgflubszc
+tjxyoewpqkyaiuvrndgflutszc
+tjxmoewpqkyalhvrndmflebszc
+tjxmoewpqzyaihhrndgflubszf
+tjxmrewpqkyaihirndgfjubszc
+pjxmoewpqkyaihvendgfbubszc
+txxmkewpqkyjihvrndgflubszc
+tjxmoewcqkyaihvrnmgflubczc
+tjxmoewkqkyaghvrndgfluvszc
+tjxmoewfqkhaihvrndgflubhzc
+jjqmoewpqkyaihvrndzflubszc
+tjxmoewmqksaihvcndgflubszc
+tjrmoewpqkyaihvrvdgflubzzc
+tjxxoewpqkyaiiwrndgflubszc
+cjxmoawxqkyaihvrndgflubszc
+tjxdoewpvkyaihvrndgflubsoc
+tjxmsewpqkyaihvrndgfluzozc
+tjxmoewpqkyafhvrnyeflubszc
+tjxmlewpqkyawhvondgflubszc
+tjxmonwpqkyaiqvrnxgflubszc
+tjxmoewcqkyaihvrnjgflumszc
+tjvmoewpqkyaihveadgflubszc
+tjxmogfpqkyaigvrndgflubszc
+tybmoewpqkyaihvrndgllubszc
+tjxmoewpdkyaihvrndgfluwbzc
+etxmbewpqkyaihvrndgflubszc
+tjxmoeapqcynihvrndgflubszc
+tbxmoewpqkyaihvrndgfdebszc
+haxmoewpqyyaihvrndgflubszc
+ojxmoewpqkyaihvrnegflubszr
+tjxmoewpqkyaihvrndoflubarc
+ljxmoewpqkykihvrndgflvbszc
+tjxmovwpqkyaihvrndgfluzsyc
+tvxmoewpqkyanhvrkdgflubszc
+tjxmoewpqkyaihkrndgfluwwzc
+zjxmoewpfkyaihvrndgfrubszc
+tjxyoegpqkyaihvrndlflubszc
+tjxmoewpqkyamhvrnsgflubmzc
+tjmmoewpqkyaihvrndgftuwszc
+tjxmoewpqbraihvrncgflubszc
+tjxmeeepqkyainvrndgflubszc
+tjemoegpqkyaihvredgflubszc
+tjxmoewpqkyaihvdndgfzubqzc
+tjxmoegrqkyaihfrndgflubszc
+tjxmoewpqxyaihvrndgfluyvzc
+qjxmoewpqkyaiwvrnfgflubszc
+tjxwoewpqkyashkrndgflubszc
+tjzmoewiqkyaihurndgflubszc
+tjumuewpqkyaihvrndgflubssc
+tyxooewpukyaihvrndgflubszc
+tjxvoewpqkyaiivindgflubszc
+ijxmoqwpqkyaihvradgflubszc
+tjxmlewpqkyaihvrhdgflubwzc
+tjxmkewpqkyajhqrndgflubszc
+tjxmoewpqkqaiherndgflurszc
+tjamoewpqkyaizvondgflubszc
+tjxgogwpqkyalhvrndgflubszc
+tjxmoewpqkyachvrndgflubuzq
+tjxmowqpqkyaihvrnegflubszc
+mjxmoewpwkyaihvrndgfkubszc
+tpbmoewpqkyaihvrzdgflubszc
+tjbmoewpqkyaiuvrndgflsbszc
+tjxmoewpqklaghvrndgflubazc
+tjxmoewpqkyrihvrndgwlpbszc
+tjcmoewpqksaiyvrndgflubszc
+tjxmoeapqkymihvindgflubszc
+tjxmdewpqkyafhvrndgflqbszc
+tjxmoewpqxyaihvrndsflubszi
+tjxmoeppqkyaihvrcdgflubszd
+tjxmomwpqkyainvrmdgflubszc
+tjxmovwpqkyaihvrndgfdubdzc
+tjxmoewwqkiaihvrjdgflubszc
+tmxmoewpqkyaifvrndgflubszs
+tbxmoewpqkyaihvrbdgflunszc
+tjxmoewrqkyaihvxndgflubszp
+ujxmoewpqkyaihvxndgflubpzc
+tdxmotwpqkyaihvdndgflubszc
+tjxmvewpqkyaihfrndgtlubszc
+tjfmoewpqkyaihvrnyqflubszc
+tjxfolwzqkyaihvrndgflubszc
+ojrmoiwpqkyaihvrndgflubszc
+tjsmoqwpqkyqihvrndgflubszc
+tjxmohwpqkyaihvrudgflubslc
+tjxtoiwpqkyaihvrnogflubszc
+taxmoewpqkyaiyvrndgfwubszc
+tjxwnezpqkyaihvrndgflubszc
+tjxmyevpqkyaivvrndgflubszc
+tjxdoeopqkyaihvgndgflubszc
+tjxaoewpqkmaihvrndgflufszc
+tjxmoewpqkyaxhvrndgflubncc
+tjxmoewpqkyaihurndgflubbjc
+tjxmjewpqgyaihvrnngflubszc
+tjxmogwpqkyaihvrndgflubbcc
+tjxmoewplkyaihvrnpgflibszc
+tjwmoewpqkyaohvrndgfbubszc
+tjwmoewpqkyaihvrndgfsubszm
+tjxmogwpqkyaihvrndiflubqzc
+tjxmoewpqkyaihvrndgflopshc
+rjxmlewpvkyaihvrndgflubszc
+tjxmogwpakyaihvrndgflzbszc
+tjxmoeppqkyaihvrndgflmxszc
+tjxmoewpqkyhihgrndgfzubszc
+tjxqoewpqkyaihtrndgwlubszc
+tjxnoespqkyaihvrndgflubsuc
+tjmmoewpqkraihvrndgflfbszc
+tjxmoewnqkwaihvrndgflubstc
+tjxmoewpqqyaihvrndgfljbszi
+tjxmoewpqkyaihkrkdgalubszc
+tjxmoewpqkyaihvradgjlurszc
+tvxmoewpqkybihvrndbflubszc
+tjxvoewpqkyaihvradgfoubszc
+tjxmoewpqfyaihvlodgflubszc
+tjxmoewmnkyaiivrndgflubszc
+kjxmoewpqkyaihprndgflcbszc
+hjxmoewpqkcaihvrndgvlubszc
+tjxmoewcqkyaihvrncgfllbszc
+tuxmoewpckyaihvrndoflubszc
+tjxmdewpokyaihvrndgflubszn
+mjxmaewpqkyaqhvrndgflubszc
+tjxmoewpmzyaihvrndgfiubszc
+tjxmoewnqkyvihvrndgflubszk
+tjxmoewpmnyaihvrndgftubszc
+zjxmoewpqkysihvrndgfmubszc
+tjxmoewpqkyaihzrntgflubbzc
+tjxmoewpqkgaihwrndsflubszc
+tjxjoewpqkyaihvrndgflgbizc
+oqxmoewpqkyaihvrndgfldbszc
+wjamoewpqkyaihvfndgflubszc
+tjxmoewtmkyvihvrndgflubszc
+tjlmojwpqkyaihvrndgfludszc
+tjxmowwpqkyaihvrndefludszc
+tjxmoewpqkbaihvrndgfluaszt
+tjxmoewpqkzaahvrodgflubszc
+tjxmoewpqkgaihvrndgflubtpc
+tjxmoenpqkyaihcrndgfqubszc
+tbxmoewpqbyaihvrndgalubszc
+tjvmoewqqkyaihvrndvflubszc
+tjxmoewpqkeaihvundgfaubszc
+txxmoewpqkyaihvrwdgflpbszc
+tzxmoewpqkijihvrndgflubszc
+tjxmoewoqkytiuvrndgflubszc
+tjxmrejplkyaihvrndgflubszc
+tjxmoewpqkynihvrpxgflubszc
+tjxmoewpqkvanhvrndgvlubszc
+tjxmoewpdkyiihvrndgflubszs
+tpxmyewpqkyaihvrndgfeubszc
+tpxmoewpqyyaihvrndhflubszc
+tjsmoewpqkyaihvrndhflubnzc
+tjxmoewpukyaihvrnmgflubwzc
+txxmoewpqlyaihwrndgflubszc
+tjxmoewprkyaiovrndgflubxzc
+tjxmouwpqkyaihzrodgflubszc
+tjxmojwpqkywimvrndgflubszc
+tjxsoewpqkyaihvrzdgqlubszc
+tfxmoewpakyaihvrndgllubszc
+tjhmoewpqiyaihvrndgflubsac
+tjxmoewpqkoaihvrndoflubsxc
+tjxmoewpqkyzpjvrndgflubszc
+tjxmoewpqkyaiharndgzlnbszc
+tjimoevpqkyaihvrndgflubbzc
+tjxsoewpqkyahhvrndgfzubszc
+txxmoewpqkyaimvrrdgflubszc
+tjxmoewpwkyaihvrndpylubszc
+tjxmoewpskyaghvrndgfbubszc
+tjxmuewpqmyaihvrndgfyubszc
+tjxmoewpqkyaihvdndgglubsxc
+xjxmoewpqkyjiovrndgflubszc
+gjxmoewpqkyaihvrndodlubszc
+tjbmoewpqkyaihvridgflvbszc
+tjxmozwpqkyapbvrndgflubszc
+tjxeoewpqkyqihvrndgflubhzc
+tjxdoewpqzyaihvrndgflubsmc
+tjxmwewpqkyathvcndgflubszc
+tjxmoewpszyaihvrndgflusszc
+tuxmoewpqkyaihvrndgfluasxc
+tjemoewpnvyaihvrndgflubszc
+tjxmoewpjkyaihvrndgjlufszc
+tjomoewppkyaihvzndgflubszc
+tjxmvewpqkyaimvrntgflubszc
+rjxmoewpqkyaihvpndgflubszq
+hjxzoewpqkyaihvridgflubszc
+texmoejpqkyaihvrndgflubszx
+tjxcoewpqkyaihbrxdgflubszc
+tjxmoewpnkyaihvrndgfltbsze
+tjxmoewpdkyaihvrndwfluwbzc
+tjxmoewpqryjihkrndgflubszc
+tjlmoewpqkhaihvrndgflubsnc
+tjxmovapqkjaihvrndgflubszc
+tjxvoewpqkyaihqrndgfluyszc
+tjxwoewnqkyaihvrndgfgubszc
+tjdmoewpqklaihvcndgflubszc
+tjxmoewpvkynihvrndgflubskc
+tjxmtewpqkyaihvhndgfluaszc
+tjxmoewpqkyanhvrnpgfluvszc
+tjxmoewpqkyaifvbndgflubspc
+tjxmoexpqknaihvrndgxlubszc
+qjxmoewqqkyaihvrndgflubpzc
+tjxmoewppkyaihvaxdgflubszc
+myxmoewpqkyaihvrudgflubszc
+tjxmwewpmkyaihvrndgflubssc
+tjxmoewpqkyaihvrndgfxqbszq
+tjxmoewhqkyaahvrndgflubbzc
+tbxmoewmqkyaihvrndgflubszu
+toxmolwpqkyaihvrndnflubszc
+tjxmoewhqkyaihvrnrgflubvzc
+yjxmoewcqkyaihvrndgflubfzc
+tjxmoewpqkyamhvrgdgflmbszc
+tjxmtewpqkyaizvrndgfluoszc
+tjxmoewpqzyaihvrntsflubszc
+fjxmoewpqkyaihyrmdgflubszc
+tjxwoewpqcyaihbrndgflubszc
+tjxmoebpqkzaihvrndcflubszc
+tjxmoewpqkyaihvrndnlmubszc
+tjxmoewpqkyaihvrndgeyubskc
+tfxmoewpqryaihvrndgfluiszc
+tjxmoewpqkjaihvynngflubszc
+tjxmoewpqkqaihvonjgflubszc
+tjfmokwpqkyeihvrndgflubszc
+djxmoewpkkyaihvrnmgflubszc
+tjxmiewpqkyaihvrndgflubhlc
+tjxmmejpqkyaihvrnhgflubszc
+djxmoewmqkyaihvrnggflubszc
+tjxmoewpqkyaihvrkggflubsze
+gjxmoewpqkyaihjrndgflvbszc
+tjxmoewpqkyaidvrndgkzubszc
+tjxmoewpqkyaedvrnpgflubszc
+sjxmoewpqkyaihvrnngfluhszc
+tjxmoewpqkuaihvrndghlubxzc
+tjxmoewgqkyuihvrndgftubszc
+tjxmoewpqsyaifvrkdgflubszc
+tjxrrewpqkyaihvrnpgflubszc
+tjxmoezpqkyaihvrwdgflabszc
+tjfmoewpqknaihvrndgflubkzc
+tjxmoewnqkxaihvrndgflubtzc
+tjxmoewpkkyaihvrndgfrnbszc
+tjxmorwpnkqaihvrndgflubszc
+tsxmoewwqkyathvrndgflubszc
+tjxmoeupqkyaihvrndyflubszp
+bjxmoewdqkyaihvrndgflurszc
+tjxmoewpvkyaihvrndoflubszq
+sjxmoewpqkyaihvrndgflubyec
+tjxmoewpqkyaizcrndgfnubszc
diff --git a/day02/part1 b/day02/part1
new file mode 100755
index 0000000..dca8ec2
--- /dev/null
+++ b/day02/part1
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+
+class Integer
+ def two?
+ self == 2
+ end
+ def three?
+ self == 3
+ end
+end
+
+input = $stdin.readlines.map(&:chomp)
+
+twos = 0
+threes = 0
+
+input.each do |i|
+ hash = Hash.new(0)
+ i.chars.each do |c|
+ hash[c] += 1
+ end
+ twos += 1 if hash.values.map(&:two?).any?
+ threes += 1 if hash.values.map(&:three?).any?
+end
+
+puts twos * threes
diff --git a/day02/part2 b/day02/part2
new file mode 100755
index 0000000..aa82247
--- /dev/null
+++ b/day02/part2
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+
+class String
+ def distance(other)
+ sa = self.chars
+ oa = other.chars
+ d = 0
+ (0...self.length).each do |i|
+ d += 1 if sa[i] != oa[i]
+ end
+ return d
+ end
+
+ def difference(other)
+ sa = self.chars
+ oa = other.chars
+ (0...self.length).each do |i|
+ sa[i] = nil if sa[i] != oa[i]
+ end
+ return sa.join
+ end
+end
+
+input = $stdin.readlines.map(&:chomp)
+
+(0...input.length).each do |i|
+ (i...input.length).each do |j|
+ if input[i].distance(input[j]) == 1
+ puts input[i].difference(input[j])
+ exit
+ end
+ end
+end
diff --git a/skel/Dockerfile b/skel/Dockerfile
new file mode 100644
index 0000000..5e0a8b7
--- /dev/null
+++ b/skel/Dockerfile
@@ -0,0 +1,7 @@
+FROM ruby:2.5-slim
+
+WORKDIR /opt
+
+COPY . .
+
+ENTRYPOINT ["./entrypoint"]
diff --git a/skel/Makefile b/skel/Makefile
new file mode 100644
index 0000000..1bc4310
--- /dev/null
+++ b/skel/Makefile
@@ -0,0 +1,10 @@
+DAY =
+
+.PHONY: run
+
+run: build
+ sudo docker run -it --rm aoc2018day$(DAY)
+
+build:
+ sudo docker build -t aoc2018day$(DAY) .
+ touch build
diff --git a/skel/entrypoint b/skel/entrypoint
new file mode 100755
index 0000000..cff9f4c
--- /dev/null
+++ b/skel/entrypoint
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ -x part1 ] ; then
+ echo -ne "Part 1:\n\t"
+ ./part1 < input
+fi
+if [ -x part2 ] ; then
+ echo -ne "Part 2:\n\t"
+ ./part2 < input
+fi
diff --git a/skel/input b/skel/input
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/skel/input
diff --git a/skel/part1 b/skel/part1
new file mode 100755
index 0000000..90c685a
--- /dev/null
+++ b/skel/part1
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+
+input = $stdin.readlines.map(&:chomp)