Saturday, May 11, 2013

bash welcome message

Hi there,

I haven't had a blog post in quite a while due to being busy.
Last night I did the least relevant to this blog/machine learning, yet probably most awesome bit of python/shell scripting.
Basically I wanted my welcome message to be an ASCII art of an Arnie movie screenshot. However, I was very disappointed with most results of the online convertes and the lack of color made it look really bad. http://www.text-image.com/convert/ gave really good results for to html conversion. I took the source code and made a python script that parses the html string to replace the relevant color- and linebreak information with appropriate bash escape characters.
The results are really cool and now I have a welcome screen chosen randomly from those (so far only) 3 "pictures":




Useful links:
http://www.text-image.com/ (image2ascii)
http://www.commandlinefu.com/commands/view/5879/show-numerical-values-for-each-of-the-256-colors-in-bash (show 256 colors in bash)
http://www.enigmacurry.com/2009/01/20/256-colors-on-the-linux-terminal/ (how to get a bash-to-html color table with emacs)
http://tldp.org/LDP/abs/html/colorizing.html (linux documentation on bash colors)

Those were the links that helped me make the script. It is still slow and maybe I will speed it up some day. If you want to use it, and do not want to install python-Levenshtein, just delete any import and function calling that module (it's not needed). Levenshtein is on pypi.


No comments:

Post a Comment