HUB
Sign inSign up

mapitman/hollywood

By mapitman

•Updated 11 days ago

Same image as mapitman/hollywood-directors-cut: Hollywood, re-edited, in a container.

Image
1

2.8K

mapitman/hollywood repository overview

This is the same image as mapitman/hollywood-directors-cut⁠. The project is now called Hollywood: Director's Cut. Both names are kept up to date, so commands that use this name keep working.

⁠🎬 Hollywood: Director's Cut

 ┌──────────────────────────────────────────────────┐
 │  HOLLYWOOD: DIRECTOR'S CUT                       │
 ├─────────────┬─────────────┬──────────────────────┤
 │ SCENE: ∞    │ TAKE: 1     │ ROLL: /dev/urandom   │
 ├─────────────┴─────────────┴──────────────────────┤
 │ DIRECTOR: you         CAMERA: tmux               │
 └──────────────────────────────────────────────────┘

The terminal that makes you look like you are hacking the Gibson⁠. Re-edited. No studio notes.

🎟️ Rated T for Terminal. Contains falling green letters and mild technobabble.

🦖 Bystanders will say: "It's a UNIX system, I know this!"⁠

Hollywood⁠ fills your terminal with busy technobabble: htop here, falling green letters there, a world map for good measure. Dustin Kirkland wrote the original. This is my re-edit of it, in a container, with the things that bothered me fixed.

The Director's Cut running: several panes of widgets, each on its own timer

Thirty seconds of the Director's Cut.

⁠🍿 Now showing

docker run -it --rm mapitman/hollywood-directors-cut

The same image is also published as mapitman/hollywood, its old name, so old commands keep working.

It runs on Intel and AMD machines (linux/amd64) and on ARM machines, Apple Silicon included (linux/arm64). Docker picks the right one for you.

🎬 Only four panes on a Mac? Docker on a Mac runs inside a virtual machine, and the pane count is capped at two per CPU that the machine has. Colima starts with 2 CPUs, so you get at most 4 panes. To give it more, run colima stop and then colima start --cpu 8. In Docker Desktop, change the CPU setting under Settings, then Resources. To see how many CPUs the container gets, run docker run --rm debian:trixie-slim nproc.

To leave the theater, press <ctrl> - c until the panes stop spawning, then press <ctrl> - d to exit the container. You can also stop it from another terminal with docker stop hollywood, if you started it with --name hollywood.

When Hollywood exits, the entrypoint puts your terminal back: it shows the cursor, leaves the alternate screen and turns off mouse reporting. That also happens after docker stop. It cannot happen after docker kill, because Docker gives the container no time to clean up. If your cursor is missing after a docker kill, run reset (or tput cnorm).

⁠✨ What is different from the original

The original works. I wanted it to look better on a big screen and to stop doing a few annoying things, so I changed these:

  • The number of panes depends on the size of your terminal. The original makes two panes per CPU, which is 16 tiny panes on an 8-CPU machine. Now the terminal size sets a maximum, and each layout picks a random number from 3 up to that. When the number is even, all the panes are the same size.
  • Each pane swaps its widget on its own timer, 30 to 45 seconds after the last swap. No two panes show the same widget. Every 5 minutes the whole window is rebuilt with a new layout and a new number of panes.
  • The sound wave, the wallpapers and the world map use half blocks in color. Every cell shows two pixels. There are no random letters, and nothing scrolls. The image brings 171 wallpapers from the KDE Plasma set.
  • A widget that needs more room than its pane has gets swapped for one that fits.
  • The base is Debian 13 (stable), and Hollywood 1.25 comes from a pinned upstream commit. All 26 widgets work.
  • Your terminal is reset when the show ends, and Byobu never asks about ctrl-a.
  • There is a new btop widget. It shows the CPU, memory, network and processes. In a small pane, it shrinks to just the CPU box.
  • There is a new gping widget. It graphs the ping time to several well-known sites.
  • There are six more new widgets:
    • mtr shows a live route trace.
    • nms decrypts text on the screen, as in Sneakers.
    • lolcat colors text in animated rainbow colors.
    • hexyl shows a colored hex dump of a program.
    • connections shows a live table of network connections.
    • portscan shows the probes of a port scan of the local host.
  • The figlet widget is gone. It only printed one word at a time, and the new widgets show more.
  • The bmon widget is gone. It watches the container's network interface, which is nearly idle, so its graphs stayed empty.

The details are under "Behind the scenes", and my reasons are under "Director's commentary".

⁠🎭 The cast

Hollywood opens a tmux session and fills it with panes. Each pane runs one widget, and each widget wraps an ordinary tool. There are 26 widgets. All of them play themselves.

WidgetShows
apgrandom passwords from /dev/urandom, colored with ccze
atopsystem and process monitor (needs 60 x 24)
batrandom source files from /usr, syntax highlighted with batcat
btopresource monitor with CPU, memory, network and process boxes (needs 60 x 8, see "The btop widget")
cmatrixfalling green characters, as in The Matrix
coderandom C, C++, Java and Python files, highlighted with pygmentize
connectionsa live table of the network connections of the container (needs 60 x 8, see "The connections widget")
errnothe list of error codes, in random order
gpinglive graph of the ping time to well-known sites (needs 40 x 8, see "The gping widget")
hexdumphex dumps of programs in /usr/bin
hexylcolored hex dumps of programs in /usr/bin (needs 78 x 5, see "The hexyl widget")
htopinteractive process viewer
jp2awallpaper photos in 256 colors, drawn with half blocks (see "Wallpapers")
logslog files under /var/log
lolcattext from a random file in animated rainbow colors
manrandom man pages, printed one line at a time (see "Slower man pages")
mapa map of the world in 256 colors, drawn once with half blocks (see "Wallpapers")
mplayera sound-wave video in true color, drawn with half-block characters (see "The mplayer widget")
mtrlive trace of the route to a well-known site, with the delay at each hop (needs 50 x 8)
nmstext from a random file that decrypts on the screen, as in Sneakers (see "The nms widget")
portscanthe probes of an nmap port scan of the local host only (see "The portscan widget")
pva fake file-transfer progress bar
speedometernetwork throughput graph
sshartthe "drunken bishop" walk of random SSH keys, drawn step by step in color (see "The sshart widget", needs 20 x 12)
statfile details for random paths under /sys and /dev
treedirectory trees under /sys and /dev

The Debian slim image removes man pages and documentation. The Dockerfile puts them back so the man and code widgets have something to show.

⁠📝 Production notes

Every setting is an environment variable, because even directors take notes.

SettingEnvironment variableDefault
Cells per pane (this sets the maximum pane count)HOLLYWOOD_CELLS_PER_PANE1400
Fewest panes, even in a small terminal (the launcher needs at least 2)HOLLYWOOD_MIN_PANES3
Pick a random pane count up to the maximum, at the start and at every rebuild (0 always uses the maximum)HOLLYWOOD_RANDOM_PANES1
Minimum seconds a pane keeps a widget (the maximum is 1.5 times this)HOLLYWOOD_DELAY30
Seconds between layout rebuilds (0 turns the rebuild off)HOLLYWOOD_REBUILD300
Playback speed of the mplayer widget (0.5 is calmer, 1 is normal speed)HOLLYWOOD_MPLAYER_SPEED0.75
Crop filter for the mplayer widget (scale shows the whole video)HOLLYWOOD_MPLAYER_FILTERScrop=128:64:0:16
Seconds the jp2a widget shows each pictureHOLLYWOOD_IMAGE_SECONDS3
Seconds the man widget waits after each line (0 prints a page at once)HOLLYWOOD_MAN_DELAY0.04
Color the text of the apg, errno, hexdump, logs, man, portscan, stat and tree widgets with lolcat (0 uses the original colors)HOLLYWOOD_RAINBOW1
How the jp2a and map widgets draw pictures: auto asks the terminal, kitty forces Kitty graphics, off uses half blocksHOLLYWOOD_IMAGESauto
Size of one terminal cell in pixels, such as 9x18, if the terminal does not report itHOLLYWOOD_CELL_PX10x20
Milliseconds between updates of the btop widget (btop accepts 100 or more)HOLLYWOOD_BTOP_UPDATE_MS100
Hosts the gping widget pings, separated by spacesHOLLYWOOD_GPING_HOSTSgoogle.com cloudflare.com github.com wikipedia.org amazon.com 1.1.1.1 8.8.8.8
Hosts the mtr widget traces (it picks one at random), separated by spacesHOLLYWOOD_MTR_HOSTSthe same list as gping
Color of the text that the nms widget decrypts (white, yellow, black, magenta, blue, green or red)HOLLYWOOD_NMS_COLORgreen
Hosts the connections widget connects to, separated by spacesHOLLYWOOD_CONNECTIONS_HOSTSthe same list as gping
docker run -it --rm -e HOLLYWOOD_CELLS_PER_PANE=1000 -e HOLLYWOOD_DELAY=60 mapitman/hollywood-directors-cut

The -s (panes) and -d (minimum seconds a pane keeps a widget) options override the computed values:

docker run -it --rm mapitman/hollywood-directors-cut -s 6 -d 60

To find your terminal size, run stty size. It prints rows, then columns.

⁠🎞️ Behind the scenes

How the movie gets made.

⁠Pane count and widget time

The entrypoint script measures your terminal. Docker passes the size in character cells, so the script divides the cell count by 1400 to get the maximum number of panes. Two other limits apply: two panes per CPU, and the number of widgets. Then pane-count.sh picks a random number from 3 up to that maximum. The minimum wins over the maximum, so a small terminal or a machine with one CPU still gets 3 panes. Some layouts end up with fewer and larger panes, and that is when the widgets that need a big pane can run.

A full-screen terminal on a 1920x1080 screen is about 161x37 with a typical font, which gives a maximum of 4 panes. Set HOLLYWOOD_RANDOM_PANES=0 to always use the maximum.

The CPU limit counts the CPUs that the container can see, not the CPUs of your computer. On Linux the two numbers are the same. On a Mac, Docker runs in a virtual machine, so the container sees only the CPUs that the virtual machine has.

Each pane keeps its widget for 30 to 45 seconds, then swaps in another unused widget. Every pane picks its own time, so the panes change at different moments. Every 5 minutes the launcher rebuilds the window. One pane stays and the others are replaced. The launcher picks a new number of panes and lays them out again at random.

⁠Same-size panes

An even pane count gives all panes the same size, give or take one cell for the borders. even-layout.sh arranges them in a grid. It picks the grid whose panes are closest to 2.5 times wider than tall, which looks about square in a terminal. Four panes make a 2 by 2 grid, six make 3 columns by 2 rows, and eight make 4 columns by 2 rows. The grid is rebuilt every time the launcher rebuilds the window. An odd pane count keeps the random layout, so the panes have different sizes.

⁠Widget size guard

Some widgets stop working in a small pane. The image runs every widget through a guard script (widget-guard.sh). The guard checks the pane size when the widget starts and again after every resize. If the pane is too small, the guard stops the widget and starts a different one that fits.

WidgetMinimum columns x rows
atop60 x 24
btop60 x 8 (all four boxes need 80 x 24)
connections60 x 8
gping40 x 8
hexyl78 x 5
mtr50 x 8
sshart20 x 12

All other widgets run in any pane size. To change a minimum or add a widget, edit the MIN_ tables and the min_rows function at the top of widget-guard.sh.

On a 161x37 terminal with 4 or more panes, no pane is 24 rows tall, so atop cannot run. A layout with 2 or 3 panes has room for it.

⁠No repeated widgets

No two panes run the same widget. Each running widget holds a claim in /tmp/hollywood-claims, and a pane that starts or switches picks a widget that nobody else holds. If no unused widget fits in a new pane, the pane closes instead of repeating a widget. This only happens with many small panes, for example 16 panes on a 320x90 terminal. When a pane is ready to swap and no other widget is free, it keeps its current widget.

⁠The btop widget

Hollywood has no btop widget, so the image adds one (btop-widget.sh). btop shows four boxes: the CPU, the memory, the network and the processes. All four need a pane of at least 80 columns by 24 lines. A smaller pane gets only the CPU box, which fits down to 60 columns by 8 lines. In a 4-pane layout at 161 x 37 the panes are about 80 x 17, so they show the CPU box. By default btop updates every 2000 ms. The widget sets 100 ms, the fastest that btop allows, so the graphs move smoothly.

The widget picks the boxes from the pane size when it starts. If you resize the pane across the 80 x 24 edge, it starts btop again with the boxes that fit. When the widget guard stops it, the widget puts your terminal back the way it was, because btop does not do that itself.

To run just this widget:

docker run -it --rm --entrypoint /opt/hollywood/lib/hollywood/btop mapitman/hollywood-directors-cut

Press q to leave btop. The widget then starts it again, so press ctrl-c to stop the widget.

⁠The gping widget

Hollywood has no gping widget, so the image adds one (gping-widget.sh). gping draws a live graph of the ping time to several hosts. By default it pings google.com, cloudflare.com, github.com, wikipedia.org, amazon.com, 1.1.1.1 and 8.8.8.8. It needs a pane of at least 40 columns by 8 lines.

Set HOLLYWOOD_GPING_HOSTS to a list of hosts, separated by spaces, to ping other sites. When the widget guard stops the widget, it puts your terminal back the way it was, because gping does not do that itself.

gping runs the ping command, so the image includes iputils-ping. The container needs network access to reach the hosts. If your setup blocks ICMP, the graph stays empty.

⁠The mtr widget

Hollywood has no mtr widget, so the image adds one (mtr-widget.sh). mtr shows the route from the container to a host, with the delay at each hop, and updates it live. The widget picks one host at random from the gping list each time it starts. Set HOLLYWOOD_MTR_HOSTS to a list of hosts, separated by spaces, to trace other sites. It needs a pane of at least 50 columns by 8 lines. Like gping, it needs network access, and a setup that blocks ICMP shows empty hops.

⁠The lolcat widget

Hollywood has no lolcat widget, so the image adds one (lolcat-widget.sh). It colors the first lines of a random text file from /etc, /usr/share/doc or /var/log in animated rainbow colors, waits 3 seconds and repeats. It runs in any pane size. lolcat is written in Ruby, so it adds the Ruby interpreter to the image. Debian installs lolcat in /usr/games, which is not in PATH, so the widget uses the full path.

⁠The hexyl widget

hexyl prints a hex dump in colors: null bytes in gray, text in cyan, and other bytes in other colors. The widget (hexyl-widget.sh) dumps one screen of a random program from /usr/bin, starting between 10% and 60% of the file, where most programs keep their code. It waits 2 seconds and does it again. hexyl always prints 16 bytes in a row, which is 78 columns wide, so the widget needs a pane of at least 78 columns by 5 lines.

⁠The connections widget

The widget (connections-widget.sh) shows the output of ss -tn, which lists the TCP connections, and watch highlights what changes. A container with nothing running has no connections, so the widget opens its own. Every 1.5 seconds it opens a TCP connection to port 443 of a random host, and it keeps at most 8 connections open. The oldest closes first. The hosts are the same as the gping list. Set HOLLYWOOD_CONNECTIONS_HOSTS to a list of hosts, separated by spaces, to use other hosts. The widget needs a pane of at least 60 columns by 8 lines and network access.

⁠The portscan widget

The widget (portscan-widget.sh) runs nmap with --packet-trace, which prints one line for each probe and for its answer. It scans 200 ports at a random place in the range, 20 ports a second, then waits 2 seconds and scans another range. It scans only the local host (127.0.0.1), and nothing in the container listens on those ports, so every probe ends with "Connection refused". It uses the nmap connect scan (-sT), which needs no special privileges. It runs in any pane size.

⁠The mplayer widget

The image replaces Hollywood's mplayer widget with two small files, mplayer-widget.sh and soundwave-render.py.

The video is a pre-rendered animation of an audio waveform, and it has no sound track. The widget asks mplayer to crop the video to the waveform rows and scale it to your pane. Then mplayer sends the raw frames to the renderer. The renderer draws each terminal cell as a half block, so every cell shows two pixels in true color. When the pane changes size, the widget starts again at the new size. A pane with an odd width leaves its last column empty.

To run just this widget:

docker run -it --rm --entrypoint /opt/hollywood/lib/hollywood/mplayer mapitman/hollywood-directors-cut

Press ctrl-c to stop it. Run reset afterward if your cursor stays hidden.

The mplayer widget uses the same Kitty mode. Instead of half blocks, soundwave-render.py sends every frame of the video as a PNG picture, and the terminal stretches it over the pane. The placeholder cells are drawn once. Inside tmux, tmux redraws the pane after each frame, so the widget sends about 0.5 MB per second.

⁠Slower man pages

Hollywood's man widget prints a whole manual page at once, so the pane scrolls too fast to read. The image replaces it with man-widget.sh, which prints each page one line at a time with a pause of 0.04 seconds after every line, which is about 15 lines per second in practice. It waits one second between pages. Set HOLLYWOOD_MAN_DELAY to change the pause, and use 0 for Hollywood's speed.

⁠The sshart widget

OpenSSH draws the random art of a key with the "drunken bishop" algorithm. A bishop starts in the middle of a board of 17 x 9 cells. It takes one diagonal step for every 2 bits of the key's hash, and each cell counts its visits. The count picks the character from .o+=*BOX@%&#/^, and the start and end cells show S and E.

Hollywood's sshart widget runs ssh-keygen and prints its text and its small picture in the corner of the pane. The image replaces it. sshart-widget.sh starts sshart-render.py, which runs the same walk with random hashes and draws it step by step. Each board types a fake ssh-keygen -lv command and a fingerprint, then the bishop walks at 30 steps per second while the cells fill in. The color of a cell goes from green through yellow to red as its count grows. After the walk the board stays for 2 seconds, and then a new key starts. The pane holds as many boards as fit, each on its own schedule. A pane with fewer than 15 rows shows the boards without the typed lines. The finished boards are the same as the ones OpenSSH draws for the same hash.

⁠Rainbow text

lolcat colors each character of a text along a rainbow. The apg, errno, hexdump, logs, man and stat widgets pipe their text through ccze -A, and the tree widget prints plain text. The image installs ccze-rainbow.sh as /usr/local/bin/ccze and tree-rainbow.sh as /usr/local/bin/tree. /usr/local/bin comes before /usr/bin in PATH, so those widgets run the stand-ins, and no widget script changes. The stand-in for ccze ignores the ccze options and sends the text through lolcat. The stand-in for tree uses lolcat only when the output goes to a terminal. The portscan widget pipes nmap through lolcat itself. Set HOLLYWOOD_RAINBOW=0 to run the real ccze and tree again and to print the nmap text without colors.

⁠Wallpapers

The jp2a widget shows every JPEG it finds under /usr, one after another, except the map picture, which the map widget shows. The image adds the 171 wallpaper photos from Debian's plasma-workspace-wallpapers package (the KDE Plasma wallpapers) in /usr/share/wallpapers. The package's copyright file is in /usr/share/doc/plasma-workspace-wallpapers/copyright, and Debian lists the wallpapers as GPL-2+.

The image replaces Hollywood's jp2a and map widgets. image-widget.sh is the jp2a widget, map-widget.sh is the map widget, and both draw with image-render.py. Each picture is scaled to your pane and drawn with half blocks in the 256-color palette, so every terminal cell shows two pixels. The picture keeps its shape and sits in the middle of the pane, with black bars where the shapes differ.

If your terminal supports the Kitty graphics protocol with Unicode placeholders (Kitty and Ghostty do), the widgets draw the real pixels instead of half blocks. At the start, the entrypoint asks the terminal whether it supports the protocol and how big a cell is. HOLLYWOOD_IMAGES=off turns the feature off, and HOLLYWOOD_IMAGES=kitty turns it on without asking. The widget sends each picture once as a PNG with a virtual placement, then fills the pane with Unicode placeholder characters (U+10EEEE with a row mark and a column mark). Because the picture is text to tmux, tmux clips it to the pane and redraws it with the rest of the screen. Inside tmux, the widget wraps each graphics command in a passthrough sequence and sets allow-passthrough for its own pane. Each pane uses the picture number 1 + pane number % 255, which is the foreground color of its placeholders, so the number survives tmux's color conversion. If the placeholders do not work in your terminal setup, set HOLLYWOOD_IMAGES=off. A terminal that answers the query but does not support placeholders (WezTerm, for example) may show blank panes; use off there. A terminal multiplexer between the container and the terminal, such as Herdr, must pass Kitty graphics through, and Herdr 0.9.5 has a kitty_graphics setting for that.

The jp2a widget keeps each picture for 3 seconds. The map widget draws the map once. A pane of 120 x 36 cells has only 120 x 72 pixels, so the pictures are blocky. When the pane changes size, the widgets draw the picture again.

The widget never needs more than a few hundred columns of pixels. Therefore the build shrinks the big photos with shrink-jpeg.sh. Photos 3000 pixels wide or more shrink to a quarter of their size. Photos 1500 pixels wide or more shrink to half. That cuts the wallpapers from about 95 MB to 23 MB. The build fails if fewer than 150 wallpapers are installed.

To run just one of these widgets, use jp2a or map as the last part of the path:

docker run -it --rm --entrypoint /opt/hollywood/lib/hollywood/jp2a mapitman/hollywood-directors-cut
docker run -it --rm --entrypoint /opt/hollywood/lib/hollywood/map mapitman/hollywood-directors-cut
⁠Patch to Hollywood

The Docker build applies one patch, and the patch must match Hollywood's code exactly. If a new Hollywood changes the code around the patch, the build fails, so a broken launcher can never end up in the image.

launcher.patch makes three changes to the Hollywood launcher:

  • The launcher picks one random pane for each split. If that pane is too small, tmux refuses the split. The launcher does not retry, so you get fewer panes than requested. The patch makes the launcher try every pane in random order, in both direction
Tag summary
Recent tags
Content type
Image
Digest
sha256:dac8ac3af…
Size
326.1 MB
Last updated
11 days ago
docker pull mapitman/hollywood:latest