Got a second-hand HPRT N31 thermal printer, which prints 72 mm wide at 8 dots per mm (~200 dpi). My old thermal printer, an Xprinter 58IIH, only prints 48 mm wide, so it's a nice upgrade. Both offer a USB Type-B port and appear as /dev/usb/lp0. The new printer offers a line-oriented command language called TSPL, for which I found a programming manual by HPRT online but it doesn't claim to apply to my model. It certainly didn't help that the indicator light flashes green even if the command is invalid. I eventually figured out that the basic commands do work, that I need GAP 0,0 to make it work with paper rolls, and that double quotes in strings are escaped as \["], so anyway, but I certainly prefer ESC/POS and Xprinter's manual for it.
The new printer can backfeed, which I wanted to combine with variable density to print grayscale, but backfeed is so imprecise I couldn't even double strike text, so that's a dead end.
I opened up the machine hoping to find a SOIC-8 flash chip I can dump, but instead found a big-ass QFP-100 MCU with a sticker over its top, which I guess has the flash built in. I didn't have the patience to carefully remove that sticker so I gave up. I did see an antenna in the PCB and a bunch of empty solder pads nearby, presumably for variants with Bluetooth and/or Wi-Fi interfaces. (I didn't open the Xprinter since it takes 220 V AC; the new one takes 24 V DC from a separate power adapter.)
Here's some bash that prints a PBM image (the printer treats zero bits as black, so if the width is not a multiple of 8, the zero padding bits at the end of each row become a black vertical bar):
magick magick:logo -resize 576x -dither FloydSteinberg -colors 2 -negate pbm:- | {
read; read w h
echo 'CLS'
printf 'SIZE %d mm,%d mm\n' $(((w+7)/8)) $(((h+7)/8)) # for paper rolls
printf 'BITMAP 0,0,%d,%d,0,' $(((w+7)/8)) $h
cat
echo 'PRINT 1' # or any number of copies
} > /dev/usb/lp0
And this is for the Xprinter. The loop is because the printer cannot handle high images (I ran into this problem trying to print text banners like "KEEP OUT KEEP OUT KEEP OUT"); the HPRT has a similar limit but I haven't hit it yet:
le16() { printf $(printf '\\%o\\%o' $(($1&255)) $(($1>>8))); }
magick -size 384x384 gradient: -rotate 90 -dither FloydSteinberg -colors 2 pbm:- | {
read; read w h
for (( ; h > 2000; h -= 2000 )) do
printf '\x1d\x76\x30\x30'
le16 $(((w+7)/8)); le16 2000
head -c $((w*2000))
done
printf '\x1d\x76\x30\x30'
le16 $(((w+7)/8)); le16 $h
cat
} > /dev/usb/lp0
The magick below generates the image:
magick -font Comic-Sans-MS -pointsize 400 label:'DUMB SHIT' \
-gravity center -extent x384 -rotate 90
Just figured out how to use a crappy computer I bought earlier with a pathetic N3150 processor and 4 GB of RAM, without attaching a monitor (which is a huge hassle): SSH. Just boot an Archlinux install ISO on it, attach it to my laptop via Ethernet, attach a keyboard, wait until the Ethernet lights start blinking, and type (very carefully):
a=`echo /sys/class/net/e*`
a=${a#/sys/class/net/}
ip a a 192.168.0.2/30 dev $a
passwd
secret
secret
And, on my laptop:
ip address add 192.168.0.1/30 dev eth0
ssh -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o ObscureKeystrokeTiming=no \
root@192.168.0.2
I came up with the trick to get the name of the Ethernet interface, the first two options to ssh keep the known_hosts file clean (see ArchWiki), and the third one makes the light blink exactly once per key stroke, which is nice.
Having to attach a keyboard is still annoying, and I can't persist anything since it doesn't have a disk and writing to the thumb drive is silly. (Update 2026-06-21: it's now running with an old crappy disk.)
Yesterday I learned that JIS B5 is a different paper size than ISO B5.
Just watched Hypernormalisation and it's quite good. Familiar ideas from a somewhat different perspective, which is always refreshing. One thing that bugs me though is attributing suicide bombing to the Middle East: one Chinese soldier did it to slow down the Japs (didn't kill any though; this is also disputed, but his comrades support the story and the authority claims more), and the Japs did it to the Americans (Kamikaze).
I tried the sleeping pill (that I have) and it seems to work, except it makes me sleepy when awake as well. I guess I'll live with that till I get to see a doctor. (I'm prescribing myself: a dead man can't see a doctor.)
I'm having yet more sleep problems and I hate this. Maybe I should try and entertain myself some more: anime, music, movies, books for fun... I guess I won't get any work done anyway, even if I try all the time, so having some fun is the rational choice. I'll try taking sleep pills and see if that helps.
It's funny how easy updating this website is. I'm so lazy that organizing changes into git commits seems like work, and I don't use a static site generator so I don't benefit from CI. Updating this website is just rsync -r www/now.vursc.org vps:now.vursc.org.
I'm using the deprecated (or whatever people call that these days) <tt> tag here, and I really don't understand why the HTML people decided to remove it. Not everything monospace is code, and <b>, <i>, <u>, and <s> are kept anyway, so what is the point of removing <tt>?
I'm thinking about a new "generic" text markup language. Markdown is not expressive enough and suffers from incompatibility. reStructuredText is tied to Python and has "weird" syntax rules like the double colon and whitespace around inline markup, which makes the format more intuitive at the expense of complexity. (La)TeX is too low-level and, though not inherent, mostly tied to paper.
I think I will build it in JavaScript first, since I need KaTeX. The dollar sign is too hard to type (I need to press shift), let alone the LaTeX-style \( and \[. The backtick is better: just one keystroke and not used much in math. Backticks are still useful for inline code, so the choice will be a document-wide option (or directive). Now that I have two kinds of backtick-delimited "raw" content, I might as well make the starting backtick take a type tag, so m`E=mc^2` is explicit math, c`foo(bar())` is explicit code, and if the starting backtick follows a space or newline the default type is used and the space is preserved.
Escaping is a problem. It wouldn't be if everyone just writes s-exprs, but real people are lazy. The easiest way is to just disallow the backtick in backtick-delimited content. Another delimiter is needed for markup containing literal backticks, and I choose brackets since they are also easy to type and not used much in prose. The escape character is the conventional backslash. Thus m[E=mc^2] is exactly the same as m`E=mc^2`. Brackets can nest into a tree, and it would be nice if the parser can be generic, so the syntax is mostly uniform, like s-exprs. (Todo: alternative designs for escaping and their problems; markup with multiple arguments.)
Paragraphs are so common they deserve special syntax, though. Paragraphs are usually delimited by empty lines, but for CJK languages, which doesn't separate words with spaces, either conversion to HTML or the browser has to decide if a space should be inserted when joining two lines, which is ugly. So one long line per paragraph is the way to go. I keep the empty lines in between because wrapped long lines are hard to tell apart.
A curiosity is to embed s-exprs in this markup. One may simply wrap each atom in brackets, [[like] [this]], or use backticks if the atom doesn't contain one, [`like` `this`]. It would be nice if simple words doesn't need quoting, but then one cannot tell if [foo] is the atom foo or the list (foo).