Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

20 lines
674B

  1. include .env
  2. export
  3. .SILENT:
  4. CODE := $(shell find . -path "./y????/p??.*" -type f | xargs ls -rt | tail -n 1)
  5. YEAR := $(shell echo ${CODE} | sed 's/[^0-9]/ /g' | cut -d' ' -f4)
  6. DAY0 := $(shell echo ${CODE} | sed 's/[^0-9]/ /g' | cut -d' ' -f6)
  7. DATA := ./y${YEAR}/p${DAY0}.dat
  8. URL := https://adventofcode.com/${YEAR}/day/`echo ${DAY0} | bc`/input
  9. pyrun: ${DATA}
  10. cat ${DATA} | docker run -v `pwd`:/app/ -w /app/ -i --rm python:latest python -u ./y${YEAR}/p${DAY0}.py
  11. ${DATA}:
  12. # avoid spam in the lead up to the event
  13. test ${YEAR}${DAY0} -le `date +%Y%d`
  14. # only poll if data isn't yet stored locally
  15. test -f ${DATA} || curl -s -b "session=${SESSION}" ${URL} > ${DATA}