For the last little while, I’ve been spending my spare programming time working on a slightly larger project than I normally do: a Racket library for reading iOS backups.
Basically, I want to take the mess that is an iOS backup (not particularly designed to be easy to read by other programs) and extract some information from it, backing it up in a more easily readable format.
Specifically, I would like to be able to backup:
So what’s so interesting about that picture?
Today’s task comes from the Code Golf StackExchange. The idea behind code golf is to write a program with as few characters as possible, often rendering the code nigh on unreadable. Luckily, the same StackExchange also host popularity contests, one of which is the inspiration behind today’s post:
You are given two true color images, the Source and the Palette. They do not necessarily have the same dimensions but it is guaranteed that their areas are the same, i.e. they have the same number of pixels. Your task is to create an algorithm that makes the most accurate looking copy of the Source by only using the pixels in the Palette. Each pixel in the Palette must be used exactly once in a unique position in this copy. The copy must have the same dimensions as the Source. – American Gothic in the palette of Mona Lisa: Rearrange the pixels
A recent post on Reddit caught my attention: A “One” Line Echo Server Using “let” in Python (original article). The basic idea is that you can use Python’s
lambda with default arguments as a
let, which in turn allows you to write a simple echo server in
one line a nicely functional style.
Let’s talk about clocks.
We can draw traditional analog clocks1:
We can draw nice digital clocks:
┌─┐ │ │ ─┐ ┌─┐ │ │└─┤ │ │ │ └─┘ │ │ ─┴─└─┘
Or we can go downright mad and make clocks out of clocks:
It’s been a while1, but I’m back. Today’s post is inspired by a post from /r/dailyprogrammer almost a month ago now: Challenge #183 [Intermediate] Edge Matching Tile Puzzle. Basically, we’re going to solve puzzles like this:
If you look carefully, the tiles are the same between the two, although they might be rotated.