Automating some file history with git snapshots

Tags:

My Note taking tool is part journal, part shopping list, part blog posts, part programs. Most notes get written once. Some get revised, some get posted or implemented. The tool is fully self-hosted and written by me, so I get to decide on its (lack of) features. For simplicity I avoided keeping a full note history. But then I realized that maybe some kind of history is actually nice, for the case when a wonky network failure erases or corrupts some note.

My solution for this feature is to simply snapshot the directory where I keep my notes every hour into a git repository. This gives me some change history, but it does not record every keystroke. The cron job is the following shell script:

SOURCE=/home/corion/bin/App-notes-htmx/notes_corion
TARGET=/home/corion/backup/notes_corion_history
if git --git-dir=$TARGET --work-tree $SOURCE diff --quiet; then
    git --git-dir=$TARGET --work-tree $SOURCE add  --all
    git --git-dir=$TARGET --work-tree $SOURCE commit -m "Hourly"
fi

I've "implemented" the tool as a shell script, but if I add more features, I will likely move it to Perl and use Git::Raw to do the adding/filtering/pruning myself. But then I would lose the convenience of .gitignore for example.

I still have on my list some kind of git history-prune, that coalesces adjacent git commits if they are too close, just to eliminate changes that don't matter anymore. Maybe after a month, compress all commits older than one month and less than 24 hours apart into a single commit.

I think having all changes of a single day in one commit is a sensible granularity for my use case.

Hardware: Steam Controller 2

Tags:

Valve Steam Controller (2026)

Image of Valve Steam Controller

On May 4th, the new Valve Steam Controller became available. Ordering was a bit harder than I thought, but it seems Valve was overwhelmed by the demand. In fact, it seems to have sold out the first batch within two hours. The problems showed themselves to me as being unable to conclude the purchase, as the credit card verification never popped up.

After that initial hiccup, everything else went smoothly. The controller arrived two weeks later at my doorstep.

What's in the box?

Valve Steam Controller box image

The box looks very good. I think Valve aims straight for a premium experience. The cardboard box feels very sturdy and nice to open.

Valve Steam Controller open box

The box contains the controller, the puck and an USB-A to USB-C cable for connecting the puck or the controller to a PC. The puck is a magnetic loading adapter for the controller. I've grown quite fond of such loading adapters even if they are again proprietary connectors that might get lost. When connecting the controller via the puck to a PC, both get immediately a firmware upgrade via Steam. The process is convenient enough and I also don't have the fear that Valve might lock me out of features by upgrading the firmware.

Look and Feel

image of me holding the Steam Controller

The controller feels very good in my hands. It is matte black, although time will tell how much the coating degenerates when handled with sweaty hands.

Compatibility

When Steam is not present on a device, the controller presents itself as a trackpad with scroll wheel. The right trackpad controls the mouse pointer while the left trackpad acts as scroll wheel. The right triggers act as left/right mouse button. The D-pad acts as cursor keys. This makes the controller not too bad when operating a device that does not have immediate gamepad support.

The controller can connect via USB directly, via the puck (which, again, connects via USB), or via Bluetooth. You can switch between the connection modes when switching the controller on by holding R1-A (for puck mode) or R1-B for Bluetooth mode.

Pixel 9 / GrapheneOS

The Steam Controller connects easily via Bluetooth and shows up as a mouse (touchpad) + gamepad. The right touchpad controls the Android mouse pointer in a good way. The haptic feedback the trackpads give when moving the mouse pointer is not annoying.

Linux PC / Steam

The Steam Controller connects via the puck, which connects via the USB cable. It is immediately recognized by Steam and just works. The middle button ("Steam button") launches Steam in Big Picture mode, turning the experience into a console-like experience.

Linux PC / Tablet

The tablet has no Steam client installed, but the controller "works" there through the puck without needing any fiddling or installing. It is only recognized as a mouse. The KDE settings menu does not recognize the game controller. Installing the steam-devices Debian package immediately lets the controller get recognized, but no inputs are working. Most likely some udev rules need to be added to properly read the controller inputs, but I'll be patient and wait until the Debian maintainers address this.

Windows PC / Steam

The Steam Controller connects via the puck, which connects via the USB cable. It is immediately recognized by Steam and just works. The middle button ("Steam button") launches Steam in Big Picture mode, turning the experience into a console-like experience.

Connecting via Bluetooth also works without problems.

Steamdeck

Image of firmware upgrade software

The Steam Controller connects via the puck, which connects via the USB cable. It is immediately recognized by Steam and just works, but weirdly enough, it wanted to do another firmware upgrade, twice. Otherwise, the components are quite similar to the components used on the Steamdeck. Using the controller in desktop mode as mouse replacement also feels better than using the sameish trackpads on the Steamdeck itself. The L5 button acts there as opener for the start menu, which is a nice shortcut.

Games

While I'm leaning more towards keyboard+mouse , some games lend themselves towards being played with a gamepad.

GTA Vice City

In my quick test, I played GTA Vice City, and using the right trackpad as mouse worked passably. I think for a good experience, I will have to sift through the Steam controller profiles to find one that replicates the keyboard+mouse setup well enough.

Silksong

Playing Silksong with the controller also feels good. The controller feels better than the Steamdeck, as the bottom finger buttons R/L 4 and R/L 5 lie closer to where my fingers expect them, and obviously the controller is lighter than the Steamdeck. Playing with the Steamdeck detached makes me realize that maybe having a dock for the Steamdeck would be interesting.

Steam Frame still alive

Tags:

It seems that the Steam Frame VR headset is still alive and they actually distribute early hardware of it:

Link: VodooDE via Tiktok

This makes me happy!

Update: Seems that the video got deleted. Maybe this is a good sign.

Override Firefox, LWP::UserAgent and curl DNS resolution

Tags:

This post is part of the notes I took while preparing for and during the migration of https://perlmonks.org behind a CDN. I mostly publish these notes so that I can find them again later.

There are situations where I don't want to override the DNS resolution for my complete system, but still connect to specific machines pretending a DNS name resolves to them. Examples are SSL certificate checking, and various firewall configurations. Especially while migrating a site behind a CDN or when setting up s site beh[nd a reverse proxy or Wireguard, I want to inspect and compare the results of queries to the different machines.

For these examples, assume that 10.0.0.1 is the machine serving the website perlmonks.org as the origin. The public DNS resolves to a pool of CDN machines somewhere else, but we want to debug what the original source is serving. The original machine also wants to be accessed as perlmonks.org over SSL.

Override curl name resolution

This is documented in the curl manpage

curl --resolve perlmonks.org:443:10.0.0.1 https://...

Override Firefox name resolution

Open the Firefox browser console with Ctrl+Shift+J . You should be able to enter Javascript there; If not, enable "Debugging Tools für Browser-Chrome" in the normal browser console settings (F12 , then F1 yeah, CUI standards be damned ). Then enter the name/IP pair for name resolution. This persists until you restart Firefox.

const gOverride = Cc["@mozilla.org/network/native-dns-override;1"].getService(Ci.nsINativeDNSResolverOverride);
gOverride.addIPOverride("perlmonks.org", "10.0.0.1");

Override LWP::UserAgent DNS name resolution

For LWP::UserAgent there is no general mechanism, but monkeypatching LWP::Protocol::https works. To also make SNI work, you should additionally pass in the SSL_hostname explicitly to the SSL options. I'm not sure why this is necessary, as the code in LWP::Protocol::https extracts the hostname from the request URL, but this made the difference for me between 421 Misdirected Request and 200 OK with Fastly :

our $force_peeraddr;
around 'LWP::Protocol::http::_extra_sock_opts' => sub {
        my $orig = shift;
        die unless wantarray;
        my @rv = $orig->(@_);
        push @rv, PeerAddr => $force_peeraddr if defined $force_peeraddr;
        return @rv;
};
around 'LWP::Protocol::https::_get_sock_info' => sub {
        my $orig = shift;
        my ($self, $res, $sock) = @_;
        my $cert = $sock->get_peer_certificate;
        my @san = $cert->peer_certificate('subjectAltNames');
        use Data::Dumper; warn Dumper \@san;
        while (@san) {
                my ($type_id, $value) = splice @san, 0, 2;
                $res->push_header("Client-SSL-Cert-SubjectAltName"
                        => "$type_id: $value");
        }
        $orig->(@_);
};

$force_peeraddr = '10.0.0.1';

my $ua = LWP::UserAgent->new(
    ssl_opts => {
        verify_hostname => 0,
        SSL_hostname => 'perlmonks.org', # for SNI
    },
    timeout => 60,
);

Override Chrome name resolution

It seems that this is not possible.

Override wget name resolution

It seems that this is not possible.