In Percona Support we spend a few hours per week doing Labs: short collective projects, not directly related to the tickets.
One of our last labs was about to get ready for the winter holiday season which means preparing the tree and decorating it. To do it we used our favorite tools: MySQL, and ASCII art (https://en.wikipedia.org/wiki/ASCII_art). As a result, we created a function that prints into the terminal a New Year Tree (
https://en.wikipedia.org/wiki/New_Year_tree) and decorates it with symbols we want.
For example, to create a three-level tree, decorated with starts, call the function as follow:
| $ mysql ny_tree -e "select ny_tree(3, '*')" --vertical --skip-column-names -s *************************** 1. row *************************** /\ /__\ /* \ /____\ / * \ /______\ || |
Since MySQL supports Unicode you can use any symbol, having it has the same width as the space symbol. For example, you can decorate your tree with wax candles without any risk of firing up your home:
| $ mysql ny_tree -e "select ny_tree(4, '?')" --vertical --skip-column-names -s *************************** 1. row *************************** /\ /__\ /? \ /____\ /? ?\ /______\ /?? ? \ /________\ || |
You can change your terminal colors to those that look more celebrating, align the size of the terminal with the number of levels in the tree, and call the function in a loop to have an animated picture.
For example, animation at the beginning of this post was created by a few calls like:
| $ for i in `seq 1 1 1000`; do mysql ny_tree -e "select '\\nHappy New 2022 Year\!', ny_tree(12, '⚝')" --vertical --skip-column-names -s; sleep 1; done |
I only adjusted the number of levels for each terminal size.
We, Percona Support Team, wish you Happy Holidays and Happy New Year without serious database issues!
Related