News for hackers. Stuff that matters.
Re:Coding Challenge for MI5 by maffydub on Sunday September 11, 2016 @12:28PM (#12474108)
A few minutes fun diversion.

A bit of guess work and trial and error, and I have the following bash one-liner:

pngtopnm puzzle.png | pnmtoplainpnm | tail -n +4 | sed -e 's/232 3 138/A/g' -e 's/58 185 229/B/g' | tr -d ' \n' | sed -e 's/AB/A\nB/g' -e 's/BA/B\nA/g' | awk '/.*/ { printf "%x", length(); }' | xxd -r -p | sed -e 's/-//g' | xxd -r -p

I'm not sure the "sed -e 's/AB/A\nB/g'" bit is optimal, but it was the first thing I thought of...

...and I definitely have a tendency to use sed when I should be using tr.

There are no comments on this comment yet.