Textfiles

Looking for VT100 documentation, I found a folder of textfiles VT100 animations, including the classic Bambi vs. Godzilla.

Slightly difficult to watch on any modern computer, so save this script: (works on Mac & other Unix-likes, wtf knows what Windows does for clear and reset.)

Use: % slowblade.py ~/Downloads/bambi_godzila.txt 500

slowblade.py: [update 2021-01-14, encoding]

#!/usr/bin/env python3
# by Mark Damon Hughes. Licensed under Creative Commons Attribution 4.0 International license.

import os, sys, time

def slowblade(f, spd):
    try:
        os.system("clear")
        text = open(f, encoding='Windows-1252').read()
        for c in text:
            sys.stdout.write(c); sys.stdout.flush()
            time.sleep(1.0/spd)
        print("")
        input("[press enter]")
    finally:
        os.system("reset")

if __name__ == "__main__":
    if len(sys.argv) == 1: raise Exception("Usage: slowblade.py FILENAME [SPEED (default 100)]")
    else: slowblade(sys.argv[1], int(sys.argv[2]) if len(sys.argv) >= 3 else 100)