Fun with Block Letters
This is not a post about how you can make passive income as a developer while you sleep, or a listicle about the 10 best Python packages you simply must incorporate into your project to find dev-nirvana. This is just a fun little shout out to some old technology that lets you turn regular text into giant ASCII streams of text, like this:
This is cool the way that tractor-feed dot matrix printers were cool. It’s an homage to the nerds on whose shoulders we all stand. I like this kind of thing the same way some people like art deco furniture or nickel slots. I feel kinship with tegestologists and tyrosemiophiles in my attraction to quirky things — look them up.
I wonder what Howard Carter felt like discovering Tutankhamun’s tomb… I may have felt something similarly wondrous when I discovered Figlets. This magical technology included a real specification that was accurate and could be used to decode ancient text files and release their magical powers that allows you to turn regular text into ASCII art magic.
I must give internet shout-outs to patorjk and his Figlet app for Javascript, which is what powers the ever-fun Figlet page on his website.
Since I’ve been goofing around with writing parsers in Elixir, I thought I would have a go at writing a parser for these Figlet font files, and I came up with a proof-of-concept Elixir port: figlet. It uses File.stream!/3
which operates on a file path, which is a different approach than what I used for parsing .env
files in the dotenvy package. The shape of the internal functions shifts around a bit if you rely on streams instead of complete blocks of text. It pairs well with Enum.reduce
, but I found myself needing to set flags in the accumulator to keep my place, but ultimately I think I favor this approach — it is quite speedy to tear through lots of files.
Anyhow, now I have the means to generate cool ASCII text whenever I get the chance!
Why Use Figlets?
- You can sneak cool comments into your HTML
- They are the perfect counterpart to your Vintage-looking Terminal App
- You can spruce up your CLI apps with fun, easy-to-read banners.
- Because you can!