|
|
|
|
|
|
|
|
YEAR := $(shell echo ${CODE} | sed 's/[^0-9]/ /g' | cut -d' ' -f4) |
|
|
YEAR := $(shell echo ${CODE} | sed 's/[^0-9]/ /g' | cut -d' ' -f4) |
|
|
DAY0 := $(shell echo ${CODE} | sed 's/[^0-9]/ /g' | cut -d' ' -f6) |
|
|
DAY0 := $(shell echo ${CODE} | sed 's/[^0-9]/ /g' | cut -d' ' -f6) |
|
|
DATA := ./y${YEAR}/p${DAY0}.dat |
|
|
DATA := ./y${YEAR}/p${DAY0}.dat |
|
|
URL := https://adventofcode.com/${YEAR}/day/`echo ${DAY0} | bc`/input |
|
|
|
|
|
|
|
|
URL := https://adventofcode.com/${YEAR}/day/`echo ${DAY0} | bc` |
|
|
|
|
|
|
|
|
pyrun: ${DATA} |
|
|
pyrun: ${DATA} |
|
|
cat ${DATA} | docker run -v `pwd`:/app/ -w /app/ -i --rm python:latest python -u ./y${YEAR}/p${DAY0}.py |
|
|
cat ${DATA} | docker run -v `pwd`:/app/ -w /app/ -i --rm python:latest python -u ./y${YEAR}/p${DAY0}.py |
|
|
|
|
|
|
|
|
# avoid spam in the lead up to the event |
|
|
# avoid spam in the lead up to the event |
|
|
test ${YEAR}${DAY0} -le `date +%Y%d` |
|
|
test ${YEAR}${DAY0} -le `date +%Y%d` |
|
|
# only poll if data isn't yet stored locally |
|
|
# only poll if data isn't yet stored locally |
|
|
test -f ${DATA} || curl -s -b "session=${SESSION}" ${URL} > ${DATA} |
|
|
|
|
|
|
|
|
test -f ${DATA} || curl -s -b "session=${SESSION}" ${URL}/input > ${DATA} |
|
|
|
|
|
|
|
|
|
|
|
# # avoid spam in the lead up to the event |
|
|
|
|
|
# test ${YEAR}${DAY0} -le `date +%Y%d` |
|
|
|
|
|
# # only poll if data isn't yet stored locally |
|
|
|
|
|
# test -f ${DATA} || curl -s $(URL) | tr '\n' '@' | sed -E "s/.+<pre><code>//" | sed -E "s/<\/code><\/pre>.+//" | tr '@' '\n' > $(DATA) |