The canonical version is available at asciimation.co.nz , but towel.blinkenlights.nl serves an edition of it through telnet.
This recording was produced like this:
termrec -e 'telnet towel.blinkenlights.nl' star-wars.ttyrec
And is rendered like this:
<tty-player src = star-wars.ttyrec preload = none controls window-title = "Star Wars"
poster = 'data:text/plain,%1b[7;37f%1b[4;1;93mSTAH%1b[22m WOZ%1b[m%1b[15;33fASCIIMATION.CO.NZ' >
</tty-player>
Note that star-wars.ttyrec
is over 3.2MB, though if served gzipped it’s around 110KB. Specifying the poster forces preloading of the entire thing (XMLHttpRequest can’t cope with streaming responses in any way yet).
CSS is being used to hide the window title (so you never actually see that it says “Star Wars”—that window-title
was a waste of time) and border and give it the ominous dark red glow. I haven’t yet decided what to do about such styling as a general rule; there’s certainly something to be said for using the Shadow DOM. The ability to change the term.js colourscheme (e.g. light terminal) is also something that needs to be added.
Star Wars
0:00 0:00
STAH WOZ
ASCIIMATION.CO.NZ
Change poster
to: npt:27
(will force load) data:text/plain,…
Serving pre‐compressed content
ttyrec scripts can get quite large over long sessions, but tend to compress well. star-wars.ttyrec
, for example, is over 3.2MB, but gzipped it’s about 110KB. You could configure your server to gzip on‐the‐fly, but you’ll probably get better results from pre‐compressing with the best compression rates.
On Apache, you might use something like this (source ):
<IfModule mod_headers.c>
RewriteCond "%{HTTP:Accept-encoding}" "gzip"
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
RewriteRule "^(.*)\.ttyrec" "$1\.ttyrec\.gz" [QSA]
RewriteRule "\.ttyrec\.gz$" "-" [T=application/x-ttyrec,E=no-gzip:1]
<FilesMatch "\.ttyrec\.gz$">
Header append Content-Encoding gzip
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
If you’re a make
‐oriented person, it’s easy to construct targets for automatic gzipping. It’s also parallelisable with make -j
. Take that, users of modern JavaScript‐powered build tools! (What’s the fashion this week? I think it was gulp last week and grunt the week before, but it’s probably changed by now.)
FILES_TO_GZIP=$(filter-out Makefile %.gz,$(wildcard *)))
.PHONY: all clean
all: $(patsubst %,%.gz,${FILES_TO_GZIP})
clean:
rm -f -- *.gz
%.gz: %
gzip -fk9 -- "$*"
(And developers, please always remember your --
and quoting paths appropriately, or file names starting with -
or containing whitespace will start to break things, often dangerously. Especially if you allow user-constructed filenames.)