A blog by Stuart Langridge

as days pass by

scratched tallies on the prison wall

The Matrix has you, part 2

I've recently switched back from vscode to Sublime Text, which means that after all the time I spent training my fingers to type "code somefile.txt" instead of "subl somefile.txt" I now need to undo all that conditioning and go back to subl again. So I thought, hey, maybe I should dump a little shell script called code in my bin folder which admonished me in some amusing way, thus Pavlov-ing myself into learning to do it right.

And then I thought, hey, what'd be cool is if I had that Matrix-esque "raining code" effect in the Terminal and then it was superimposed with a box saying "STOP TYPING code AND USE subl INSTEAD", like the "SYSTEM ERROR" message at the end of the first movie.

And then I thought: someone's already done this, right? And they have; it is called cmatrix. But I don't like cmatrix because it doesn't do the colours right; the text just sorta stops rather than fading away like the movie does, and it feels unreal and too sharp for me. Now, don't get me wrong, I understand why this is; terminals support a full proper range of colour these days, but writing a program which gets released to actual people and which can deal with the bewildering array of terminal settings out there is a miserable waste of everyone's time. But I'm not writing this for anyone else; it only has to work in my terminal (in true works on my machine fashion). And this will give me a chance to noodle about with Python terminal libraries such as blessed to make something interesting. Hence, matrix24.py:

It's a bodge all round, and it still doesn't look right, and Jess pointed out that making something cool happen when I make a mistake is the opposite of conditioning, but I got to fiddle about with a new library for a bit, so that was fun. Can I do something productive now?

(title from a classic post about the Matrix which still makes me laugh even after all these years, although it is very unfair to Keanu Reeves who is a cool bloke and should be emulated in his approach to life)

I'm currently available for hire, to help you plan, architect, and build new systems, and for technical writing and articles. You can take a look at some projects I've worked on and some of my writing. If you'd like to talk about your upcoming project, do get in touch.

More in the discussion (powered by webmentions)