Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Running Artemis Spaceship Bridge Simulator in podman

I've previously talked about Artemis Spaceship Bridge Simulator. I have now discovered how to use ansible to set up a podman container running Artemis in wine and vnc. This represents maybe 10 hours of research and development, so a smaller project, but it's complete and very cool.

Some bullet points (for SEO, or something like that):

  • Rootless podman container
  • Minified Artemis tarball (only 10MB!)
  • Wine and Vnc in a container
  • Ansible deployment

Read more…

Converting vobsub to srt

All I wanted to do was shift the timing of the subtitles of a dvd by a little. They drift, and by the end of a ~2 hour movie, they're off by more than 2 seconds. (It's probably that PAL/NTSC frames per second thing; I dunno.)

In the past, it's been possible to use mkvtoolnix-gui to extract the subtitle track to a separate file, and then use subtitleeditor to time scale the dialog.

The output of ffmpeg -in in1.mkv shows the subtitle track clearly.

$ time ffmpeg -i in1.mkv
Input #0, matroska,webm, from 'in1.mkv':
  Metadata:
    creation_time   : 2015-06-24T21:27:55.000000Z
    ENCODER         : Lavf63.1.83
  Duration: 01:58:23.66, start: 0.000000, bitrate: 1225 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m, progressive), 720x480 [SAR 32:27 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 01:57:33.936000000
  Stream #0:1(eng): Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
    Metadata:
      title           : Surround 5.1
      DURATION        : 01:57:33.936000000
  Stream #0:2(eng): Audio: aac (LC), 48000 Hz, stereo, fltp
    Metadata:
      DURATION        : 01:57:33.936000000
  Stream #0:3(eng): Subtitle: dvd_subtitle (dvdsub), 720x480
    Metadata:
      DURATION        : 01:57:33.936000000
At least one output file must be specified

So why didn't this work?

ffmpeg -i in1.mkv -c:s dvdsub -an -vn out1.srt

It's because dvdsub is an image stream for subtitles, and not text. So I had to use some ocr, from package subtile-ocr [sic]. My process used:

mkvextract tracks in1.mkv 3:english.sub
subtile-ocr --lang eng english.sub --output english2.srt

And then subtitleeditor to scale the timing, and then mkvtoolnix-gui to re-mux it together. I'm sure it could be done with cli, but I already know how to click-and-drag in mkvtoolnix-gui quickly.

All this because I like to read my movies.

Summary of packages used

  • subtile-ocr (which needs various tesseract things, probably. I already had tesseract)
  • mkvtoolnix
  • mkvtoolnix-gui
  • subtitleeditor
  • ffmpeg (not necessary for vobsub to srt)

References

  • subtile-ocr --help
  • duck.ai to tell me vobsub is not text.
  • school of hard knocks

Websockets notes

Testing websockets

To test a websocket connection, say, to a Luanti mapserver instance.

Ripped from https://gist.github.com/htp/fbce19069187ec1cc486b594104f01d0

curl 'ws://server3/games/luanti/dummy1/map/api/ws'\
    -H 'Sec-WebSocket-Version: 13'\
    -H 'Origin: http://server3/games/luanti/dummy1/map'\
    -H 'Sec-WebSocket-Extensions: permessage-deflate'\
    -H 'Sec-WebSocket-Key: iZk5UQJ14b3gQx3/T3jBmv=='\
    -H 'Sec-GPC: 1'\
    -H 'Connection: Upgrade'\
    -H 'Upgrade: websocket'

Apache 2.4.37 configs

For Rocky Linux 9 which doesn't have the 2.4.47 "upgrade=websocket" syntax yet.

# mapserver
RewriteRule ^/games/luanti/dummy1/map$ /games/luanti/dummy1/map/ [R,L]
# WebSocket route must precede the broader HTTP map route.
ProxyPass        "/games/luanti/dummy1/map/api/ws" "ws://vm6:30101/api/ws"
ProxyPassReverse "/games/luanti/dummy1/map/api/ws" "ws://vm6:30101/api/ws"
# Other mapserver HTTP requests
ProxyPass        "/games/luanti/dummy1/map/" "http://vm6:30101/"
ProxyPassReverse "/games/luanti/dummy1/map/" "http://vm6:30101/"
<Location "/games/luanti/dummy1/map/">
    ProxyPreserveHost On
    RequestHeader set X-Script-Name "/games/luanti/dummy1/map"
</Location>

FreeIPA www cert with new hosts

I have been setting up new systems to migrate services to, mostly with ansible. I am deep in the Enterprise Linux ecosystem which means systemd and dbus and all the redhatisms. Sometimes it works great, and sometimes it's complicated. It's the price I pay for using FreeIPA domain services.

I found a great certificate management ansible role. It uses certmonger (which uses dbus, etc.) and "just works" until it doesn't.

I learned that in order for my subject alternative name www.example.com to be added to my host HTTP cert, I needed to run a few extra ipa commands.

ipa host-add www.example.com --force # previously done
ipa host-add-managedby www.example.com --hosts=vm6.ipa.internal.com --hosts=vm7.ipa.internal.com
ipa service-add HTTP/www.example.com # previously done
ipa service-add-host HTTP/www.example.com --hosts=vm6.ipa.internal.com --hosts=vm7.ipa.internal.com

And then certmonger could get the cert it needed. And how I got the cert injected into the containers is pretty clever, if I say so myself. I'll have to write about that in the future.

One snippet from the error message looks like the following.

 ca-error: Server at https://dns1.ipa.internal.com/ipa/json denied our request, giving up: 2100 (Insufficient access: Insufficient privilege to create a certificate with subject alt name 'www.example.com'.).

New Luanti mod: Soda

I wanted a mod for soda in Mineclonia, and didn't really find any good options. There was an old mod about soda and vending machines, but it got folded into another mod which doesn't seem to have it currently.

So, I wrote my own mod for soda cans and a 12-pack.

Overview

This Luanti mod is designed for Mineclonia and Minetest Game, and adds a 12-pack of soda cans, empty cans, and drinkable cans of a fun, fizzy drink.

Using

In Minetest Game, the drink gives half a heart. In Mineclonia, the drink adds 15 seconds of Swiftness I, or 15 seconds to any existing Swiftness effect.

Read more…

New Luanti mod: Yet Another Magnet

I saw in the recently added mods list on ContentDB a mod named Magical Magnet. I love the idea of being able to pull dropped items towards me, and also the ability to blacklist items (like cobbled deepslate). I wasn't interested in the magic mods depends on or additional ores added, so I hard-forked this mod for myself!

I set up a battery inventory and MCL and MTG support. I expect I had more fun writing this than I will have using it.

It is now available in Internal ContentDB (scm)

Read more…

Reset Luanti admin password

For some reason, my authentication for my Luanti server was broken. The password was somehow incorrect; I was entirely unable to log in.

My auth backend is the default of sqlite. I found my entry:

sqlite> SELECT * FROM auth WHERE name = "bgstack15";
1|bgstack15|#1#w3kv8dJqu7i0V4kVN1tj2Q#TimueGjuwAFAxuFpXBzotRwqj6K/A5GEJlK/c1P9vLDftBwYq4fKGoDsfc0ExamplennQ9sfcOYsJLLyurq1EDMCFBP5gkojBINsTExamplemgzNFuuZq08PL627UgExampleJ5yDy1Z/w3P/+wmFtExamplex16Vqf2+CjLJlbExamplemKmuJomD8e5K53C3IlXK8MtVhp9S7yQjVKc5IA8TveUwkUxExampleTsMlsh+6Mj93WE4ooDtExample2Wgat7qY1VsNiE7SYLPI/FJhExample6bWp3DNWm4kvIMCE02YpT2aF7HTzFGwrPWyXzoGwnhzQ9vVM9JKlm|1787079240

And then I deleted the entry.

sqlite> DELETE FROM auth WHERE name = "bgstack15";

Because my server minetest.conf "name" entry is my username, my user is automatically an admin. But I still had to register, so I did that without a password, then immediately used the Escape menu to change my password.

I also had to grant myself various privileges again, because the user_privileges table uses a foreign key to table auth. I suppose that means there are dangling entries in my sqlite database. I should have done an update, although maybe the "ON DELETE CASCADE" part worked. Eh, it's just one small list of privs for one account.

References

Web search

  1. minetest reset password sqlite