Skip to content

Instantly share code, notes, and snippets.

@spdegabrielle
Created November 5, 2023 12:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spdegabrielle/99fdcc6bfed25a3ef026aa961b0209d5 to your computer and use it in GitHub Desktop.
Save spdegabrielle/99fdcc6bfed25a3ef026aa961b0209d5 to your computer and use it in GitHub Desktop.
@thingskatedid 💡FAQ about displaying stuff in a terminal

https://x.com/thingskatedid/status/1316074032379248640?s=20

Q. Kate which terminal is that!? omg A. The terminal I use is called kitty. https://sw.kovidgoyal.net/kitty/

Other terminals can display images, too. Go and read this: https://saitoha.github.io/libsixel/

I think kitty uses its own protocol, rather than sixel.

Q. Where can I get idot? A. It's just a shell alias to run dot(1) with defaults for fonts and colours to match my terminal.

It's the regular Graphviz dot you're looking for, outputting svg.

Q. How do you get awk to output graphics? A. It's just SVG. You can print it.

Q. How does your terminal render SVG?? Q. omg I want a terminal with svg support! Q. wowww svg in your terminal is cool A. It doesn't. I use rsvg-convert to render to a png, and then the terminal's builtin to display the png image.

I'd like a terminal with svg support, too.

Q. Kate how do you draw the hippos with the chunky square dots?

Q. Kate how do you draw the moomins with the square dots? A. They're UTF8 braille characters.

I wrote a program to convert an XBM image to make them. You can get xbm-utf8.c here: https://gist.github.com/katef/59450aa622315bd35fc27bd383c2dbe6#file-xbm-utf8-c https://gist.github.com/katef/59450aa622315bd35fc27bd383c2dbe6#file-xbm-utf8-c

Rendering with UTF8 braille characters depends very much on your font. Here's xterm instead, with the default 'fixed' font:

Kate @thingskatedid · Oct 13, 2020 Q. Kate why is your prompt a semicolon, you weird hipster minimalist? A. So you can cut & paste multiple lines.

The idea comes from Tom Duff, it's the default for the rc(1) shell.

Kate @thingskatedid · Oct 13, 2020 Q. Why does your prompt change colour? A. I have it change colour when $? is non-zero.

Usually I don't care what the value is, just whether a command failed or not.

In zsh that's: PS1='%(?.%(!.#.;).%F{6}%B;%b%f) '

You can get plot.awk here if you want it: https://gist.github.com/katef/fb4cb6d47decd8052bd0e8d88c03a102 https://gist.github.com/katef/fb4cb6d47decd8052bd0e8d88c03a102

libfsm for regular expressions: https://github.com/katef/libfsm/

kgt for context-free grammars as railroad diagrams: https://github.com/katef/kgt/ (which can also generate html for a grammar)

I forgot, this is handy if you work with fonts a bunch, maybe you might this this useful too.

Quick CLI overview of opentype features for a font I might use, without going to the trouble of installing it. It's always handy to try them out and experiment.

@behdadesfahbod's hb-view is great for this, it comes with the excellent HarfBuzz. otfinfo tells you what's supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment