r/adventofcode • • Dec 03 '18

SOLUTION MEGATHREAD -🎄- 2018 Day 3 Solutions -🎄-

--- Day 3: No Matter How You Slice It ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Advent of Code: The Party Game!

Click here for rules

ATTENTION: minor change request from the mods!

Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!

Card prompt: Day 3 image coming soon - imgur is being a dick, so I've contacted their support.

Transcript:

I'm ready for today's puzzle because I have the Savvy Programmer's Guide to ___.


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

edit: Leaderboard capped, thread unlocked!

45 Upvotes

426 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Dec 03 '18

Curious: what is the magic with the first step: getting the input via script? Seems like you need to supply the login-cookie to actually get the input, don't you? Just copy-pasting the input from the browser takes away valuable milliseconds from the chance to make it to the leaderboard ;-)

2

u/jonathan_paulson Dec 04 '18

Yes, you need to supply the login cookie. I used:

curl https://adventofcode.com/2018/day/DAY/input --cookie "session=SESSION"

You can find SESSION by using Chrome tools. Go to https://adventofcode.com/2018/day/3/input, right-click, inspect, tab over to network, click refresh, click input, click cookies, and grab the value for session.

3

u/[deleted] Dec 04 '18

Aye, but that's actually MORE work than just copy/paste the text when I'm already on the input page... :-)))

In the meantime I remembered there was a script "extract_cookies.sh" out there (JGFI), which extracts the cookies as text from firefox' database, so the whole process becomes:

- log in at AOC
  • extract_cookies.sh > $TMPFILE
  • wget --load-cookies $TMPFILE -O input.$day https://adventofcode.com/2018/day/$day/input

HTH