Elixir and :observer.start(), since app completion, look like this:
Elixir application process tree
Vehicle registration plates of Serbia, since 2011, look like this:
src: Wikipedia
Simple principle of 2 predefined letters (representing larger cities), 3 to 4 numbers and 2 random letters, e.g:
It’s easy to guess where to go from here – how many valid words can we glue together with these letters – backed with Elixir, poolboy, tiny bit of Go and Docker, as a tech stack
Entrée
It’s not every day that a new city gets build and grows beyond a certain point to get it’s own 2 letter prefix for registration, but hard-coding existing ones is still lame
Closest thing to an official list of currently valid Serbian city codes is by far the Wikipedia entry. Fetching purely region IDs from this location requires some code and either CSS selector or XPath, so Golang and antchfx/htmlquery are called in:
… with XPath being:
Ancient scrolls, c. 320 BC
Main course
Having plate codes retrieved as shown above, supported with a list of American English dictionary words (/usr/share/dict, wamerican:2018.04.16-1), poolboy can be fired up
Elixir playground was bootstrapped via mighty mix and main dish included lib/ex_plates/execute.ex module, alongside lightweight worker.ex
Worker (configured with {:size, 64}, {:max_overflow, 32}) is in charge of ensuring that word being checked indeed starts with 2 letters available in gathered city codes:
Primary logic, however, lies in mentioned Execute module
Previously prepared plate_codes are loaded as a list (80 2-letter city prefixes), while the following stream over wordlist_file (wamerican dict) relies extensively on Elixir’s Pipe Operator (taking result of one expression and passing it on, shell-like)
Content of given file (~100k words) is streamed as input to a function that gets rid of trailing spaces; that output is fed to a fn which filters only 4 chars phrases, which is further the input sent to poolboy workers (generic pooling lib for Erlang), ones that do the lifting:
Dessert
Since bootstrapping a working Elixir workstation is not trivial – let’s use Docker
Sufficiently understandable, here in action:
[ … ]
Compilation messages excluded, getting the final result
TL;DR
Code, code, Docker image – 804 in total