ssh guest@mondrian.byobu.co
March 7, 2012 happens to be Piet Mondrian's 140th birthday!
For an engineer and a scientist, I'm probably more of an art lover than most. I studied art history a bit in college, and even worked for the art department at Texas A&M University, which earned me a few free art classes over my usual engineering workload. I generally seek out both boutique art galleries and the big ones when traveling. All that said, Piet Mondrian is one of my favorite artists. His lines, colors, proportions, precision, balance, symmetry and asymmetry speak to a part of my soul that's hard to explain.
You might recognize some of these, as his most recognizable works:
In the spirit of Google Doodles, I thought I'd call attention to Byobu's Piet Mondrian function quietly nestled in Byobu. If you're running byobu in tmux mode (which you can launch with byobu-tmux), then you can simply press ctrl-alt-F12 in most environments (my sympathies if you're off the beaten path). You should see something like this:
This is the output of the 116 line shell script found at /usr/lib/byobu/include/mondrian. I don't think I've ever narrated my source code in my blog before, but I reckon I will do so here. It's not that I'm particularly proud of the implementation or the code, but rather that I'd like to explain the algorithm I have applied to Mondrian's art :-)
- First, it hardcodes the color values of red, yellow, blue, and white from a 256 color palette. To do so, I used the color picker utility in gimp against Mondrian's Composition 10, 1939–1942.
- Next, it chooses some random number of rectangles between 10 and 40, which seemed to me to be fairly representative of most of Mondrian's geometric compositions.
- Then, from the randomly numbered rectangles, 3 are chosen -- 1 for red, 1 for yellow, and 1 for blue. I fully well appreciate that Mondrian put far more thought into what regions where colored, and which color, how much, with great precision and balance. I hope one day to decode his algorithm, but for now, my code simple chooses these at random.
- Now, tmux does a bit of the hard work for us, creating a new window in byobu, sets the background to our particular white, and splitting that window into a number of panes matching our randomly chosen amount.
- Finally, one pane each is colored red, yellow, and blue. Note that tmux does not support the classic UNIX terminal feature bce (background color erase), so instead, we use a one-line perl script to color each pane.
:-Dustin
Interesting tie in with Google. Mondrian was the original name of their code review tool now called Rietveld (named after a Dutch architect and designer):
ReplyDeletehttp://code.google.com/appengine/articles/rietveld.html
Gerrit - their code review tool based on this for Android is the first name of Mr Reitveld.
this is a truly great post!!
ReplyDeleteas an engineer and art lover as yourself, i really appreciated it!
mondrian's one of my favourites, too.
Have you seen the BBC Series "Hustle"? They did a GREAT episode on Mondrian, Season 1 - Episode 3.
ReplyDeletehttp://www.imdb.com/title/tt0608707/
When I watched the episode, I thought the writers just made up the artist "Mondrian"... :-)
You might also be interested in the article "Piet (programming language)" on Wikipedia :)
ReplyDeleteIt's misspelled "Modrian" in the menu->help-quickstart guide in byobu 5.17.
ReplyDeleteNice easteregg. I also like how hitting return merges cells. What are keyboard shortcuts to quickly generate a new one / quickly return to the normal view?