<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>blog.vdouillet.fr</title>
<link>https://blog.vdouillet.fr/</link>
<atom:link href="https://blog.vdouillet.fr/rss.xml" rel="self" type="application/rss+xml" />
<description>Humble ramblings about IT and occasionally other topics</description>
<language>en-us</language>
<pubDate>Wed, 22 Apr 2026 00:00:00 +0000</pubDate>
<lastBuildDate>Wed, 22 Apr 2026 20:30:01 +0000</lastBuildDate>
<image>
<url>https://blog.vdouillet.fr//favicon.png</url>
<title>blog.vdouillet.fr</title>
<link>https://blog.vdouillet.fr/</link>
</image>
<item>
<title>Last century's HQ video</title>
<link>https://blog.vdouillet.fr/last-centurys-hq-video.html</link>
<description><![CDATA[
<h1>Last century's HQ video</h1>

<p>April 22, 2026</p>

<p>Heads up: this is a long post. Feel free to skip to the end for the technical part.</p>

<p>Titan is back! Who is “Titan”? It's none other than my 1999 PC! But first, a bit of history so you can catch up with the rolling stock. After its <a href="https://blog.vdouillet.fr/which-gpu-for-a-1999-pc.html">first appearance</a> on this blog, Titan kept going strong for a good while. Then a few years ago, Windows 98 decided to kick the bucket after I installed the chipset drivers. My mistake for trying to fix something that wasn't broken. Well, 98 is not known for its robustness anyway, so I just reinstalled it (for the thousandth time :D). It worked fine for a while, then some day, Titan wouldn't boot. Just a black screen that left me completely clueless about the issue. I tried shuffling RAM sticks around, a different GPU, reseating the CPU cartridge… No dice. Had I plugged in a speaker, maybe I would have gotten some clue… But I didn't. So I put Titan aside and in its place came a Socket 7 system I had recently refurbished.</p>

<p>It stayed that way for a while until recently, when I decided time had come to attempt to breath some life into him again. Of course, cardiopulmonary resuscitation had not been maintained during the months Titan spent on the sideways. Thus, hopes were slim. But this time around I was equipped with a speaker and a PCI debug card, strongly determined to fatten them a bit. After laying the motherboard bare on a salvaged piece of cardboard, right next to another PC, I effectively created a FrankenTitan by hooking the motherboard up to the other's PC PSU. Having a spare PSU would surely lack taste ;-) I started simple: CPU, GPU, a known good CR2032 battery and one RAM stick. The speaker pierced my ears with one long beep. Then nothing. Apparently, for this BIOS, one long beep means “RAM issue”. After finding an unofficial manual for this motherboard on <a href="https://theretroweb.com/">the retro web</a>, I was intrigued by the fact that if using a single RAM stick, it recommended to put it in slot 1. On my end, it was in slot 3, the farthest from the CPU, as that's what’s recommended for modern machines. Titan is different. After moving my RAM stick to slot 1, Titan finally agreed to grant me the sacrosanct short beep. POST successful!</p>

<p>Just like that, Titan was back. A few days were all it took me to bring it back to its full glory: a dedicated case and PSU, 2 sticks of RAM, its faithful ISA sound card, a mechanical hard drive loaded with a brand new Windows 98 SE install, and a DVD drive that will play an interesting role a bit later. And with that, I could finally solve a mystery that bogged me ever since I had discovered months ago that a VOGONS user was able to <a href="https://www.vogons.org/viewtopic.php?t=45820">decode a 480p Xvid video</a> on the very same CPU that makes Titan tick. My previous attempts were limited to 360p MPEG2. What gives? How could someone shove more pixels with a more advanced codec down this CPU's throat? The first thing that came to my mind was the wide gap in software stack: I was using Windows 98 and VLC media player, while they were using Windows 2000 with PowerDVD 4.0. I didn't feel like wiping my brand new 98 install, so a switch to 2000 was out of the question. But PowerDVD, I could try. I had a gut feeling that if I wanted to play back higher quality video than what I had previously achieved, I would either need a highly optimized CPU-only decoder, or a GPU-assisted one. If GPU-assisted video decode was ever a thing last century.</p>

<p>I was wrong to be skeptical about GPU-assisted video decode on such an old setup. It is not as new a thing as I thought it to be: PowerDVD 2.55, as far back as the late 1990s, already did it! I preferred this one over 4.0, as the latter seems to belong more to the 2000s. I want to play HQ videos, 1990s style! So 2.55 it is. Turns out that it supports a select few GPUs for hardware-accelerated motion compensation, and Titan's GPU, the mighty S3 Savage4, is among the chosen ones! Upon reading this in the README, the hype immediately grew to unbearable levels. Then quickly took a nose dive when PowerDVD refused to play back all the files I thew at it. All. Of. Them. Heck, even the file playback feature was hidden behind a small button of its UI! When I finally saw the light and realized that PowerDVD was first and foremost conceived to play back… DVDs… (who would’ve guessed?), I shoved one in the DVD drive, and voilà, PowerDVD finally agreed to display some moving pictures. And boy did they look crisp! It was the best video play back I had ever seen from Titan. I'd say the picture quality is very good on a 15”, 1024×768 screen. And perfectly fluid at that, with some CPU cycles to spare even, as the mighty Pentium 3 was chugging along effortlessly, averaging around 50% usage. Having witnessed that, I made it a priority to find out how to produce my own video file(s) that PowerDVD would accept.</p>

<p>Given that PowerDVD 2.55 is very DVD-focused, I took a peek at the <a href="https://en.wikipedia.org/wiki/DVD-Video">DVD specification as summarized by Wikipedia</a>. The highest resolution of the spec is either 720×480 at 30fps (PAL) or 720×576 at 23.97fps (NTSC). The video codec to use is MPEG2 with a bit rate averaging around 6000Kb/s, with a total (audio+video+subtitles) ceiling of 9800Kb/s. Not too shabby! Although PowerDVD seems to take a few shortcuts that do affect image quality a bit compared to a modern player, I have to give my hats off to the engineers that worked magic so that last century's toasters could handle such high quality. On the audio front, the spec mentions several codecs. I chose AC-3 as it should be available for NTSC and PAL players both. It took me a while to find the right FFMPEG setup to produce files close enough to the spec that PowerDVD would accept them. It boils down to a few parameters:</p>

<ol>
<li>You have to use a DVD container (that's <code>-f dvd</code>)</li>
<li>PowerDVD seems quite picky about audio bit rate. A 5.1 channels stream decodes just fine at 448Kb/s, but a stereo one cannot go above 160Kb/s without producing annoying crackling during playback. My attempts to go below 128Kb/s were also unsuccessful, but the audio quality is less than desirable at such low bit rates anyway.</li>
<li>Most content nowadays is presented with an aspect ratio of 16:9 or even 2.35:1. That's a bit tricky because the DVD spec does not offer a 16:9 resolution. The trick is to set a display aspect ratio (DAR) that stretches the pixels horizontally. If encoding at 720x576, the pixels have to be stretched during playback to 1024x576, which is 16:9. For 2.35:1, you basically encode at 16:9 with black borders. There's no other choice because that aspect ratio is not standard in the DVD spec.</li>
<li>Every time I've tried changing the refresh rate of a video, I get stutters in the resulting encode. So I don't change it and just target a resolution that's compatible with the original material refresh rate according to the DVD spec. That's also the reason why I don't use the <code>target</code> presets of FFMPEG, as those will mess with refresh rate. For 23.97 or 25fps, I go for 720x576, effectively targeting NTSC. For 29.97 or 30fps, I go for 720x480, effectively targeting PAL.</li>
</ol>

<p>To maximize quality, I chose a 2-pass encode. Here are the 2 commands that I use, one for each pass. Please note that the commands below assume a target resolution of 720x576 with 16:9 aspect ratio, and adds black borders if necessary. When targeting 720x480, in the <code>-vf</code> part of the commands, you should replace the "576" with "480" (obviously), but also the "1024" with "853". That's to keep the target 16:9 aspect ratio.</p>

<pre><code>$ ffmpeg -i in.mp4 -c:v mpeg2video -b:v 6000k -vf "scale=720:1024*ih/iw,pad=720:576:(ow-iw)/2:(oh-ih)/2,setdar=16/9" -bufsize 1835k -maxrate 9800k -pass 1 -an -sn -f null NUL
$ ffmpeg -i in.mp4 -c:a ac3 -b:a 160k -c:v mpeg2video -b:v 6000k -vf "scale=720:1024*ih/iw,pad=720:576:(ow-iw)/2:(oh-ih)/2,setdar=16/9" -bufsize 1835k -maxrate 9800k -f dvd -pass 2 out.mpg
</code></pre>

<p>I've encoded a few files with these commands, and I'm pleased to report that they play back fine with PowerDVD 2.55. Now going further, I could try to create real DVDs that play on commercial players. That would also allow me to add subtitles, which are not supported with my current workflow. I know that the <a href="https://dvdauthor.sourceforge.net/"><code>dvdauthor</code></a> tools should allow to do that, and more (menus anyone?). I've yet to try it though, might be for another time.</p>

<p>PS: You might be wondering where the "Titan" name comes from. It's pretty simple: when I got it, Titan was setup in a very (very) tall case. Think of a standard ATX case with power supply at the top, but with lots of spare room above the 5.25" bays and the power supply. So when Windows asked me to name it during its first install… A quick glance at the case and inspiration struck me :-)</p>

]]></description>
<guid isPermaLink="false">last-centurys-hq-video.html</guid>
<pubDate>Wed, 22 Apr 2026 00:00:00 +0000</pubDate>
</item>
<item>
<title>Suckless presentations</title>
<link>https://blog.vdouillet.fr/suckless-presentations.html</link>
<description><![CDATA[
<h1>Suckless presentations</h1>

<p>June 9, 2025</p>

<p>I'm a big fan of <a href="http://suckless.org">suckless</a> tools. My laptop has been running <a href="http://dwm.suckless.org">dwm</a> for years now. One of their tool has fascinated me ever since I discovered it: <a href="http://tools.suckless.org/sent">sent</a>.</p>

<p>Its purpose is to create presentations. Being a suckless tool, it only needs a plain text file with each paragraph corresponding to a slide. Pictures can be displayed on a slide, but not with text on the same slide. You then launch sent on the file and the presentation starts in a plain X11 window.</p>

<p>It is diabolically efficient, and I like that. No need for a bloated WYSIWYG tool or elaborate markup language. Just write what you want to present, and it's done. With the file being plain text, you can even open it with any viewer or editor and just read it that way.</p>

<p>Some may find that the resulting presentation is a little too bland for their taste. In my opinion, that's a feature. I think many slides are way too bloated in the presentations I see. Having a few simple sentences or just one picture per slide is enough. It lets the viewer quickly read it and then listen to what is being said about it. The slide should support the talk, and not the opposite.</p>

<p>To test drive sent, I've created a simple "Maven primer" presentation. Don't take it too seriously, I've not checked everything I've written. You can find the presentation source file <a href="https://blog.vdouillet.fr/static/20250609-maven-primer.txt">here</a>. The sent home page is quite clear that exporting the presentation to other formats is not supported, but suggests automating a PNG export of each slide. That's exactly what I've done with a quick and dirty bash script:</p>

<pre><code>#!/bin/bash

echo "Please focus sent window"

for i in {3..1}
do
    echo "$i..."
    sleep 1
done

xdotool getactivewindow windowsize $1 $2

for i in {01..19}
do
    import -screen -window 'sent' $i.png
    xdotool getactivewindow key n
done
</code></pre>

<p>Just launch it with your desired output resolution and then you have 3 seconds to focus the sent presentation to export:</p>

<pre><code>$ ./sent-export.sh 800 600
</code></pre>

<p><a href="https://blog.vdouillet.fr/static/20250609-maven-primer-01.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-01.png" alt="01" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-02.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-02.png" alt="02" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-03.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-03.png" alt="03" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-04.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-04.png" alt="04" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-05.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-05.png" alt="05" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-06.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-06.png" alt="06" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-07.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-07.png" alt="07" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-08.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-08.png" alt="08" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-09.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-09.png" alt="09" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-10.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-10.png" alt="10" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-11.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-11.png" alt="11" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-12.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-12.png" alt="12" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-13.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-13.png" alt="13" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-14.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-14.png" alt="14" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-15.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-15.png" alt="15" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-16.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-16.png" alt="16" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-17.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-17.png" alt="17" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-18.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-18.png" alt="18" /></a>
<a href="https://blog.vdouillet.fr/static/20250609-maven-primer-19.png"><img src="https://blog.vdouillet.fr/static/20250609-maven-primer-19.png" alt="19" /></a></p>

]]></description>
<guid isPermaLink="false">suckless-presentations.html</guid>
<pubDate>Mon, 09 Jun 2025 00:00:00 +0000</pubDate>
</item>
<item>
<title>Web proxy with OpenBSD and relayd</title>
<link>https://blog.vdouillet.fr/web-proxy-with-relayd.html</link>
<description><![CDATA[
<h1>Web proxy with OpenBSD and relayd</h1>

<p>March 24, 2025</p>

<h2>But why?</h2>

<p>Recently I needed to setup  a proxy for three websites. The proxy and the sites are distributed among two servers. One of the servers hosts the proxy itself as well as two of the sites. The other server hosts the remaining site. The two machines are connected through the internet so the forwarded traffic to the remote server needs to be encrypted. A picture is worth a thousand words as they say:</p>

<p><a href="https://blog.vdouillet.fr/static/20250324-network-diagram.png"><img src="https://blog.vdouillet.fr/static/20250324-network-diagram.png" alt="Network diagram" /></a></p>

<p>Both servers are running OpenBSD, so we're going to rely on <a href="https://man.openbsd.org/relayd.8"><code>relayd(8)</code></a> as the proxy and <a href="https://man.openbsd.org/httpd.8"><code>httpd(8)</code></a> as the web server.</p>

<h2>relayd setup</h2>

<p>In the <code>relayd(8)</code> configuration file <code>/etc/relayd.conf</code> we must first define two tables, one for the local server running <code>relayd(8)</code> and another for the remote server <code>server2.com</code>:</p>

<pre><code>table &lt;local&gt; { 127.0.0.1 }
table &lt;remote&gt; { server2.com }
</code></pre>

<p>Then we have to define a <code>www</code> protocol to setup the proxy behavior for regular HTTP connections. It will forward the request to the right server based on the <code>Host</code> header. We also add special headers to the forwarded request so that the services running behind the proxy can use the information provided with these headers to adjust their behavior, should they need to. Finally, a request that doesn't match any of the expected hostnames is simply blocked.</p>

<pre><code>http protocol www {
        match request header append "X-Forwarded-For" value "$REMOTE_ADDR"
        match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"

        pass request quick header "Host" value "site3.com" forward to &lt;remote&gt;
        pass request quick forward to &lt;local&gt;

        block
}
</code></pre>

<p>We also define a <code>wwwtls</code> protocol that is configured almost the same, it just has the certificates for each host we are proxying.</p>

<pre><code>http protocol wwwtls {
        tls keypair site1.com
        tls keypair site2.com
        tls keypair site3.com
        match request header append "X-Forwarded-For" value "$REMOTE_ADDR"
        match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"

        pass request quick header "Host" value "site3.com" forward to &lt;remote&gt;
        pass request quick forward to &lt;local&gt;

        block
}
</code></pre>

<p>The line <code>tls keypair site1.com</code> means that <code>relayd(8)</code> will look for a certificate file named <code>/etc/ssl/site1.com.crt</code> and a private key named <code>/etc/ssl/private/site1.com.key</code>. If your certificates are signed through a chain (like the ones provided by Let's Encrypt), the <code>.crt</code> file needs to contain the intermediate certificates, not just your final one. I use <a href="https://man.openbsd.org/acme-client.1"><code>acme-client(1)</code></a> to manage my certificates, which does not write the intermediate certificates with the default configuration. Thus we need to set this up in <code>/etc/acme-client.conf</code>:</p>

<pre><code>domain site1.com {
    domain key "/etc/ssl/private/site1.com.key"
    domain full chain certificate "/etc/ssl/site1.com.crt"
    sign with letsencrypt
}
</code></pre>

<p>After editing the file, you should of course run <code>acme-client</code> to update the certificates. Next come the relays. They define  which protocol to use for a request as well as where it can be forwarded. There's one for <code>http</code> and another for <code>https</code>. Nothing special here except that you may have noticed the ports for the local web server are set to 8080 and 4443. That's because  <code>relayd(8)</code> is already listening on ports 80 and 443 on the proxy.</p>

<pre><code>relay www {
        listen on egress port 80
        protocol www
        forward to &lt;local&gt; port 8080
        forward to &lt;remote&gt; port 80
}

relay wwwtls {
        listen on egress port 443 tls
        protocol wwwtls
        forward with tls to &lt;local&gt; port 4443
        forward with tls to &lt;remote&gt; port 443
}
</code></pre>

<p>Ideally, we would not need to use TLS for the local forwarding. But somehow <code>relayd(8)</code> would not work with TLS enabled only on the remote forward rule. I don't know whether it's a configuration mistake on my end or whether it's a <code>relayd(8)</code> quirk. If you know more about this, I'd be glad to hear about it.</p>

<p>Finally, at the very top of the file, we can ask <code>relayd(8)</code> to log all connections.</p>

<pre><code>log connection
</code></pre>

<h2>httpd setup</h2>

<p>There's not much to do on the <code>httpd(8)</code> side of things, except setting the ports to 8080 and 4443 on the local server, and also setting the log style to <code>forwarded</code>. This allows the IP address of the client which made the request to be logged instead of just the proxy. Please note that this information is read from the <code>X-Forwarded-For</code> and <code>X-Forwarded-Port</code> request headers, so the proxy has to set those on the forwarded request. We set this up in the previous section. An example site could be configured as such in <code>/etc/httpd.conf</code>:</p>

<pre><code>server "site1.com" {
    listen on * port 8080
    listen on * port 4443
    log style forwarded
    tls {
        certificate "/etc/ssl/site1.com.crt"
        key "/etc/ssl/private/site1.com.key"
    }
    root "/htdocs/site1"
}
</code></pre>

<p>If any of the services you're proxying requires its configuration to be updated, please make sure to do so.</p>

<h2>Why not a VPN to secure traffic over the internet?</h2>

<p>I don't know how to setup a VPN. It could be the topic of a future article, but I don't know that it would provide many benefits? If you can think of any, please get in touch!</p>

]]></description>
<guid isPermaLink="false">web-proxy-with-relayd.html</guid>
<pubDate>Mon, 24 Mar 2025 00:00:00 +0000</pubDate>
</item>
<item>
<title>The Algorithm</title>
<link>https://blog.vdouillet.fr/the-algorithm.html</link>
<description><![CDATA[
<h1>The Algorithm</h1>

<p>June 4, 2024</p>

<p>I decided to listen to music this evening. I had a particular song in mind while turning it on, though I ended up choosing to listen to some other album.</p>

<p>When the app reached the end of the album, it kept going by selecting "similar" songs. And the one I wanted to listen to was in there, chosen by the algorithm.</p>

<p>Did the algorithm successfully learn to suggest songs I like? Or did it suggest this song several times already during previous evenings, such that I wanted to listen to it?</p>

]]></description>
<guid isPermaLink="false">the-algorithm.html</guid>
<pubDate>Tue, 04 Jun 2024 00:00:00 +0000</pubDate>
</item>
<item>
<title>Blog updates</title>
<link>https://blog.vdouillet.fr/blog-updates.html</link>
<description><![CDATA[
<h1>Blog updates</h1>

<p>October 10, 2023</p>

<p>The blog has not seen many new articles lately, but there is new stuff under the hood nonetheless! </p>

<p>I’ve not written a new article in a while, because life happens and I didn’t feel like any topic warranted a full post of its own. That does not mean the blog is dead though, and I’ve been improving the generation process of the blog, switching to a Perl script. This change has made it a lot more readable than the old Makefile-based script. It also allows to easily extend the generation process with new features, even though the primary objective is still simplicity above all else. For now, I’ve added an <a href="https://blog.vdouillet.fr/rss.xml">RSS feed</a> of the articles, in case anyone is still interested in those in 2023. This improvement was a while back though, more than a year ago according to git.</p>

<p>Now today I made another improvement to the blog and also my git web interface, as they can both now be browsed with HTTPS encryption. Honestly it took me way too long to make this possible, especially as I knew how to do it already. But anyway it’s done now, although unlike most websites, the regular version does not automatically redirect to the HTTPS one. You are still allowed to browse the regular version of this blog with an outdated browser that may not do HTTPS or may be too old for newer certificates, protocols or whatever :)</p>

<p>As it turns out, I’m also working on a new coding project, but it’s a little too early to push it on my public git. Hopefully I get it very soon in a publishable state. Until then, take care and I’ll write more to you soon(ish)!</p>

]]></description>
<guid isPermaLink="false">blog-updates.html</guid>
<pubDate>Mon, 02 Oct 2023 00:00:00 +0000</pubDate>
</item>
<item>
<title>Using Adrenalin 25.5.1 driver with AMD Radeon RX 6700</title>
<link>https://blog.vdouillet.fr/adrenalin-25.5.1-rx-6700.html</link>
<description><![CDATA[
<h1>Using Adrenalin 25.5.1 driver with AMD Radeon RX 6700</h1>

<p>August 29, 2022</p>

<p>As of today, the Radeon RX 6700 is the latest card from the RX 6000 series released by AMD. As such, it is supported by driver version Adrenalin 22.6.1 and later. Unfortunately, this driver version is also the one AMD chose to deploy a big overhaul of their OpenGL and DirectX 11 driver. This overhaul brings great performance improvements in most applications relying on OpenGL or DirectX11, but sadly, it also breaks a few others. In case of issues, an easy workaround is to stick to Adrenalin 22.5.1 for the time being. That said, the RX 6700 is left in an odd place because this driver does not support the card. So are all RX 6700 owners screwed? Maybe not.</p>

<h2>Prerequisites</h2>

<p>First of all, if you try to install the 22.5.1 driver with the RX 6700 installed in the machine, the driver will complain that no supported hardware was detected, and it will refuse to install. To follow this guide, Adrenalin 22.5.1 must already be installed on the machine <em>prior</em> to installing the RX 6700. You may install this driver with any supported card in the machine.</p>

<h2>The trick</h2>

<p>The trick is that both the RX 6700 and RX 6700 <em>XT</em> use the Navi 22 GPU. As a result, those cards are very similar and you can use the 6700 XT driver with the non-XT card. The steps are simple (please note that I have translated the name of the buttons, so they may differ slightly). Needless to say, you have to know that you do this at your own risk, it may break or damage something, you've been warned:</p>

<ol>
<li>Install the RX 6700 graphics card in the machine</li>
<li>Open Device Manager (simply search for "device manager" in the start menu)</li>
<li>Under the "Graphics card" category, double click on the RX 6700 graphics card (at this point, it may have a generic name like "Display adapter")</li>
<li>Go to the "Driver" tab then click "Update driver" button</li>
<li>Then choose the second option to search for the driver locally</li>
<li>Click on the button at the bottom of the window, "Choose among a list of available drivers on my computer"</li>
<li>Untick the checkbox "Show compatible hardware"</li>
<li>Select "Advanced Micro Devices, Inc." in the left pane and "AMD Radeon RX 6700 XT" in the right pane. If several versions are available, choose the most recent one while staying before June 2022.</li>
<li>At this point, the screen may flicker a little. Even though Windows won't ask for it, I recommend to reboot the computer.</li>
</ol>

<p>And that's it! I've been using this trick for almost two weeks now, and I've not had a single issue, the RX 6700 works fine with the RX 6700 XT driver :)</p>

]]></description>
<guid isPermaLink="false">adrenalin-25.5.1-rx-6700.html</guid>
<pubDate>Mon, 29 Aug 2022 00:00:00 +0000</pubDate>
</item>
<item>
<title>Which GPU for a 1999 PC?</title>
<link>https://blog.vdouillet.fr/which-gpu-for-a-1999-pc.html</link>
<description><![CDATA[
<h1>Which GPU for a 1999 PC?</h1>

<p>May 16, 2022</p>

<p>The past few months, I've been having fun with an old PC from 1999. The machine is surprisingly capable as long as you cater to light programs and of course it won't browse the web. One of the things it's really good at though, is retro games from that era. One hardware component of particular interest in this regard is the GPU. The machine originally came with a Matrox G400 PCI graphics card. I quickly replaced it with a supposedly much more powerful GeForce2 MX that leverages the AGP port on the motherboard. After a while though, I began to wonder if this GPU is a good match for this machine. So I set out to run some benchmarks with a few GPUs I have on hand, to try to decide which one to use. This post will include 3DMark test results as well as discussions regarding 16bit vs 32bit color mode, driver overhead, and issues I encountered setting up the GPUs.</p>

<h2>Test platform</h2>

<p>For reference, here are the specs of the test platform: </p>

<ul>
<li>Intel Pentium III 550MHz (Katmai)</li>
<li>256Mb PC100 SDRAM</li>
<li>Gigabyte GA-6VXE+ (VIA Apollo)</li>
</ul>

<p>And the tested GPUs:</p>

<ul>
<li>S3 Savage4 Pro: 32Mb SDRAM, 125MHz core, 125MHz memory, driver version 4.12.01.8226</li>
<li>Nvidia GeForce2 MX: 32Mb SDRAM, 175MHz core, 166MHz memory, driver version 28.32 and 43.51</li>
<li>ATi Radeon 7000: 64Mb DDR, 166MHz core, 166MHz memory, driver version 4.13.01.7075</li>
<li>Nvidia GeForce FX5200: 64Mb DDR, 250MHz core, 200MHz memory, driver version 43.51</li>
</ul>

<p>The Savage4 Pro is the oldest of the bunch, having been released in 1999. Then the GeForce2 MX and Radeon 7000 came out in 2001. Finally, the GeForce FX 5200 came out quite a bit later in 2003. All the GPUs were using the AGP interface.</p>

<p>I should also mention that the Savage4 was finicky on this motherboard: I had to disable AGP 2X in the BIOS to prevent it from freezing the desktop on boot. Thus, it runs in AGP 1X mode in all of the benchmarks. </p>

<h2>Software</h2>

<p>I ran the following benchmarks on Windows 98 SE:</p>

<ul>
<li>3DMark 99 Max</li>
<li>3DMark 2000</li>
<li>3DMark 2001 SE</li>
</ul>

<p>I wish I had an actual game or two in this list, but did not include any due to time constraints. Gathering all the data points for this experiment took long enough already.</p>

<h2>Test results</h2>

<p>The benchmarks were run with their default settings.</p>

<p><a href="https://blog.vdouillet.fr/static/20220515-3dmark.png"><img src="https://blog.vdouillet.fr/static/20220515-3dmark.png" alt="3DMark test results" /></a></p>

<p>First of all, the different GPUs show very similar performance levels, except for a few numbers that stand out. Maybe the GPU is not the main bottleneck here. Still, the Savage4 Pro is the best GPU on 3DMark 99 Max. This surprised me as this GPU has only one pixel pipeline, just like the Radeon 7000, while the GeForce GPUs have 2. Maybe the S3 drivers are heavily optimized for the benchmark. When switching to a more recent workload such as 3DMark 2000 though, it loses its advantage and all the GPUs are in the same ballpark here. With 3DMark 2001 SE, the Radeon 7000 and Savage4 Pro suffer much more than the GeForce GPUs. I suspect it may be because these GPUs were not really intended to run such workloads, and the switch to 32bpp most likely does not help either. To check this, we're going to isolate the impact of color depth next.</p>

<h2>Test results: 16bpp vs 32bpp</h2>

<p><a href="https://blog.vdouillet.fr/static/20220515-16bpp-vs-32bpp.png"><img src="https://blog.vdouillet.fr/static/20220515-16bpp-vs-32bpp.png" alt="16bpp vs 32bpp" /></a></p>

<p>The Savage4 Pro suffers when rendering at 32bpp, and especially so at 1024x768: performance is basically halved compared to 16bpp. It was common for GPUs of that era to suffer in this mode. Maybe if it had a 128bit memory bus, it would do better. Surprisingly, under 3DMark 99, it manages the same score at 32bpp than the GeForce2 MX at 16bpp. Speaking of the GeForce2 MX, its performance is slightly reduced at 32bpp, but the other GPUs are not really affected.</p>

<h2>About drivers</h2>

<p>One thing I've heard about when you run a newer GPU than the rest of the system is driver overhead. Newer GPUs are usually intended to be run with newer CPUs, so the drivers for these GPUs might be more taxing on the CPU. If you are in a situation where the CPU is the limiting factor, having more driver overhead can lower performance. Another thing worth considering is that the performance of the same application on the same GPU can vary with driver version. With all this in mind, I decided to test 3 different drivers with the GeForce2 MX:</p>

<ul>
<li>12.41, released in 2001, close to the release of the GPU</li>
<li>28.32, released in 2002, this one is more late GeForce3/early GeForce 4. By then you would typically pair your GPU with a CPU like a 2+GHz Pentium 4</li>
<li>43.51, released in 2003, this one is late GeForce4/early GeForce FX. CPUs at this point were around 3GHz Pentium 4</li>
</ul>

<p>You won't see results for the 12.41 driver in the graph below, because this driver had some issues with 3DMark 99 and 3DMark 2001. It only managed to complete 3DMark 2000 with a score of 3350 points. It's more than double of what I got with driver 28.32, which seems odd. But if the score is real, it may be worth to try to find another driver from that time that is more stable with the GeForce2.</p>

<p><a href="https://blog.vdouillet.fr/static/20220515-gf2-driver.png"><img src="https://blog.vdouillet.fr/static/20220515-gf2-driver.png" alt="GeForce2 MX performance comparison between driver 28.32 and 43.51" /></a></p>

<p>As you can see, there is not much difference between the two drivers, except for 3DMark 2001 which regressed a lot. This might indicate that the driver got more optimized towards newer hardware than the GeForce2. As it only concerns 3DMark 2001, it's difficult to conclude whether the driver overhead increased or not.</p>

<h2>Conclusion</h2>

<p>The GeForce2 MX is a bit disappointing. I know it wasn't a high end GPU when it released but still expected more out of it. Maybe it needs more CPU power to show its strength. The same can be said of the FX 5200. I know it's a low end part as well, but given that it's also much newer, I still expected it to perform better than the GeForce2. I feel like those GPUs require a beefier CPU, like something in the gigahertz range maybe. </p>

<p>The Radeon 7000 is not too shabby but still performs a bit lower than the GeForce2 MX. I also saw some artifacts during 3DMark 2001 SE so I'm not sure about the driver I have used. I did not test any game with it so I can't say whether they would work fine or not. </p>

<p>I was pleasantly surprised by the Savage4 Pro. Of course its performance is reduced at 32bit color depth, but that does not bother me because the games that this GPU can run well don't benefit much from it in my opinion. For now, it is the GPU I am using. It seems to be a good balance between performance and compatibility with the games I want to play, while also fitting well with the rest of the machine. For instance, I can run Wipeout XL just fine with this GPU while it would crash before I got to the menu with the GeForce2. The Savage4 also offers some features that I would like to try at some point, like the Metal API or S3TC texture compression. Maybe you'll hear more about this GPU when I get to do that.</p>

]]></description>
<guid isPermaLink="false">which-gpu-for-a-1999-pc.html</guid>
<pubDate>Mon, 16 May 2022 00:00:00 +0000</pubDate>
</item>
<item>
<title>Remote X11 desktop with x11vnc on OpenBSD</title>
<link>https://blog.vdouillet.fr/remote-desktop-vnc-openbsd.html</link>
<description><![CDATA[
<h1>Remote X11 desktop with x11vnc on OpenBSD</h1>

<p>April 8, 2022</p>

<p>Here are a few quick instructions on how to setup a VNC server on OpenBSD. This can give you remote X11 access to your OpenBSD machine if you can run an SSH client and VNC client.</p>

<p>If you selected the default sets during your OpenBSD install, the X11 server is already installed, if not, you should install it now. We'll just need to install a VNC server through the packages, I've settled on <code>x11vnc</code>:</p>

<pre><code># pkg_add x11vnc
</code></pre>

<p>Setting up <code>x11vnc</code> is pretty simple, you just need to give it command line options when starting the daemon. This is very simple with OpenBSD, just add your options to the <code>/etc/rc.conf.local</code> file. Here is an example configuration:</p>

<pre><code>x11vnc_flags="-listen localhost -rfbauth /etc/x11vnc.passwd -logfile /var/log/x11vnc -ncache 0 -display :0 -forever -loop100 -auth /etc/X11/xenodm/authdir/authfiles/A:0-*"
</code></pre>

<p>I won't explain all the options here, you should read <code>x11vnc(1)</code> and/or the <a href="https://github.com/LibVNC/x11vnc/tree/master/doc/OPTIONS.md">doc</a> for more details. Nonetheless, the first two options are worth explaining. The VNC server is listening on localhost because the VNC protocol is not encrypted by default, so we will tunnel the VNC connection through SSH. Next, we specify a file containing the password to allow connecting. This file can be created with the following command, of course you should not use <code>verysecurepassword</code>:</p>

<pre><code># x11vnc -storepasswd verysecurepassword /etc/x11vnc.passwd
</code></pre>

<p>According to the man page, this file is not encrypted and just obfuscated with a fixed private key, so you should restrict the permissions on this file. Anyway the server is ready to be started:</p>

<pre><code># rcctl start x11vnc
</code></pre>

<p>You should now be able to connect to the server, after setting up the port forwarding with SSH, as such for example:</p>

<pre><code>$ ssh -L 5900:localhost:5900 myserver
</code></pre>

<p>This basically forwards port 5900 of <code>myserver</code> to port 5900 on <code>localhost</code>. To connect to the VNC server, simply use <code>localhost</code> as the server and port 5900. If issues may arise, read the log and <code>x11vnc(1)</code>. I've been using this setup for a few weeks now and I'm quite happy with it. As a bonus, here is a screenshot of my openbox VNC session:</p>

<p><a href="https://blog.vdouillet.fr/static/20220408-openbox-vnc.png"><img src="https://blog.vdouillet.fr/static/20220408-openbox-vnc.png" alt="openbox session screenshot" /></a></p>

]]></description>
<guid isPermaLink="false">remote-desktop-vnc-openbsd.html</guid>
<pubDate>Fri, 08 Apr 2022 00:00:00 +0000</pubDate>
</item>
<item>
<title>Advent of code 2021</title>
<link>https://blog.vdouillet.fr/advent-of-code-2021.html</link>
<description><![CDATA[
<h1>Advent of code 2021</h1>

<p>January 5th, 2022</p>

<p>This year, or rather last year, I decided to participate in the Advent of code. This post will explain why and how I decided to do it, but also reflect on my progress since it's well over now.</p>

<p>One of the great things about the <a href="https://adventofcode.com">Advent of code</a> is that you can participate with whatever language you choose. So instead of coding in a language I'm comfortable with, I decided to go with C, for the following reasons:</p>

<ul>
<li>it's been 10+ years since I last programmed in C, and I wanted to dive back into it</li>
<li>maybe I can learn some "modern" C features as I will be targeting C11</li>
<li>I wanted to develop on OpenBSD and all the tools required for C development are included in the base OpenBSD install</li>
<li>it's a good way to improve my skills with a terminal-based development environment: tmux, vim, make, gdb...</li>
<li>C is very portable and it's always good fun to <a href="https://twitter.com/vdouillet12/status/1468343484717404169">compile and run on Visual C++ 6.0</a> under Windows 98 with a <a href="https://www.cpu-world.com/CPUs/Pentium-III/Intel-Pentium%20III%20550%20-%2080525PY550512%20(BX80525U550512).html">22 year old CPU</a></li>
</ul>

<p>In the end, I mainly kept pace until day 8, at which point the puzzles started to take a little too much time (that I spent hunting some christmas presents...). You can find my code on my <a href="http://git.vdouillet.fr/adventofcode2021/">git repo</a>. Though at that point I had (re)learnt a good deal about C, and was getting more comfortable at developing and debugging in text mode only. The code is not perfect and there are still some TODOs and shortcuts, especially regarding memory management. But the main point was to get the right result at the end.</p>

<p>As of today I'm still working on day 9 and maybe will continue to progress in the following weeks.</p>

]]></description>
<guid isPermaLink="false">advent-of-code-2021.html</guid>
<pubDate>Wed, 05 Jan 2022 00:00:00 +0000</pubDate>
</item>
<item>
<title>On the status of lightweight GUI mail clients</title>
<link>https://blog.vdouillet.fr/lightweight-mail-client.html</link>
<description><![CDATA[
<h1>On the status of lightweight GUI mail clients</h1>

<p>November 3rd, 2021</p>

<p>I'll give you a bit of context first. Lately I've become frustrated with Xubuntu on my laptop. Long story short, having to update every 6 month and the general direction the OS is taking bothered me (flatpack by default... wait what?). Add to that the fact that every update broke something, so in the end I just reinstalled from scratch every 6 month.</p>

<p>Considering this, a few weeks ago I decided to ditch Ubuntu and go back to Debian. I say "back to Debian" because I actually used it as my main laptop OS a few years back. Although at the time I was using the stable flavor, this time I decided to install the testing flavor to avoid those dreaded updates. As usual I wanted to keep things small and simple, so I went with LXQt as my desktop environment. The project's <a href="https://lxqt-project.org/about/">about page</a> states: </p>

<blockquote>
  <p>It will not hang or slow down your system</p>
</blockquote>

<p>I can confirm it is very light. I don't know if it's Debian or LXQt making magic, or maybe both, but programs open up <em>instantly</em>, even on my 7 year old laptop. It's a refreshing experience.</p>

<p>By default, the mail client bundled with LXQt, at least on Debian, is Mozilla Thunderbird. It's a great client, but not exactly light and it also does not integrate well with my Qt theme. I could install KMail, but it will likely pull half of KDE along. So I went online in search of a light Qt-based mail client. I found only one, <a href="http://trojita.flaska.net/">Trojita</a>. Sadly, there's no package for it in Debian. Looking at the project's repository and bug tracker, it seems that development has been slow as of late. According to a <a href="https://bugs.kde.org/show_bug.cgi?id=365299">bug report</a>, it's been recently dropped from Gentoo because it uses an outdated web rendering component (I'll save my opinion on HTML emails for another post).</p>

<p>Even when considering GTK mail clients, there's only a handful of options to choose from. If you push aside those which are still based on GTK2, there is only one remaining: <a href="https://wiki.gnome.org/Apps/Geary">Geary</a>. I've used it in the past, it's quite light and gets to the point, but it won't do better than Thunderbird in my Qt-based environment.</p>

<p>In the end I'm a bit short on options. It is sad that you can't easily install a Qt lightweight GUI mail client nowadays. Of course I could contribute to one of the previously mentioned projects and update it. Or I may explore CLI-based solutions. Or continue to use the webmail that comes with my provider. I haven't decided yet.</p>

]]></description>
<guid isPermaLink="false">lightweight-mail-client.html</guid>
<pubDate>Wed, 03 Nov 2021 00:00:00 +0000</pubDate>
</item>
<item>
<title>Browsing gems</title>
<link>https://blog.vdouillet.fr/browsing-gems.html</link>
<description><![CDATA[
<h1>Browsing gems</h1>

<p>October 11, 2021</p>

<p>Lately, I've been browsing small articles that I decided to call "gems" for the purpose of this article's title. And in my opinion they are actually gems. It all stems from my recent discovery of Gemini, which is a new internet protocol.</p>

<p>According to the project page, it "is heavier than gopher, lighter than the web, will not replace either". Basically it's like a text-based web experience. It's mostly static and clutter-free, a gemini document looks like a traditional web page after you've activated the "reading mode" of your browser, except with <a href="https://gemini.circumlunar.space/">Gemini</a> it's <em>native</em>. Sounds good doesn't it? Among other things I love about geminispace are the absence of ads, or annoying cookie banners, or auto-play videos, or pages that make your laptop scream while loading... I could keep listing things I don't like about the modern web, but I'm sure you've got the gist of it.</p>

<p>By now you may be thinking "sounds good, how do I hop on?". All you need is a Gemini browser really. I use <a href="https://gmi.skyjake.fi/lagrange/">Lagrange</a> on my computer and <a href="https://github.com/pitr/gemini-ios">Elaho</a> on my phone. The <a href="https://gemini.circumlunar.space/software/">Gemini software</a> page lists some clients you can choose from. What I found on Gemini (those links require a Gemini browser):</p>

<ul>
<li>I found <a href="gemini://7irb.tk/dongyo/index.gmi">Korean children songs</a> translated to English and explained</li>
<li>I found that <a href="gemini://simplynews.metalune.xyz">SimplyNews</a> allows to read the news without being suggested a thousand more articles</li>
<li>I found a <a href="gemini://vault.transjovian.org">Wikipedia proxy</a></li>
<li>I found a good amount of <a href="gemini://gmi.noulin.net/cooking">cooking recipes</a></li>
<li>I generally found people talking about things that interested me, or sparked new thoughts</li>
</ul>

<p>If you've got a bit of time on your hands, I highly recommend wandering a bit in geminispace. Within a few hours you'll most likely have found some capsules (what would be sites in traditional HTTP realm) discussing topics of particular interest to you. You can start with these resources which I found great to discover content:</p>

<ul>
<li><a href="gemini://geddit.glv.one">Geddit</a> is a kind of Reddit clone</li>
<li><a href="gemini://geminispace.info/search">geminispace.info</a> is a search engine</li>
</ul>

<p>You may have also noticed a new blog layout here, which is honestly inspired by the way gemini documents are rendered in the two previously mentioned browsers. I was having issues with Pelican, which I used previously, so I decided to develop my own static generator. It's all achieved with a Makefile that you can find on my git page. As it is, it's quite bare and I may improve it a bit in the future... Who knows, maybe I'll add some Gemini capsule magic to it ;)</p>

]]></description>
<guid isPermaLink="false">browsing-gems.html</guid>
<pubDate>Mon, 11 Oct 2021 00:00:00 +0000</pubDate>
</item>
<item>
<title>Raspberry Pi white noise machine</title>
<link>https://blog.vdouillet.fr/raspberry-pi-white-noise-machine.html</link>
<description><![CDATA[
<h1>Raspberry Pi white noise machine</h1>

<p>September 19, 2021, modified on November 11, 2022</p>

<p>A white noise machine can help find sleep or mask ambient noise or even tinnitus. It can also be used to muffle conversation from potential eavesdroppers. I wanted to experiment with a white noise machine for sleep purposes so I decided to build one with a Raspberry Pi I had lying around.</p>

<p>For this you will need:</p>

<ul>
<li>A Raspberry Pi equipped with a jack port and an OS installed (I used a Pi 3B with Raspbian OS)</li>
<li>Speakers connected to the Pi</li>
</ul>

<p>Actually a Pi 3 is a bit overkill for this. I have a Pi Zero lying around that could fit the bill except it needs a USB dongle to connect speakers and I don't have such a dongle.</p>

<h2>Preparing the white noise</h2>

<p>First you need to find a white noise sample, preferably a long one. I chose to extract the sound from a 3 hour long YouTube video of a waterfall. Of course, choose what suits you. If you want to extract the sound from a YouTube video, you could use one of the many online tools but I won't recommend that to you. Instead, you can use <a href="https://github.com/ytdl-org/youtube-dl">youtube-dl</a>:</p>

<pre><code>$ youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=dQw4w9WgXcQ
</code></pre>

<p>Some explanations for the options used:</p>

<ul>
<li><code>-x</code> asks youtube-dl to extract the audio from the video. As stated in youtube-dl's help, ffmpeg or avconv is required for this</li>
<li><code>--audio-format</code> should be self-explanatory</li>
</ul>

<h2>Creating a white noise service</h2>

<p>Next we are going to create a service to play the white noise automatically at system startup. My Raspberry Pi is running raspbian so systemd is used to manage services. Create a <code>/etc/systemd/system/whitenoise.service</code> file with the following contents:</p>

<pre><code>[Unit]
Description=White noise machine
StartLimitIntervalSec=0

[Service]
Type=simple
User=pi
ExecStart=mpg123 --loop -1 /home/pi/whitenoise.mp3

[Install]
WantedBy=multi-user.target
</code></pre>

<p>You should adjust your username and path to the file. I used <a href="https://mpg123.org/">mpg123</a> because it's the simplest and lightest audio player I could find. Its loop option is handy to keep playing infinitely. It needs to be installed:</p>

<pre><code># apt install mpg123
</code></pre>

<h2>Auto start, auto stop</h2>

<p>To start automatically the service on system startup, you just need to enable the service on startup:</p>

<pre><code># systemctl enable whitenoise
</code></pre>

<p>To stop it, you can use a cron job set at the time you want it to stop:</p>

<pre><code>55 6 * * * sudo systemctl stop whitenoise
</code></pre>

<p>This will stop the white noise at 6:55am. And that's it! Enjoy your homemade white noise machine!</p>

]]></description>
<guid isPermaLink="false">raspberry-pi-white-noise-machine.html</guid>
<pubDate>Sun, 19 Sep 2021 00:00:00 +0000</pubDate>
</item>
<item>
<title>Simple git server on OpenBSD</title>
<link>https://blog.vdouillet.fr/openbsd-simple-git-server.html</link>
<description><![CDATA[
<h1>Simple git server on OpenBSD</h1>

<p>September 11, 2021</p>

<p>Nowadays solutions like Github or Gitlab are popular to host online git repositories. I think that these tools can be quite bloated with features that I likely won't need for my small projects. So I decided to setup a self-hosted simple git server on OpenBSD. Here is how I configured it.</p>

<h2>Creating the repository</h2>

<p>Of course, you first need to install git. I personally chose to install the package:</p>

<pre><code># pkg_add git
</code></pre>

<p>Next you need to add a git user, which will be used to push code to the repositories:</p>

<pre><code># adduser
Enter username []:        git
Enter full name []: git
Enter shell csh git-shell ksh nologin sh [ksh]: 
Uid [1001]: 
Login group git [git]: 
Invite git into other groups: guest no [no]: 
Login class authpf bgpd daemon default pbuild staff unbound xenodm [default]: 
Enter password []: xxx
Enter password again []: xxx
</code></pre>

<p>Now you can import the public keys of the developers, by adding them to the file <code>/home/git/.ssh/authorized_keys</code> (one key per line). This process can be simplified with the command <code>ssh-copy-id</code> that is available on Linux systems.</p>

<p>Initialise a repository, in folder <code>/var/www/git-repos</code>:</p>

<pre><code># mkdir -p /var/www/git-repos/pelican-minimal.git
# chown -R git:www /var/www/git-repos
$ cd /var/www/git-repos/pelican-minimal.git/
$ git init --bare
</code></pre>

<p>The folder choice can seem strange but it will allow us to easily publish the repository through a website a bit later. If you want developers to be able to push code with a URL like <code>git@git.vdouillet.fr/git/pelican-minimal</code>, a link does the job:</p>

<pre><code># ln -s /var/www/git-repos /git
</code></pre>

<p>The repository is ready, developers can push code like so:</p>

<pre><code>$ git remote add origin git@git.vdouillet.fr:/git/pelican-minimal
$ git push origin master
</code></pre>

<p>Though security is not optimal: developers can open a shell on the server with the git account by using their SSH key. To prevent this, we are going to change the shell of the git account to the <code>git-shell</code>. This shell refuses interactive connections:</p>

<pre><code># chpass -s git-shell git
</code></pre>

<p>It’s better, but developers can still use port forwarding. This can be disabled by prefixing each key in the <code>authorized_keys</code> file you edited earlier with the following text:</p>

<pre><code>no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
</code></pre>

<h2>Public access</h2>

<p>To make the repository publicly available, I’ve chosen to use <a href="https://git.zx2c4.com/cgit/">cgit</a>. It’s a CGI script for a web interface that also allows to clone the repository through HTTP. Let’s first install cgit:</p>

<pre><code># pkg_add cgit
</code></pre>

<p>As noted by the README after installation, you need to create a configuration file <code>/var/www/conf/cgitrc</code> for cgit. See cgitrc(5) for the complete list of parameters, here is a basic file that exposes only one repository:</p>

<pre><code>repo.url=pelican-minimal
repo.path=/git-repos/pelican-minimal
repo.clone-url=http://git.vdouillet.fr/pelican-minimal
repo.desc=minimal pelican theme
</code></pre>

<p>The httpd web server still needs to be configured, the sample configuration from cgit’s README works just fine, so I copied it into <code>/etc/httpd.conf</code>:</p>

<pre><code>server "git.vdouillet.fr" {
    listen on egress port 80

    # don't serve static files from cgit CGI: cgit.css and cgit.png
    location "/cgit.*" {
        root "/cgit"
        no fastcgi
    }
    root "/cgi-bin/cgit.cgi"
    fastcgi socket "/run/slowcgi.sock"
}
</code></pre>

<p>Finally, launch the two required daemons httpd and slowcgi:</p>

<pre><code># rcctl enable slowcgi
# rcctl start slowcgi
# rcctl enable httpd
# rcctl start httpd
</code></pre>

<p>The repository is now available via <a href="https://blog.vdouillet.fr//git.vdouillet.fr">git.vdouillet.fr</a>.</p>

<p>Constructive feedback is welcome on <a href="https://twitter.com/vdouillet12/status/1443303913017516037?s=20">Twitter</a>.</p>

<h2>Sources</h2>

<ul>
<li><a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server">Git online book</a></li>
<li>cgitrc(5)</li>
<li>OpenBSD cgit package README</li>
</ul>

]]></description>
<guid isPermaLink="false">openbsd-simple-git-server.html</guid>
<pubDate>Sat, 11 Sep 2021 00:00:00 +0000</pubDate>
</item>
</channel>
</rss>
