URI:
       rss_content_gopher.xml - www.codemadness.org - www.codemadness.org saait content files
  HTML git clone git://git.codemadness.org/www.codemadness.org
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       rss_content_gopher.xml (176716B)
       ---
            1 <?xml version="1.0" encoding="UTF-8"?>
            2 <rss version="2.0"
            3   xmlns:content="http://purl.org/rss/1.0/modules/content/"
            4   xmlns:dc="http://purl.org/dc/elements/1.1/">
            5 <channel>
            6         <title>Codemadness</title>
            7         <description>blog with various projects and articles about computer-related things</description>
            8         <link>gopher://codemadness.org</link>
            9 <item>
           10         <title>Wireguard on OpenBSD for use as a mobile VPN</title>
           11         <link>gopher://codemadness.org/1/phlog/wireguard</link>
           12         <guid>gopher://codemadness.org/1/phlog/wireguard</guid>
           13         <dc:date>2026-03-27T00:00:00Z</dc:date>
           14         <author>Hiltjo</author>
           15         <description><![CDATA[<h1>Wireguard on OpenBSD for use as a mobile VPN</h1>
           16         <p><strong>Last modification on </strong> <time>2026-03-29</time></p>
           17         <p>Wireguard is a fast, modern and secure VPN tunnel.</p>
           18 <p>Below is a guide to setup <a href="https://www.wireguard.com/">Wireguard</a> on the OpenBSD
           19 operating system intended for use as a mobile VPN.</p>
           20 <p>It describes using the OpenBSD Wireguard wg(4) kernel driver using ifconfig,
           21 not the userland application, and will focus on setting up a IPv4 tunnel.</p>
           22 <p>It is however recommended to install wireguard-tools, because it contains
           23 useful tools to generate a private and public key (wg genkey, wg pubkey).</p>
           24 <p>To install the wireguard-tools package on OpenBSD:</p>
           25 <pre><code># pkg_add wireguard-tools
           26 </code></pre>
           27 <h2>Enable IPv4 traffic forwarding</h2>
           28 <p>To enable traffic forwarding for IPv4 run:</p>
           29 <pre><code># sysctl net.inet.ip.forwarding=1
           30 </code></pre>
           31 <p>To make it persistent add the above lines to the file /etc/sysctl.conf.  These
           32 sysctl lines are loaded on boot time.</p>
           33 <h2>Server config: /etc/hostname.wg0</h2>
           34 <p>This is an example config for the wg0 network interface.  It is stored at
           35 /etc/hostname.wg0:</p>
           36 <pre><code>wgport 51820 wgkey 'private_key_here'
           37 inet 10.1.2.1/24
           38 up
           39 
           40 # peer: phone
           41 wgpeer 'pubkey' wgaip 10.1.2.2/32 wgdescr 'phone' wgpsk 'psk_here'
           42 </code></pre>
           43 <h2>Generating a private key</h2>
           44 <p>Using wireguard-tools wg command:</p>
           45 <pre><code>$ wg genkey
           46 </code></pre>
           47 <p>Replace private_key_here with the generated text.</p>
           48 <p>To generate both a private and public key to the files private.key and
           49 public.key:</p>
           50 <pre><code>$ wg genkey | tee private.key | wg pubkey &gt; public.key
           51 </code></pre>
           52 <p><strong>!!! Keep the private key secure. Do not share it with anyone!!!</strong></p>
           53 <h2>Generate a separate preshared key (PSK).</h2>
           54 <p>Using a preshared key (PSK) is optional, but recommended. This is used in the
           55 handshake to guard against future compromise of the peers' encrypted tunnel if
           56 a quantum-computational attack on their Diffie-Hellman exchange becomes
           57 feasible.</p>
           58 <p>Using wireguard-tools wg command:</p>
           59 <pre><code>$ wg genpsk
           60 </code></pre>
           61 <p>The PSK can be shared with a known client when configuring the clients. <strong>Make sure
           62 to share it via a safe channel</strong>.</p>
           63 <p>To configure or restart the wg0 interface using the configuration in
           64 /etc/hostname.wg0:</p>
           65 <pre><code># sh /etc/netstart wg0
           66 </code></pre>
           67 <p>To show general info of the interface run the command (requires root
           68 permissions to view all information):</p>
           69 <pre><code># ifconfig wg0
           70 </code></pre>
           71 <p>In the ifconfig wg0 output it should list the server public key as:</p>
           72 <pre><code>wgpubkey server_pubkey_here
           73 </code></pre>
           74 <h2>Full example of a client config: wg-client.conf</h2>
           75 <pre><code>[Interface]
           76 Address = 10.1.2.2/32
           77 DNS = 10.1.2.1
           78 PrivateKey = CHBzstIHCi7+YOOa2MN0RXhkPAmJwIXQW0e6/n6+Pno=
           79 
           80 [Peer]
           81 AllowedIPs = 0.0.0.0/0
           82 Endpoint = example.org:51820
           83 PreSharedKey = 8ao/EMExyPAHrT3ShX+lnA0u7jUmo7MhrT0GjDcrIJA=
           84 PublicKey = Rny+AW4EPqPPxfO+8O+QdlkIrWbZRGQ6u6Fje5pUOFM=
           85 </code></pre>
           86 <p><strong>Of course do not copy-paste this private key and PSK. Generate your own ;)</strong></p>
           87 <h2>pf(4) firewall rules</h2>
           88 <p>Below is a fragment of the firewall rules required for Wireguard.
           89 These rules assume a simple VPS with a vio network interface connected to the
           90 interwebs (no double NAT or other weird complex things ;)).</p>
           91 <p>pf.conf:</p>
           92 <pre><code># wireguard
           93 pass out quick on egress inet from (wg0:network) nat-to (vio0:0)
           94 pass in quick on wg0 from any to any
           95 pass in quick on wg0 proto udp from any to any port 51820
           96 # allow all on wireguard
           97 pass quick on wg0
           98 </code></pre>
           99 <h2>Mobile VPN application</h2>
          100 <p>For Android download the APK from <a href="https://www.wireguard.com/install/">https://www.wireguard.com/install/</a>.
          101 There are also other versions available on the page.</p>
          102 <h2>Android Wireguard settings</h2>
          103 <h2>Adding a tunnel</h2>
          104 <p>In the Wireguard application press the plus (+) button in the bottom left of
          105 the screen to add a tunnel.</p>
          106 <h2>Option: "Scan from QR code"</h2>
          107 <h3>Generate a QR code image from a client config</h3>
          108 <p>Install the libqrencode package for the qrencode program:</p>
          109 <pre><code># pkg_add libqrencode
          110 </code></pre>
          111 <p>Generate a QR code PNG image from a client config:</p>
          112 <pre><code>$ qrencode -o qr.png &lt; wg-client.conf
          113 </code></pre>
          114 <p>This QR code simply contains the full text from the wg-client.conf. It can be
          115 scanned from the Android Wireguard application.  If it contains sensitive
          116 information such as the private key make sure to share the image in a safe way
          117 and/or destroy it immediately.</p>
          118 <p><img src="downloads/openbsd-wg/client-example-qr.png" alt="QR code image" /></p>
          119 <p>If the QR code contains a private key, make sure to destroy it "Inspector Gadget"-style.</p>
          120 <p><img src="downloads/openbsd-wg/inspector_gadget.jpg" alt="inspector Gadget reading self-destruct message" width="320" height="240" loading="lazy" /></p>
          121 <p><a href="downloads/openbsd-wg/inspector_gadget.webm">Inspector Gadget, self-destruct video clip</a></p>
          122 <p>Now scan the generated image to import the config.</p>
          123 <h3>Option: "Import from file or archive"</h3>
          124 <p>Import a text .conf file or archive (ZIP) file containing one or more configs.</p>
          125 <p>Example conf file: <a href="downloads/openbsd-wg/client-example.conf">client-example.conf</a>.<br />  
          126 Example ZIP file: <a href="downloads/openbsd-wg/client-example.zip">client-example.zip</a>.</p>
          127 <h3>Option: "Create from scratch"</h3>
          128 <p>Generating the private key on the device itself and sharing the <strong>public</strong> key
          129 and PSK is probably the safest option.  Although sharing the public key text
          130 from a mobile device can be a bit annoying.</p>
          131 <h2>Android settings</h2>
          132 <p>Only allow connections and DNS using VPN:</p>
          133 <ul>
          134 <li>Settings -&gt; VPN -&gt; Network &amp; Internet:
          135 Make sure Wireguard is set and enabled under VPN.</li>
          136 </ul>
          137 <p>VPN settings, open Wireguard cogwheel:
          138 <ul>
          139 <li>Enable: Always on VPN option, with the description: "Stay connected to VPN at all times".</li>
          140 <li>Enable: Block connections without VPN.</li>
          141 </ul>
          142 </p>
          143 <p>Other recommendations:</p>
          144 <ul>
          145 <li>Under Wi-Fi -&gt; Privacy.
          146 <ul>
          147 <li>Use randomized MAC.</li>
          148 <li>Disable "Send device name".</li>
          149 </ul>
          150 </li>
          151 <li>Set a secure and privacy-respecting DNS server.</li>
          152 </ul>
          153 <h2>Wireguard persistent keepalive setting</h2>
          154 <p>If the interface very rarely sends traffic, but it might at anytime receive
          155 traffic from a peer, and it is behind NAT, the interface might benefit from
          156 having a persistent keepalive interval of 25 seconds.</p>
          157 <p>If it is not needed, then it is recommended to not enable it, which is the
          158 default.</p>
          159 <p>This option is called PersistentKeepalive in Wireguard conf and is called
          160 wgpka for OpenBSD ifconfig, see the ifconfig(8) man page WIREGUARD section.</p>
          161 <h2>Debugging tips</h2>
          162 <p>For the Wireguard Android application you can find a textual log:</p>
          163 <ul>
          164 <li>Open the Wireguard application.</li>
          165 <li>At the top right select the 3 dots settings thingy.</li>
          166 <li>Select the menu labeled "View application log".</li>
          167 </ul>
          168 <p>On the OpenBSD server you can run enable run-time debugging on the wg0 interface:</p>
          169 <pre><code># ifconfig wg0 debug
          170 </code></pre>
          171 <h2>Bonus: example using wg-quick from wg-tools</h2>
          172 <p>Using the wg-quick program from wg-tools you can also quickly setup a client.
          173 This will setup the DNS, routing and interface. It can setup and restore the
          174 DNS and routing settings easily.</p>
          175 <p>As root, to setup the interface:</p>
          176 <pre><code># wg-quick up absolute/path/to/config/wg-client.conf
          177 </code></pre>
          178 <p>As root, to restore the interface:</p>
          179 <pre><code># wg-quick down absolute/path/to/config/wg-client.conf
          180 </code></pre>
          181 <h2>Bonus: generating a private key using only OpenSSL commands</h2>
          182 <p>Generate a private key:</p>
          183 <pre><code>$ openssl genpkey -algorithm X25519 -outform DER -out private.der
          184 </code></pre>
          185 <p>Now extract the last 32 bytes which has part of the actual private key (the
          186 first ASN.1 DER encoded bytes contain metadata information). Convert the actual
          187 key data to base64.</p>
          188 <p>Run:</p>
          189 <pre><code>$ tail -c 32 private.der | openssl enc -a -A &gt; private.key
          190 </code></pre>
          191 <p>Derive public key:</p>
          192 <pre><code>$ openssl pkey -inform DER -in private.der -pubout -outform DER -out public.der
          193 </code></pre>
          194 <p>Convert public key to Wireguard format:</p>
          195 <pre><code>$ tail -c 32 public.der | openssl enc -a -A &gt; public.key
          196 </code></pre>
          197 <p>Or even the magical voodoo commands:</p>
          198 <pre><code>$ openssl rand -base64 32 &gt; private.key
          199 $ (printf '\060\056\002\001\000\060\005\006\003\053\145\156\004\042\004\040';openssl enc -d -a -A &lt; private.key) | \
          200   openssl pkey -inform DER -pubout -outform DER | \
          201         tail -c 32 | \
          202         openssl enc -a -A &gt; public.key
          203 </code></pre>
          204 <h2>References</h2>
          205 <ul>
          206 <li><a href="https://www.wireguard.com/">Wireguard</a>:
          207 <ul>
          208 <li><a href="https://www.wireguard.com/quickstart/">Wireguard quickstart page</a>:
          209 This uses the userland Wireguard programs and config. But it contains
          210 helpful information.<br />  </li>
          211 <li><a href="https://www.man7.org/linux/man-pages/man8/wg.8.html">wg(8) man page</a>.</li>
          212 <li><a href="https://www.man7.org/linux/man-pages/man8/wg-quick.8.html">wg-quick(8) man page</a>.</li>
          213 </ul>
          214 </li>
          215 <li><a href="https://www.openbsd.org/">OpenBSD operating system</a>:
          216 <ul>
          217 <li><a href="https://man.openbsd.org/wg">wg(4) driver man page</a>.</li>
          218 <li><a href="https://man.openbsd.org/ifconfig.8#WIREGUARD">ifconfig(8) man page WIREGUARD section</a>.</li>
          219 <li><a href="https://man.openbsd.org/pf.conf.5">pf.conf(5) file format</a>.</li>
          220 </ul>
          221 </li>
          222 </ul>
          223 ]]></description>
          224 </item>
          225 <item>
          226         <title>susmb: unprivileged mounting of SMB/CIFS shares via FUSE</title>
          227         <link>gopher://codemadness.org/1/phlog/susmb</link>
          228         <guid>gopher://codemadness.org/1/phlog/susmb</guid>
          229         <dc:date>2026-03-06T00:00:00Z</dc:date>
          230         <author>Hiltjo</author>
          231         <description><![CDATA[<h1>susmb: unprivileged mounting of SMB/CIFS shares via FUSE</h1>
          232         <p><strong>Last modification on </strong> <time>2026-03-06</time></p>
          233         <p>usmb is a program to mount SMB shares from userland via FUSE.
          234 Under-the-hood it uses Samba and exposes the network share as a regular local filesystem.
          235 Programs can just access the filesystem and for example do not need to add code for SMB support or link against Samba.
          236 It is more convenient than scripting around smbclient in some cases.<br />  
          237 smbclient(1): <a href="https://www.samba.org/samba/docs/current/man-html/smbclient.1.html">https://www.samba.org/samba/docs/current/man-html/smbclient.1.html</a></p>
          238 <p>susmb is a fork of usmb from 2013-02-04.
          239 <a href="http://repo.or.cz/w/usmb.git/snapshot/aa94e132c12faf1a00f547ea4a96b5728612dea6.tar.gz">http://repo.or.cz/w/usmb.git/snapshot/aa94e132c12faf1a00f547ea4a96b5728612dea6.tar.gz</a>
          240 (git commit aa94e132c12faf1a00f547ea4a96b5728612dea6)</p>
          241 <p>usmb has been unmaintained since 2013. Sometimes programs are finished and so
          242 being unmaintained is not so bad. I think the general idea of the code was good
          243 and it is still a useful program for some systems, probably mostly BSD systems.
          244 Linux has a SMB/CIFS driver anyway.</p>
          245 <p>The two main reasons I forked usmb were performance issues with it on OpenBSD
          246 (because of hardcoded options and assumptions for FUSE for Linux) and issues by
          247 using it in non-interactive mode.</p>
          248 <h2>Clone</h2>
          249 <pre><code>git clone git://git.codemadness.org/susmb
          250 </code></pre>
          251 <h2>Browse</h2>
          252 <p>You can browse the source-code at:</p>
          253 <ul>
          254 <li><a href="https://git.codemadness.org/susmb/">https://git.codemadness.org/susmb/</a></li>
          255 <li><a href="gopher://codemadness.org/1/git/susmb">gopher://codemadness.org/1/git/susmb</a></li>
          256 </ul>
          257 <h2>Download releases</h2>
          258 <p>Releases are available at:</p>
          259 <ul>
          260 <li><a href="https://codemadness.org/releases/susmb/">https://codemadness.org/releases/susmb/</a></li>
          261 <li><a href="gopher://codemadness.org/1/releases/susmb">gopher://codemadness.org/1/releases/susmb</a></li>
          262 </ul>
          263 <h2>Build and install</h2>
          264 <pre><code>$ make
          265 # make install
          266 </code></pre>
          267 <h2>Dependencies</h2>
          268 <ul>
          269 <li>C compiler.</li>
          270 <li>libc + BSD extensions (libbsd on Linux).</li>
          271 <li>FUSE 2.6 or later (and probably version &lt;3).</li>
          272 <li>Samba / libsmbclient 4.20+.</li>
          273 </ul>
          274 <h2>Usage example</h2>
          275 <pre><code>susmb \
          276         -u hiltjo \
          277         -f \
          278         -o 'uid=1000,gid=1000,allow_other' \
          279         "smb://domain\someuser@192.168.1.1/Storage" \
          280         /mnt/share
          281 </code></pre>
          282 <h2>Changes</h2>
          283 <p>susmb has the patches applied from OpenBSD ports 7.6:
          284 <a href="https://cvsweb.openbsd.org/ports/sysutils/usmb/patches">https://cvsweb.openbsd.org/ports/sysutils/usmb/patches</a></p>
          285 <p>Below is a summary of the most important changes:</p>
          286 <h2>Performance</h2>
          287 <ul>
          288 <li>Set struct stat st.st_blksiz to a higher number for more efficient buffering
          289 for programs using the standard FILE* stdio interfaces. Huge improvement for
          290 reads and writes.<br />  
          291 On OpenBSD the default block size for FUSE is 512 bytes.
          292 This crippled network performance.<br />  
          293 On OpenBSD there is no FUSE caching layer (at time of writing 2025-09-07), so
          294 each read call had more overhead.</li>
          295 <li>Remove the hardcoded FUSE mount option max_read=N.<br />  
          296 This crippled network performance.</li>
          297 </ul>
          298 <h2>Security</h2>
          299 <ul>
          300 <li>Many code simplifications and deletions (reducing attack surface and makes it
          301 easier to review).</li>
          302 <li>Use unveil(2) syscall to lock down much of the filesystem except the
          303 mountpoint and required FUSE devices.</li>
          304 <li>Optional privilege dropping support: on OpenBSD FUSE would need to run as root:
          305 (sysctl kern.usermount was removed around July 2016, around
          306 commit 65c8a8a0394483b41de8f02c862e65fb529cf538).<br />  
          307 After mounting the filesystem and acquiring access to the FUSE driver
          308 privileges are dropped. This is not perfect, but at least now the Samba smbclient
          309 code runs as a user again.</li>
          310 <li>Reading the password from the terminal in a secure way using readpassphrase(3).</li>
          311 </ul>
          312 <h2>Cleanups</h2>
          313 <ul>
          314 <li>Merge everything into one C file for easier code review.</li>
          315 <li>Remove Samba &lt; 3.3 compatibility layer and code. This is hard to test
          316 nowadays anyway.</li>
          317 <li>Use getopt for option parsing: remove dependencies on glib which was used for
          318 option parsing only.</li>
          319 <li>Remove long option support.</li>
          320 <li>Remove libxml2 dependency and configuration via XML. Configuration is now
          321 done via a simpler syntax as a URI from the command-line. This was also
          322 listed in the man page under the BUGS section as a wanted feature.</li>
          323 <li>Remove autoconf and Debian-specific packaging files. Use a simple Makefile.</li>
          324 <li>Man page rewritten from roff to mandoc.</li>
          325 </ul>
          326 <h2>OpenBSD port added as sysutils/susmb</h2>
          327 <p>An OpenBSD port was added to sysutils/susmb (thanks to Pascal Stumpf!).</p>
          328 <p>Mailinglist thread: <a href="https://marc.info/?l=openbsd-ports&amp;m=177169411929407&amp;w=2">https://marc.info/?l=openbsd-ports&amp;m=177169411929407&amp;w=2</a></p>
          329 ]]></description>
          330 </item>
          331 <item>
          332         <title>Chess puzzle book generator</title>
          333         <link>gopher://codemadness.org/1/phlog/chess-puzzles</link>
          334         <guid>gopher://codemadness.org/1/phlog/chess-puzzles</guid>
          335         <dc:date>2024-02-02T00:00:00Z</dc:date>
          336         <author>Hiltjo</author>
          337         <description><![CDATA[<h1>Chess puzzle book generator</h1>
          338         <p><strong>Last modification on </strong> <time>2026-03-28</time></p>
          339         <p>This was a christmas hack for fun and non-profit.
          340 I wanted to write a chess puzzle book generator.
          341 Inspired by <a href="https://archive.org/details/1001deadlycheckm0000nunn">1001 Deadly Checkmates by John Nunn, ISBN-13: 978-1906454258</a>,
          342 <a href="https://www.stappenmethode.nl/en/">Steps Method workbooks</a> and other puzzle books.</p>
          343 <h1>Example output</h1>
          344 <ul>
          345 <li>English version: <a href="https://codemadness.org/downloads/puzzles/">https://codemadness.org/downloads/puzzles/</a></li>
          346 <li>Dutch version: <a href="https://hiltjo.nl/puzzles/">https://hiltjo.nl/puzzles/</a></li>
          347 </ul>
          348 <p>Terminal version:</p>
          349 <pre><code>curl -s 'https://codemadness.org/downloads/puzzles/index.vt' | less -R
          350 </code></pre>
          351 <p>I may or may not periodially update this page :)</p>
          352 <p>Time flies (since Christmas), here is a valentine edition with <a href="https://lichess.org/practice/intermediate-tactics/attraction/">attraction</a>
          353 puzzles (not only checkmates) using the red "love" theme.
          354 It is optimized for his and her pleasure:</p>
          355 <p><a href="https://codemadness.org/downloads/puzzles-valentine/">https://codemadness.org/downloads/puzzles-valentine/</a></p>
          356 <h2>Clone</h2>
          357 <pre><code>git clone git://git.codemadness.org/chess-puzzles
          358 </code></pre>
          359 <h2>Browse</h2>
          360 <p>You can browse the source-code at:</p>
          361 <ul>
          362 <li><a href="https://git.codemadness.org/chess-puzzles/">https://git.codemadness.org/chess-puzzles/</a></li>
          363 <li><a href="gopher://codemadness.org/1/git/chess-puzzles">gopher://codemadness.org/1/git/chess-puzzles</a></li>
          364 </ul>
          365 <h1>Quick overview of how it works</h1>
          366 <p>The generate.sh shellscript generates the output and files for the puzzles.</p>
          367 <p>The puzzles used are from the lichess.org puzzle database:
          368 <a href="https://database.lichess.org/#puzzles">https://database.lichess.org/#puzzles</a></p>
          369 <p>This database is a big CSV file containing the initial board state in the
          370 Forsyth-Edwards Notation (FEN) format and the moves in Universal Chess
          371 Interface (UCI) format. Each line contains the board state and the initial and
          372 solution moves.</p>
          373 <p>The generated index page is a HTML page, it lists the puzzles.  Each puzzle on
          374 this page is an SVG image. This scalable image format looks good in all
          375 resolutions.</p>
          376 <h1>Open puzzle data</h1>
          377 <p>Lichess is an <a href="https://lichess.org/source">open-source</a> and gratis website to play on-line chess. There are
          378 no paid levels to unlock features.  All the software hosting Lichess is
          379 open-source and anyone can register and play chess on it for free. Most of the
          380 data about the games played is also open.</p>
          381 <p>However, the website depends on your donations or contributions. If you can,
          382 <a href="https://lichess.org/about">please do so</a>.</p>
          383 <h1>generate.sh</h1>
          384 <p>Reads puzzles from the database and shuffle them. Do some rough sorting and
          385 categorization based on difficulty and assign score points.</p>
          386 <p>The random shuffling is done using a hard-coded <a href="https://en.wikipedia.org/wiki/Random_seed">random seed</a>. This means on the
          387 same machine with the same puzzle database it will regenerate the same sequence
          388 of random puzzles in a deterministic manner.</p>
          389 <p>It outputs HTML, with support for CSS dark mode and does not require Javascript.
          390 It includes a plain-text listing of the solutions in PGN notation for the
          391 puzzles.
          392 It also outputs .vt files suitable for the terminal. It uses unicode symbols
          393 for the chess pieces and RGB color sequence for the board theme.</p>
          394 <h1>fen.c</h1>
          395 <p>This is a program written in C to read and parse the board state in FEN format
          396 and read the UCI moves. It can output to various formats.</p>
          397 <p>See the man page for detailed usage information.</p>
          398 <p>fen.c supports the following output formats:</p>
          399 <ul>
          400 <li>ascii - very simple ASCII mode.</li>
          401 <li>describe - describes current pieces positions as text, line by line (useful for blindfold or visualization practise).</li>
          402 <li><a href="https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation">fen</a> - output FEN of the board state (from FEN and optional played moves).</li>
          403 <li><a href="https://en.wikipedia.org/wiki/Portable_Game_Notation">pgn</a> - Portable Game Notation.</li>
          404 <li>speak - mode to output a description of the moves in words.</li>
          405 <li><a href="https://en.wikipedia.org/wiki/SVG">SVG</a> - Scalable Vector Graphics image.</li>
          406 <li>tty - Terminal output with some markup using escape codes.</li>
          407 </ul>
          408 <p>fen.c can also run in <a href="https://en.wikipedia.org/wiki/Common_Gateway_Interface">CGI</a> mode. This can be used on a HTTP server:</p>
          409 <p><img src="https://codemadness.org/onlyfens?fen=6k1/ppq3bp/2n2np1/5p2/2P2P2/4rBN1/PP3K1P/RQ6%20w%20-%20-%200%2023&amp;moves=f2e3&amp;flip=1" alt="Position from game: Rene Letelier Martner - Robert James Fischer, 1960-10-24" /></p>
          410 <ul>
          411 <li><a href="https://codemadness.org/onlyfens">https://codemadness.org/onlyfens</a></li>
          412 <li><a href="https://codemadness.org/onlyfens?fen=6k1/ppq3bp/2n2np1/5p2/2P2P2/4rBN1/PP3K1P/RQ6%20w%20-%20-%200%2023&amp;moves=f2e3&amp;flip=1">https://codemadness.org/onlyfens?fen=6k1/ppq3bp/2n2np1/5p2/2P2P2/4rBN1/PP3K1P/RQ6%20w%20-%20-%200%2023&amp;moves=f2e3&amp;flip=1</a></li>
          413 <li><a href="https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;flip=1&amp;theme=green&amp;output=svg">https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;flip=1&amp;theme=green&amp;output=svg</a></li>
          414 <li><a href="https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=pgn">https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=pgn</a></li>
          415 <li><a href="https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=speak">https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=speak</a></li>
          416 <li><a href="https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=ascii">https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=ascii</a></li>
          417 <li><a href="https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=fen">https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=fen</a></li>
          418 </ul>
          419 <p>Terminal output:</p>
          420 <pre><code>curl -s 'https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=tty'
          421 </code></pre>
          422 <h1>Support for Dutch notated PGN and output</h1>
          423 <p>For pgn and "speak mode" it has an option to output Dutch notated PGN or speech
          424 too.</p>
          425 <p>For example:</p>
          426 <ul>
          427 <li>Queen = Dame (Q -&gt; D), translated: lady.</li>
          428 <li>Rook = Toren (R -&gt; T), translated: tower.</li>
          429 <li>Bishop = Loper (B -&gt; L), translated: walker.</li>
          430 <li>Knight = Paard (N -&gt; P), translated: horse.</li>
          431 </ul>
          432 <h1>Example script to stream games from Lichess</h1>
          433 <p>There is an included example script that can stream Lichess games to the
          434 terminal. It uses the <a href="https://lichess.org/api">Lichess API</a>.  It will display the board using terminal
          435 escape codes. The games are automatically annotated with PGN notation and with
          436 text how a human would say the notation. This can also be piped to a speech
          437 synthesizer like <a href="https://github.com/espeak-ng/espeak-ng/">espeak</a> as audio.</p>
          438 <p>pgn-extract is a useful tool to convert Portable Game Notation (PGN) to
          439 Universal Chess Interface (UCI) moves (or do many other useful chess related
          440 things!).</p>
          441 <h1>Example script to generate an animated gif from PGN</h1>
          442 <p>Theres also an example script included that can generate an animated gif from
          443 PGN using <a href="https://ffmpeg.org/">ffmpeg</a>.</p>
          444 <p>It creates an optimal color palette from the input images and generates an
          445 optimized animated gif. The last move (typically some checkmate) is displayed
          446 slightly longer.</p>
          447 <h1>References and chess related links</h1>
          448 <ul>
          449 <li><p>chess-puzzles source-code:<br />  
          450 <a href="https://www.codemadness.org/git/chess-puzzles/file/README.html">https://www.codemadness.org/git/chess-puzzles/file/README.html</a></p>
          451 </li>
          452 <li><p>Lichess FEN puzzle database:<br />  
          453 <a href="https://database.lichess.org/#puzzles">https://database.lichess.org/#puzzles</a></p>
          454 </li>
          455 <li><p>lichess.org:<br />  
          456 <a href="https://lichess.org/">https://lichess.org/</a></p>
          457 </li>
          458 <li><p>SVG of the individual pieces used in fen.c:<br />  
          459 <a href="https://github.com/lichess-org/lila/tree/master/public/piece/cburnett">https://github.com/lichess-org/lila/tree/master/public/piece/cburnett</a></p>
          460 </li>
          461 <li><p>pgn-extract:<br />  
          462 A great multi-purpose PGN manipulation program with many options:<br />  
          463 <a href="https://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/">https://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/</a></p>
          464 <p>An example to convert PGN games to UCI moves:<br />  
          465 <code>pgn-extract --notags -Wuc</code></p>
          466 </li>
          467 <li><p>Lichess API:<br />  
          468 <a href="https://lichess.org/api">https://lichess.org/api</a></p>
          469 </li>
          470 <li><p>Stockfish:<br />  
          471 Strong open-source chess engine and analysis tool:<br />  
          472 <a href="https://stockfishchess.org/">https://stockfishchess.org/</a></p>
          473 </li>
          474 </ul>
          475 ]]></description>
          476 </item>
          477 <item>
          478         <title>xargs: an example for parallel batch jobs</title>
          479         <link>gopher://codemadness.org/1/phlog/xargs</link>
          480         <guid>gopher://codemadness.org/1/phlog/xargs</guid>
          481         <dc:date>2023-11-22T00:00:00Z</dc:date>
          482         <author>Hiltjo</author>
          483         <description><![CDATA[<h1>xargs: an example for parallel batch jobs</h1>
          484         <p><strong>Last modification on </strong> <time>2023-12-17</time></p>
          485         <p>This describes a simple shellscript programming pattern to process a list of
          486 jobs in parallel. This script example is contained in one file.</p>
          487 <h2>Simple but less optimal example</h2>
          488 <pre><code>#!/bin/sh
          489 maxjobs=4
          490 
          491 # fake program for example purposes.
          492 someprogram() {
          493         echo "Yep yep, I'm totally a real program!"
          494         sleep "$1"
          495 }
          496 
          497 # run(arg1, arg2)
          498 run() {
          499         echo "[$1] $2 started" &gt;&amp;2
          500         someprogram "$1" &gt;/dev/null
          501         status="$?"
          502         echo "[$1] $2 done" &gt;&amp;2
          503         return "$status"
          504 }
          505 
          506 # process the jobs.
          507 j=1
          508 for f in 1 2 3 4 5 6 7 8 9 10; do
          509         run "$f" "something" &amp;
          510 
          511         jm=$((j % maxjobs)) # shell arithmetic: modulo
          512         test "$jm" = "0" &amp;&amp; wait
          513         j=$((j+1))
          514 done
          515 wait
          516 </code></pre>
          517 <h2>Why is this less optimal</h2>
          518 <p>This is less optimal because it waits until all jobs in the same batch are finished
          519 (each batch contain $maxjobs items).</p>
          520 <p>For example with 2 items per batch and 4 total jobs it could be:</p>
          521 <ul>
          522 <li>Job 1 is started.</li>
          523 <li>Job 2 is started.</li>
          524 <li>Job 2 is done.</li>
          525 <li>Job 1 is done.</li>
          526 <li>Wait: wait on process status of all background processes.</li>
          527 <li>Job 3 in new batch is started.</li>
          528 </ul>
          529 <p>This could be optimized to:</p>
          530 <ul>
          531 <li>Job 1 is started.</li>
          532 <li>Job 2 is started.</li>
          533 <li>Job 2 is done.</li>
          534 <li>Job 3 in new batch is started (immediately).</li>
          535 <li>Job 1 is done.</li>
          536 <li>...</li>
          537 </ul>
          538 <p>It also does not handle signals such as SIGINT (^C). However the xargs example
          539 below does:</p>
          540 <h2>Example</h2>
          541 <pre><code>#!/bin/sh
          542 maxjobs=4
          543 
          544 # fake program for example purposes.
          545 someprogram() {
          546         echo "Yep yep, I'm totally a real program!"
          547         sleep "$1"
          548 }
          549 
          550 # run(arg1, arg2)
          551 run() {
          552         echo "[$1] $2 started" &gt;&amp;2
          553         someprogram "$1" &gt;/dev/null
          554         status="$?"
          555         echo "[$1] $2 done" &gt;&amp;2
          556         return "$status"
          557 }
          558 
          559 # child process job.
          560 if test "$CHILD_MODE" = "1"; then
          561         run "$1" "$2"
          562         exit "$?"
          563 fi
          564 
          565 # generate a list of jobs for processing.
          566 list() {
          567         for f in 1 2 3 4 5 6 7 8 9 10; do
          568                 printf '%s\0%s\0' "$f" "something"
          569         done
          570 }
          571 
          572 # process jobs in parallel.
          573 list | CHILD_MODE="1" xargs -r -0 -P "${maxjobs}" -L 2 "$(readlink -f "$0")"
          574 </code></pre>
          575 <h2>Run and timings</h2>
          576 <p>Although the above example is kindof stupid, it already shows the queueing of
          577 jobs is more efficient.</p>
          578 <p>Script 1:</p>
          579 <pre><code>time ./script1.sh
          580 [...snip snip...]
          581 real    0m22.095s
          582 </code></pre>
          583 <p>Script 2:</p>
          584 <pre><code>time ./script2.sh
          585 [...snip snip...]
          586 real    0m18.120s
          587 </code></pre>
          588 <h2>How it works</h2>
          589 <p>The parent process:</p>
          590 <ul>
          591 <li>The parent, using xargs, handles the queue of jobs and schedules the jobs to
          592 execute as a child process.</li>
          593 <li>The list function writes the parameters to stdout. These parameters are
          594 separated by the NUL byte separator. The NUL byte separator is used because
          595 this character cannot be used in filenames (which can contain spaces or even
          596 newlines) and cannot be used in text (the NUL byte terminates the buffer for
          597 a string).</li>
          598 <li>The -L option must match the amount of arguments that are specified for the
          599 job. It will split the specified parameters per job.</li>
          600 <li>The expression "$(readlink -f "$0")" gets the absolute path to the
          601 shellscript itself. This is passed as the executable to run for xargs.</li>
          602 <li>xargs calls the script itself with the specified parameters it is being fed.
          603 The environment variable $CHILD_MODE is set to indicate to the script itself
          604 it is run as a child process of the script.</li>
          605 </ul>
          606 <p>The child process:</p>
          607 <ul>
          608 <li><p>The command-line arguments are passed by the parent using xargs.</p>
          609 </li>
          610 <li><p>The environment variable $CHILD_MODE is set to indicate to the script itself
          611 it is run as a child process of the script.</p>
          612 </li>
          613 <li><p>The script itself (ran in child-mode process) only executes the task and
          614 signals its status back to xargs and the parent.</p>
          615 </li>
          616 <li><p>The exit status of the child program is signaled to xargs. This could be
          617 handled, for example to stop on the first failure (in this example it is not).
          618 For example if the program is killed, stopped or the exit status is 255 then
          619 xargs stops running also.</p>
          620 </li>
          621 </ul>
          622 <h2>Description of used xargs options</h2>
          623 <p>From the OpenBSD man page: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></p>
          624 <pre><code>xargs - construct argument list(s) and execute utility
          625 </code></pre>
          626 <p>Options explained:</p>
          627 <ul>
          628 <li>-r: Do not run the command if there are no arguments. Normally the command
          629 is executed at least once even if there are no arguments.</li>
          630 <li>-0: Change xargs to expect NUL ('\0') characters as separators, instead of
          631 spaces and newlines.</li>
          632 <li>-P maxprocs: Parallel mode: run at most maxprocs invocations of utility
          633 at once.</li>
          634 <li>-L number: Call utility for every number of non-empty lines read. A line
          635 ending in unescaped white space and the next non-empty line are considered
          636 to form one single line. If EOF is reached and fewer than number lines have
          637 been read then utility will be called with the available lines.</li>
          638 </ul>
          639 <h2>xargs options -0 and -P, portability and historic context</h2>
          640 <p>Some of the options, like -P are as of writing (2023) non-POSIX:
          641 <a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html">https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html</a>.
          642 However many systems support this useful extension for many years now.</p>
          643 <p>The specification even mentions implementations which support parallel
          644 operations:</p>
          645 <p>"The version of xargs required by this volume of POSIX.1-2017 is required to
          646 wait for the completion of the invoked command before invoking another command.
          647 This was done because historical scripts using xargs assumed sequential
          648 execution. Implementations wanting to provide parallel operation of the invoked
          649 utilities are encouraged to add an option enabling parallel invocation, but
          650 should still wait for termination of all of the children before xargs
          651 terminates normally."</p>
          652 <p>Some historic context:</p>
          653 <p>The xargs -0 option was added on 1996-06-11 by Theo de Raadt, about a year
          654 after the NetBSD import (over 27 years ago at the time of writing):</p>
          655 <p><a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.2&amp;content-type=text/x-cvsweb-markup">CVS log</a></p>
          656 <p>On OpenBSD the xargs -P option was added on 2003-12-06 by syncing the FreeBSD
          657 code:</p>
          658 <p><a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.14&amp;content-type=text/x-cvsweb-markup">CVS log</a></p>
          659 <p>Looking at the imported git history log of GNU findutils (which has xargs), the
          660 very first commit already had the -0 and -P option:</p>
          661 <p><a href="https://savannah.gnu.org/git/?group=findutils">git log</a></p>
          662 <pre><code>commit c030b5ee33bbec3c93cddc3ca9ebec14c24dbe07
          663 Author: Kevin Dalley &lt;kevin@seti.org&gt;
          664 Date:   Sun Feb 4 20:35:16 1996 +0000
          665 
          666     Initial revision
          667 </code></pre>
          668 <h2>xargs: some incompatibilities found</h2>
          669 <ul>
          670 <li>Using the -0 option empty fields are handled differently in different
          671 implementations.</li>
          672 <li>The -n and -L option doesn't work correctly in many of the BSD implementations.
          673 Some count empty fields, some don't.  In early implementations in FreeBSD and
          674 OpenBSD it only processed the first line.  In OpenBSD it has been improved
          675 around 2017.</li>
          676 </ul>
          677 <p>Depending on what you want to do a workaround could be to use the -0 option
          678 with a single field and use the -n flag.  Then in each child program invocation
          679 split the field by a separator.</p>
          680 <h2>References</h2>
          681 <ul>
          682 <li>xargs: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></li>
          683 <li>printf: <a href="https://man.openbsd.org/printf">https://man.openbsd.org/printf</a></li>
          684 <li>ksh, wait: <a href="https://man.openbsd.org/ksh#wait">https://man.openbsd.org/ksh#wait</a></li>
          685 <li>wait(2): <a href="https://man.openbsd.org/wait">https://man.openbsd.org/wait</a></li>
          686 </ul>
          687 ]]></description>
          688 </item>
          689 <item>
          690         <title>Improved Youtube RSS/Atom feed</title>
          691         <link>gopher://codemadness.org/1/phlog/youtube-feed</link>
          692         <guid>gopher://codemadness.org/1/phlog/youtube-feed</guid>
          693         <dc:date>2023-11-20T00:00:00Z</dc:date>
          694         <author>Hiltjo</author>
          695         <description><![CDATA[<h1>Improved Youtube RSS/Atom feed</h1>
          696         <p><strong>Last modification on </strong> <time>2023-11-20</time></p>
          697         <p>... improved at least for my preferences ;)</p>
          698 <p>It scrapes the channel data from Youtube and combines it with the parsed Atom
          699 feed from the channel on Youtube.</p>
          700 <p>The Atom parser is based on sfeed, with some of the code removed because it is
          701 not needed by this program.  It scrapes the metadata of the videos from the
          702 channel its HTML page and uses my custom JSON parser to convert the
          703 Javascript/JSON structure.</p>
          704 <p>This parser is also used by the <a href="json2tsv.html">json2tsv</a> tool. It has few dependencies.</p>
          705 <h2>Features</h2>
          706 <ul>
          707 <li>Add the video duration to the title to quickly see how long the video is.</li>
          708 <li>Filter away Youtube shorts and upcoming videos / announcements: only videos are shown.</li>
          709 <li>Supports more output formats: Atom, <a href="https://www.jsonfeed.org/version/1.1/">JSON Feed</a> or
          710 <a href="sfeed.1.txt">sfeed</a> Tab-Separated-Value format.</li>
          711 <li>Easy to build and deploy: can be run as a CGI program as a static-linked
          712 binary in a chroot.</li>
          713 <li>Secure: additionally to running in a chroot it can use pledge(2) and unveil(2)
          714 on OpenBSD to restrict system calls and access to the filesystem.</li>
          715 </ul>
          716 <h2>How to use</h2>
          717 <p>There is an option to run directly from the command-line or in CGI-mode.  When
          718 the environment variable $REQUEST_URI is set then it is automatically run in
          719 CGI mode.</p>
          720 <p>Command-line usage:</p>
          721 <pre><code>youtube_feed channelid atom
          722 youtube_feed channelid gph
          723 youtube_feed channelid html
          724 youtube_feed channelid json
          725 youtube_feed channelid tsv
          726 youtube_feed channelid txt
          727 </code></pre>
          728 <p>CGI program usage:</p>
          729 <p>The last basename part of the URL should be the channelid + the output format
          730 extension. It defaults to TSV if there is no extension.
          731 The CGI program can be used with a HTTPd or a Gopher daemon such as geomyidae.</p>
          732 <p>For example:</p>
          733 <pre><code>Atom XML:     https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.xml
          734 HTML:         https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.html
          735 JSON:         https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.json
          736 TSV:          https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.tsv
          737 twtxt:        https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.txt
          738 TSV, default: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw
          739 
          740 Gopher dir:   gopher://codemadness.org/1/feed.cgi/UCrbvoMC0zUvPL8vjswhLOSw.gph
          741 Gopher TSV:   gopher://codemadness.org/0/feed.cgi/UCrbvoMC0zUvPL8vjswhLOSw
          742 </code></pre>
          743 <p>An OpenBSD httpd.conf using slowcgi as an example:</p>
          744 <pre><code>server "codemadness.org" {
          745         location "/yt-chan/*" {
          746                 request strip 1
          747                 root "/cgi-bin/yt-chan"
          748                 fastcgi socket "/run/slowcgi.sock"
          749         }
          750 }
          751 </code></pre>
          752 <h2>Using it with <a href="sfeed.html">sfeed</a></h2>
          753 <p>sfeedrc example of an existing Youtube RSS/Atom feed:</p>
          754 <pre><code># list of feeds to fetch:
          755 feeds() {
          756         # feed &lt;name&gt; &lt;feedurl&gt; [basesiteurl] [encoding]
          757         # normal Youtube Atom feed.
          758         feed "yt IM" "https://www.youtube.com/feeds/videos.xml?channel_id=UCrbvoMC0zUvPL8vjswhLOSw"
          759 }
          760 </code></pre>
          761 <p>Use the new Atom feed directly using the CGI-mode and Atom output format:</p>
          762 <pre><code># list of feeds to fetch:
          763 feeds() {
          764         # feed &lt;name&gt; &lt;feedurl&gt; [basesiteurl] [encoding]
          765         # new Youtube Atom feed.
          766         feed "idiotbox IM" "https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.xml"
          767 }
          768 </code></pre>
          769 <p>... or convert directly using a custom connector program on the local system via the command-line:</p>
          770 <pre><code># fetch(name, url, feedfile)
          771 fetch() {
          772         case "$1" in
          773         "connector example")
          774                 youtube_feed "$2";;
          775         *)
          776                 curl -L --max-redirs 0 -H "User-Agent:" -f -s -m 15 \
          777                         "$2" 2&gt;/dev/null;;
          778         esac
          779 }
          780 
          781 # parse and convert input, by default XML to the sfeed(5) TSV format.
          782 # parse(name, feedurl, basesiteurl)
          783 parse() {
          784         case "$1" in
          785         "connector example")
          786                 cat;;
          787         *)
          788                 sfeed "$3";;
          789         esac
          790 }
          791 
          792 # list of feeds to fetch:
          793 feeds() {
          794         # feed &lt;name&gt; &lt;feedurl&gt; [basesiteurl] [encoding]
          795         feed "connector example" "UCrbvoMC0zUvPL8vjswhLOSw"
          796 }
          797 </code></pre>
          798 <h2>Screenshot using sfeed_curses</h2>
          799 <p><a href="downloads/screenshots/sfeed_curses_youtube.png"><img src="downloads/screenshots/sfeed_curses_youtube.png" alt="Screenshot showing the improved Youtube feed" width="480" height="270" loading="lazy" /></a></p>
          800 <h2>Clone</h2>
          801 <pre><code>git clone git://git.codemadness.org/frontends
          802 </code></pre>
          803 <h2>Browse</h2>
          804 <p>You can browse the source-code at:</p>
          805 <ul>
          806 <li><a href="https://git.codemadness.org/frontends/file/youtube/feed.c.html">https://git.codemadness.org/frontends/file/youtube/feed.c.html</a></li>
          807 <li><a href="gopher://codemadness.org/1/git/frontends/file/youtube/feed.c.gph">gopher://codemadness.org/1/git/frontends/file/youtube/feed.c.gph</a></li>
          808 </ul>
          809 <p>The program is: youtube/feed</p>
          810 <h2>Dependencies</h2>
          811 <ul>
          812 <li>C compiler.</li>
          813 <li>LibreSSL + libtls.</li>
          814 </ul>
          815 <h2>Build and install</h2>
          816 <pre><code>$ make
          817 # make install
          818 </code></pre>
          819 <h2>That's all</h2>
          820 <p>I hope by sharing this it is useful to someone other than me as well.</p>
          821 ]]></description>
          822 </item>
          823 <item>
          824         <title>webdump HTML to plain-text converter</title>
          825         <link>gopher://codemadness.org/1/phlog/webdump</link>
          826         <guid>gopher://codemadness.org/1/phlog/webdump</guid>
          827         <dc:date>2023-11-20T00:00:00Z</dc:date>
          828         <author>Hiltjo</author>
          829         <description><![CDATA[<h1>webdump HTML to plain-text converter</h1>
          830         <p><strong>Last modification on </strong> <time>2025-04-25</time></p>
          831         <p>webdump is (yet another) HTML to plain-text converter tool.</p>
          832 <p>It reads HTML in UTF-8 from stdin and writes plain-text to stdout.</p>
          833 <h2>Goals and scope</h2>
          834 <p>The main goal of this tool for me is to use it for converting HTML mails to
          835 plain-text and to convert HTML content in RSS feeds to plain-text.</p>
          836 <p>The tool will only convert HTML to stdout, similarly to links -dump or lynx
          837 -dump but simpler and more secure.</p>
          838 <ul>
          839 <li>HTML and XHTML will be supported.</li>
          840 <li>There will be some workarounds and quirks for broken and legacy HTML code.</li>
          841 <li>It will be usable and secure for reading HTML from mails and RSS/Atom feeds.</li>
          842 <li>No remote resources which are part of the HTML will be downloaded:
          843 images, video, audio, etc. But these may be visible as a link reference.</li>
          844 <li>Data will be written to stdout. Intended for plain-text or a text terminal.</li>
          845 <li>No support for Javascript, CSS, frame rendering or form processing.</li>
          846 <li>No HTTP or network protocol handling: HTML data is read from stdin.</li>
          847 <li>Listings for references and some options to extract them in a list that is
          848 usable for scripting. Some references are: link anchors, images, audio, video,
          849 HTML (i)frames, etc.</li>
          850 <li>Security: on OpenBSD it uses pledge("stdio", NULL).</li>
          851 <li>Keep the code relatively small, simple and hackable.</li>
          852 </ul>
          853 <h2>Features</h2>
          854 <ul>
          855 <li>Support for word-wrapping.</li>
          856 <li>A mode to enable basic markup: bold, underline, italic and blink ;)</li>
          857 <li>Indentation of headers, paragraphs, pre and list items.</li>
          858 <li>Basic support to query elements or hide them.</li>
          859 <li>Show link references.</li>
          860 <li>Show link references and resources such as img, video, audio, subtitles.</li>
          861 <li>Export link references and resources to a TAB-separated format.</li>
          862 </ul>
          863 <h2>Usage examples</h2>
          864 <pre><code>url='https://codemadness.org/sfeed.html'
          865 
          866 curl -s "$url" | webdump -r -b "$url" | less
          867 
          868 curl -s "$url" | webdump -8 -a -i -l -r -b "$url" | less -R
          869 
          870 curl -s "$url" | webdump -s 'main' -8 -a -i -l -r -b "$url" | less -R
          871 </code></pre>
          872 <p>Yes, all these option flags look ugly, a shellscript wrapper could be used :)</p>
          873 <h2>Practical examples</h2>
          874 <p>To use webdump as a HTML to text filter for example in the mutt mail client,
          875 change in ~/.mailcap:</p>
          876 <pre><code>text/html; webdump -i -l -r &lt; %s; needsterminal; copiousoutput
          877 </code></pre>
          878 <p>In mutt you should then add:</p>
          879 <pre><code>auto_view text/html
          880 </code></pre>
          881 <p>Using webdump as a HTML to text filter for sfeed_curses (otherwise the default is lynx):</p>
          882 <pre><code>SFEED_HTMLCONV="webdump -d -8 -r -i -l -a" sfeed_curses ~/.sfeed/feeds/*
          883 </code></pre>
          884 <h1>Query/selector examples</h1>
          885 <p>The query syntax using the -s option is a bit inspired by CSS (but much more limited).</p>
          886 <p>To get the title from a HTML page:</p>
          887 <pre><code>url='https://codemadness.org/sfeed.html'
          888 
          889 title=$(curl -s "$url" | webdump -s 'title')
          890 printf '%s\n' "$title"
          891 </code></pre>
          892 <p>List audio and video-related content from a HTML page, redirect fd 3 to fd 1 (stdout):</p>
          893 <pre><code>url="https://media.ccc.de/v/051_Recent_features_to_OpenBSD-ntpd_and_bgpd"
          894 curl -s "$url" | webdump -x -s 'audio,video' -b "$url" 3&gt;&amp;1 &gt;/dev/null | cut -f 2
          895 </code></pre>
          896 <h2>Clone</h2>
          897 <pre><code>git clone git://git.codemadness.org/webdump
          898 </code></pre>
          899 <h2>Browse</h2>
          900 <p>You can browse the source-code at:</p>
          901 <ul>
          902 <li><a href="https://git.codemadness.org/webdump/">https://git.codemadness.org/webdump/</a></li>
          903 <li><a href="gopher://codemadness.org/1/git/webdump">gopher://codemadness.org/1/git/webdump</a></li>
          904 </ul>
          905 <h2>Download releases</h2>
          906 <p>Releases are available at:</p>
          907 <ul>
          908 <li><a href="https://codemadness.org/releases/webdump/">https://codemadness.org/releases/webdump/</a></li>
          909 <li><a href="gopher://codemadness.org/1/releases/webdump">gopher://codemadness.org/1/releases/webdump</a></li>
          910 </ul>
          911 <h2>Build and install</h2>
          912 <pre><code>$ make
          913 # make install
          914 </code></pre>
          915 <h2>Dependencies</h2>
          916 <ul>
          917 <li>C compiler.</li>
          918 <li>libc + some BSDisms.</li>
          919 </ul>
          920 <h2>Trade-offs</h2>
          921 <p>All software has trade-offs.</p>
          922 <p>webdump processes HTML in a single-pass. It does not buffer the full DOM tree.
          923 Although due to the nature of HTML/XML some parts like attributes need to be
          924 buffered.</p>
          925 <p>Rendering tables in webdump is very limited. Twibright Links has really nice
          926 table rendering. However implementing a similar feature in the current design of
          927 webdump would make the code much more complex. Twibright links
          928 processes a full DOM tree and processes the tables in multiple passes (to
          929 measure the table cells) etc.  Of course tables can be nested also, or HTML tables
          930 that are used for creating layouts (these are mostly older webpages).</p>
          931 <p>These trade-offs and preferences are chosen for now. It may change in the
          932 future.  Fortunately there are the usual good suspects for HTML to plain-text
          933 conversion, each with their own chosen trade-offs of course:</p>
          934 <ul>
          935 <li>twibright links: <a href="http://links.twibright.com/">http://links.twibright.com/</a></li>
          936 <li>lynx: <a href="https://lynx.invisible-island.net/">https://lynx.invisible-island.net/</a></li>
          937 <li>w3m: <a href="https://w3m.sourceforge.net/">https://w3m.sourceforge.net/</a></li>
          938 <li>xmllint (part of libxml2): <a href="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home">https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home</a></li>
          939 <li>xmlstarlet: <a href="https://xmlstar.sourceforge.net/">https://xmlstar.sourceforge.net/</a></li>
          940 </ul>
          941 ]]></description>
          942 </item>
          943 <item>
          944         <title>Setup your own mail paste service</title>
          945         <link>gopher://codemadness.org/1/phlog/mailservice</link>
          946         <guid>gopher://codemadness.org/1/phlog/mailservice</guid>
          947         <dc:date>2023-10-25T00:00:00Z</dc:date>
          948         <author>Hiltjo</author>
          949         <description><![CDATA[<h1>Setup your own mail paste service</h1>
          950         <p><strong>Last modification on </strong> <time>2024-02-10</time></p>
          951         <h2>How it works</h2>
          952 <ul>
          953 <li>The user sends a mail with an attachment to a certain mail address, for
          954 example: paste@somehost.org</li>
          955 <li>The mail daemon configuration has an mail alias to pipe the raw mail to a
          956 shellscript.</li>
          957 <li>This shellscript processes the raw mail contents from stdin.</li>
          958 </ul>
          959 <h2>What it does</h2>
          960 <ul>
          961 <li>Process a mail with the attachments automatically.</li>
          962 <li>The script processes the attachments in the mail and stores them.</li>
          963 <li>It will mail (back) the URL where the file(s) are stored.</li>
          964 </ul>
          965 <p>This script is tested on OpenBSD using OpenBSD smtpd and OpenBSD httpd and the
          966 gopher daemon geomyidae.</p>
          967 <h2>Install dependencies</h2>
          968 <p>On OpenBSD:</p>
          969 <pre><code>pkg_add mblaze
          970 </code></pre>
          971 <h2>smtpd mail configuration</h2>
          972 <p>In your mail aliases (for example /etc/mail/aliases) put:</p>
          973 <pre><code>paste: |/usr/local/bin/paste-mail
          974 </code></pre>
          975 <p>This pipes the mail to the script paste-mail for processing, this script is
          976 described below. Copy the below contents in /usr/local/bin/paste-mail</p>
          977 <p>Script:</p>
          978 <pre><code>#!/bin/sh
          979 
          980 d="/home/www/domains/www.codemadness.org/htdocs/mailpaste"
          981 tmpmsg=$(mktemp)
          982 tmpmail=$(mktemp)
          983 
          984 cleanup() {
          985         rm -f "$tmpmail" "$tmpmsg"
          986 }
          987 
          988 # store whole mail from stdin temporarily, on exit remove temporary file.
          989 trap "cleanup" EXIT
          990 cat &gt; "$tmpmail"
          991 
          992 # mblaze: don't store mail sequence.
          993 MAILSEQ=/dev/null
          994 export MAILSEQ
          995 
          996 # get from address (without display name).
          997 from=$(maddr -a -h 'From' /dev/stdin &lt; "$tmpmail")
          998 
          999 # check if allowed or not.
         1000 case "$from" in
         1001 "hiltjo@codemadness.org")
         1002         ;;
         1003 *)
         1004         exit 0;;
         1005 esac
         1006 
         1007 # prevent mail loop.
         1008 if printf '%s' "$from" | grep -q "paste@"; then
         1009         exit 0
         1010 fi
         1011 
         1012 echo "Thank you for using the enterprise paste service." &gt; "$tmpmsg"
         1013 echo "" &gt;&gt; "$tmpmsg"
         1014 echo "Your file(s) are available at:" &gt;&gt; "$tmpmsg"
         1015 echo "" &gt;&gt; "$tmpmsg"
         1016 
         1017 # process each attachment.
         1018 mshow -n -q -t /dev/stdin &lt; "$tmpmail" | sed -nE 's@.*name="(.*)".*@\1@p' | while read -r name; do
         1019         test "$name" = "" &amp;&amp; continue
         1020 
         1021         # extract attachment.
         1022         tmpfile=$(mktemp -p "$d" XXXXXXXXXXXX)
         1023         mshow -n -O /dev/stdin "$name" &lt; "$tmpmail" &gt; "$tmpfile"
         1024 
         1025         # use file extension.
         1026         ext="${name##*/}"
         1027         case "$ext" in
         1028         *.tar.*)
         1029                 # special case: support .tar.gz, tar.bz2, etc.
         1030                 ext="tar.${ext##*.}";;
         1031         *.*)
         1032                 ext="${ext##*.}";;
         1033         *)
         1034                 ext="";;
         1035         esac
         1036         ext="${ext%%*.}"
         1037 
         1038         # use file extension if it is set.
         1039         outputfile="$tmpfile"
         1040         if test "$ext" != ""; then
         1041                 outputfile="$tmpfile.$ext"
         1042         fi
         1043         mv "$tmpfile" "$outputfile"
         1044         b=$(basename "$outputfile")
         1045 
         1046         chmod 666 "$outputfile"
         1047         url="gopher://codemadness.org/9/mailpaste/$b"
         1048 
         1049         echo "$name:" &gt;&gt; "$tmpmsg"
         1050         echo "        Text   file: gopher://codemadness.org/0/mailpaste/$b" &gt;&gt; "$tmpmsg"
         1051         echo "        Image  file: gopher://codemadness.org/I/mailpaste/$b" &gt;&gt; "$tmpmsg"
         1052         echo "        Binary file: gopher://codemadness.org/9/mailpaste/$b" &gt;&gt; "$tmpmsg"
         1053         echo "" &gt;&gt; "$tmpmsg"
         1054 done
         1055 
         1056 echo "" &gt;&gt; "$tmpmsg"
         1057 echo "Sincerely," &gt;&gt; "$tmpmsg"
         1058 echo "Your friendly paste_bot" &gt;&gt; "$tmpmsg"
         1059 
         1060 # mail back the user.
         1061 mail -r "$from" -s "Your files" "$from" &lt; "$tmpmsg"
         1062 
         1063 cleanup
         1064 </code></pre>
         1065 <p>The mail daemon processing the mail needs of course to be able to have
         1066 permissions to write to the specified directory. The user who received the mail
         1067 needs to be able to read it from a location they can access and have
         1068 permissions for it also.</p>
         1069 <h2>Room for improvements</h2>
         1070 <p>This is just an example script. There is room for many improvements.
         1071 Feel free to change it in any way you like.</p>
         1072 <h2>References</h2>
         1073 <ul>
         1074 <li><a href="https://man.openbsd.org/aliases">https://man.openbsd.org/aliases</a></li>
         1075 <li><a href="https://man.openbsd.org/smtpd">https://man.openbsd.org/smtpd</a></li>
         1076 <li><a href="https://man.openbsd.org/httpd">https://man.openbsd.org/httpd</a></li>
         1077 <li><a href="https://github.com/leahneukirchen/mblaze">https://github.com/leahneukirchen/mblaze</a></li>
         1078 </ul>
         1079 <h2>Bye bye</h2>
         1080 <p>I hope this enterprise(tm) mail service is inspirational or something ;)</p>
         1081 ]]></description>
         1082 </item>
         1083 <item>
         1084         <title>A simple TODO application</title>
         1085         <link>gopher://codemadness.org/1/phlog/todo</link>
         1086         <guid>gopher://codemadness.org/1/phlog/todo</guid>
         1087         <dc:date>2022-07-01T00:00:00Z</dc:date>
         1088         <author>Hiltjo</author>
         1089         <description><![CDATA[<h1>A simple TODO application</h1>
         1090         <p><strong>Last modification on </strong> <time>2022-07-01</time></p>
         1091         <p>This article describes a TODO application or workflow.</p>
         1092 <h2>Workflow</h2>
         1093 <p>It works like this:</p>
         1094 <ul>
         1095 <li>Open any text editor.</li>
         1096 <li>Edit the text.</li>
         1097 <li>Save it in a file (probably named "TODO").</li>
         1098 <li>Feel happy about it.</li>
         1099 </ul>
         1100 <h2>The text format</h2>
         1101 <p>The text format I use is this:</p>
         1102 <pre><code>[indendations]&lt;symbol&gt;&lt;SPACE&gt;&lt;item text&gt;&lt;NEWLINE&gt;
         1103 </code></pre>
         1104 <p>Most of the time an item is just one line.
         1105 This format is just a general guideline to keep the items somewhat structured.</p>
         1106 <h2>Symbols</h2>
         1107 <p>Items are prefixed with a symbol.</p>
         1108 <ul>
         1109 <li>- is an item which is planned to be done at some point.</li>
         1110 <li>x is an item which is done.</li>
         1111 <li>? is an item which I'm not (yet) sure about. It can also be an idea.</li>
         1112 </ul>
         1113 <p>I use an indendation with a TAB before an item to indicate item dependencies.
         1114 The items can be nested.</p>
         1115 <p>For the prioritization I put the most important items and sections from the top
         1116 to the bottom. These can be reshuffled as you wish of course.</p>
         1117 <p>To delete an item you remove the line. To archive an item you keep the line.</p>
         1118 <h2>Sections</h2>
         1119 <p>A section is a line which has no symbol. This is like a header to group items.</p>
         1120 <h2>Example</h2>
         1121 <pre><code>Checklist for releasing project 0.1:
         1122 - Test project with different compilers and check for warnings.
         1123 - Documentation:
         1124         - Proofread and make sure it matches all program behaviour.
         1125         - Run mandoc -Tlint on the man pages.
         1126         ? Copy useful examples from the README file to the man page?
         1127 - Run testsuite and check for failures before release.
         1128 
         1129 
         1130 project 0.2:
         1131 ? Investigate if feature mentioned by some user is worth adding.
         1132 </code></pre>
         1133 <h1>Example: secure remote cloud-encrypted edit session(tm)</h1>
         1134 <pre><code>ssh -t host 'ed TODO'
         1135 </code></pre>
         1136 <h1>Example: multi-user secure remote cloud-encrypted edit session(tm)</h1>
         1137 <pre><code>ssh host
         1138 tmux or tmux a
         1139 ed TODO
         1140 </code></pre>
         1141 <h1>Example: version-controlled multi-user secure remote cloud-encrypted edit session(tm)</h1>
         1142 <pre><code>ssh host
         1143 tmux or tmux a
         1144 ed TODO
         1145 git add TODO
         1146 git commit -m 'TODO: update'
         1147 </code></pre>
         1148 <h2>Pros</h2>
         1149 <ul>
         1150 <li>When you open the TODO file the most important items are at the top.</li>
         1151 <li>The items are easy to read and modify with any text editor.</li>
         1152 <li>It is easy to extend the format and use with other text tools.</li>
         1153 <li>The format is portable: it works on sticky-notes on your CRT monitor too!</li>
         1154 <li>No monthly online subscription needed and full NO-money-back guarantee.</li>
         1155 </ul>
         1156 <h2>Cons</h2>
         1157 <ul>
         1158 <li>Complex lists with interconnected dependencies might not work, maybe.</li>
         1159 <li>It's assumed there is one person maintaining the TODO file. Merging items
         1160 from multiple people at the same time in this workflow is not recommended.</li>
         1161 <li>It is too simple: noone will be impressed by it.</li>
         1162 </ul>
         1163 <p>I hope this is inspirational or something,</p>
         1164 ]]></description>
         1165 </item>
         1166 <item>
         1167         <title>2FA TOTP without crappy authenticator apps</title>
         1168         <link>gopher://codemadness.org/1/phlog/totp</link>
         1169         <guid>gopher://codemadness.org/1/phlog/totp</guid>
         1170         <dc:date>2022-03-23T00:00:00Z</dc:date>
         1171         <author>Hiltjo</author>
         1172         <description><![CDATA[<h1>2FA TOTP without crappy authenticator apps</h1>
         1173         <p><strong>Last modification on </strong> <time>2022-10-29</time></p>
         1174         <p>This describes how to use 2FA without using crappy authenticator "apps" or a
         1175 mobile device.</p>
         1176 <h2>Install</h2>
         1177 <p>On OpenBSD:</p>
         1178 <pre><code>pkg_add oath-toolkit zbar
         1179 </code></pre>
         1180 <p>On Void Linux:</p>
         1181 <pre><code>xbps-install oath-toolkit zbar
         1182 </code></pre>
         1183 <p>There is probably a package for your operating system.</p>
         1184 <ul>
         1185 <li>oath-toolkit is used to generate the digits based on the secret key.</li>
         1186 <li>zbar is used to scan the QR barcode text from the image.</li>
         1187 </ul>
         1188 <h2>Steps</h2>
         1189 <p>Save the QR code image from the authenticator app, website to an image file.
         1190 Scan the QR code text from the image:</p>
         1191 <pre><code>zbarimg image.png
         1192 </code></pre>
         1193 <p>An example QR code:</p>
         1194 <p><img src="downloads/2fa/qr.png" alt="QR code example" /></p>
         1195 <p>The output is typically something like:</p>
         1196 <pre><code>QR-Code:otpauth://totp/Example:someuser@codemadness.org?secret=SECRETKEY&amp;issuer=Codemadness
         1197 </code></pre>
         1198 <p>You only need to scan this QR-code for the secret key once.
         1199 Make sure to store the secret key in a private safe place and don't show it to
         1200 anyone else.</p>
         1201 <p>Using the secret key the following command outputs a 6-digit code by default.
         1202 In this example we also assume the key is base32-encoded.
         1203 There can be other parameters and options, this is documented in the Yubico URI
         1204 string format reference below.</p>
         1205 <p>Command:</p>
         1206 <pre><code>oathtool --totp -b SOMEKEY
         1207 </code></pre>
         1208 <ul>
         1209 <li>The --totp option uses the time-variant TOTP mode, by default it uses HMAC SHA1.</li>
         1210 <li>The -b option uses base32 encoding of KEY instead of hex.</li>
         1211 </ul>
         1212 <p>Tip: you can create a script that automatically puts the digits in the
         1213 clipboard, for example:</p>
         1214 <pre><code>oathtool --totp -b SOMEKEY | xclip
         1215 </code></pre>
         1216 <h2>References</h2>
         1217 <ul>
         1218 <li><a href="https://linux.die.net/man/1/zbarimg">zbarimg(1) man page</a></li>
         1219 <li><a href="https://www.nongnu.org/oath-toolkit/man-oathtool.html">oathtool(1) man page</a></li>
         1220 <li><a href="https://datatracker.ietf.org/doc/html/rfc6238">RFC6238 - TOTP: Time-Based One-Time Password Algorithm</a></li>
         1221 <li><a href="https://docs.yubico.com/yesdk/users-manual/application-oath/uri-string-format.html">Yubico.com - otpauth URI string format</a></li>
         1222 </ul>
         1223 ]]></description>
         1224 </item>
         1225 <item>
         1226         <title>Setup an OpenBSD RISCV64 VM in QEMU</title>
         1227         <link>gopher://codemadness.org/1/phlog/openbsd-riscv64-vm</link>
         1228         <guid>gopher://codemadness.org/1/phlog/openbsd-riscv64-vm</guid>
         1229         <dc:date>2021-10-23T00:00:00Z</dc:date>
         1230         <author>Hiltjo</author>
         1231         <description><![CDATA[<h1>Setup an OpenBSD RISCV64 VM in QEMU</h1>
         1232         <p><strong>Last modification on </strong> <time>2021-10-26</time></p>
         1233         <p>This describes how to setup an OpenBSD RISCV64 VM in QEMU.</p>
         1234 <p>The shellscript below does the following:</p>
         1235 <ul>
         1236 <li>Set up the disk image (raw format).</li>
         1237 <li>Patch the disk image with the OpenBSD miniroot file for the installation.</li>
         1238 <li>Downloads the opensbi and u-boot firmware files for qemu.</li>
         1239 <li>Run the VM with the supported settings.</li>
         1240 </ul>
         1241 <p>The script is tested on the host GNU/Void Linux and OpenBSD-current.</p>
         1242 <p><strong>IMPORTANT!: The signature and checksum for the miniroot, u-boot and opensbi
         1243 files are not verified. If the host is OpenBSD make sure to instead install the
         1244 packages (pkg_add u-boot-riscv64 opensbi) and adjust the firmware path for the
         1245 qemu -bios and -kernel options. </strong></p>
         1246 <h2>Shellscript</h2>
         1247 <pre><code>#!/bin/sh
         1248 # mirror list: https://www.openbsd.org/ftp.html
         1249 mirror="https://ftp.bit.nl/pub/OpenBSD/"
         1250 release="7.0"
         1251 minirootname="miniroot70.img"
         1252 
         1253 miniroot() {
         1254         test -f "${minirootname}" &amp;&amp; return # download once
         1255 
         1256         url="${mirror}/${release}/riscv64/${minirootname}"
         1257         curl -o "${minirootname}" "${url}"
         1258 }
         1259 
         1260 createrootdisk() {
         1261         test -f disk.raw &amp;&amp; return # create once
         1262         qemu-img create disk.raw 10G # create 10 GB disk
         1263         dd conv=notrunc if=${minirootname} of=disk.raw # write miniroot to disk
         1264 }
         1265 
         1266 opensbi() {
         1267         f="opensbi.tgz"
         1268         test -f "${f}" &amp;&amp; return # download and extract once.
         1269 
         1270         url="${mirror}/${release}/packages/amd64/opensbi-0.9p0.tgz"
         1271         curl -o "${f}" "${url}"
         1272 
         1273         tar -xzf "${f}" share/opensbi/generic/fw_jump.bin
         1274 }
         1275 
         1276 uboot() {
         1277         f="uboot.tgz"
         1278         test -f "${f}" &amp;&amp; return # download and extract once.
         1279 
         1280         url="${mirror}/${release}/packages/amd64/u-boot-riscv64-2021.07p0.tgz"
         1281         curl -o "${f}" "${url}"
         1282 
         1283         tar -xzf "${f}" share/u-boot/qemu-riscv64_smode/u-boot.bin
         1284 }
         1285 
         1286 setup() {
         1287         miniroot
         1288         createrootdisk
         1289         opensbi
         1290         uboot
         1291 }
         1292 
         1293 run() {
         1294         qemu-system-riscv64 \
         1295                 -machine virt \
         1296                 -nographic \
         1297                 -m 2048M \
         1298                 -smp 2 \
         1299                 -bios share/opensbi/generic/fw_jump.bin \
         1300                 -kernel share/u-boot/qemu-riscv64_smode/u-boot.bin \
         1301                 -drive file=disk.raw,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \
         1302                 -netdev user,id=net0,ipv6=off -device virtio-net-device,netdev=net0
         1303 }
         1304 
         1305 setup
         1306 run
         1307 </code></pre>
         1308 ]]></description>
         1309 </item>
         1310 <item>
         1311         <title>Sfeed_curses: a curses UI front-end for sfeed</title>
         1312         <link>gopher://codemadness.org/1/phlog/sfeed_curses</link>
         1313         <guid>gopher://codemadness.org/1/phlog/sfeed_curses</guid>
         1314         <dc:date>2020-06-25T00:00:00Z</dc:date>
         1315         <author>Hiltjo</author>
         1316         <description><![CDATA[<h1>Sfeed_curses: a curses UI front-end for sfeed</h1>
         1317         <p><strong>Last modification on </strong> <time>2025-07-24</time></p>
         1318         <p>sfeed_curses is a curses UI front-end for <a href="sfeed.html">sfeed</a>.
         1319 It is now part of sfeed.</p>
         1320 <p>It shows the TAB-separated feed items in a graphical command-line UI.  The
         1321 interface has a look inspired by the <a href="http://www.mutt.org/">mutt mail client</a>. It has a sidebar
         1322 panel for the feeds, a panel with a listing of the items and a small statusbar
         1323 for the selected item/URL. Some functions like searching and scrolling are
         1324 integrated in the interface itself.</p>
         1325 <h2>Features</h2>
         1326 <ul>
         1327 <li>Relatively few LOC, about 2.5K lines of C.</li>
         1328 <li>Few dependencies: a C compiler and a curses library (typically ncurses).
         1329 It also requires a terminal (emulator) which supports UTF-8.
         1330 <ul>
         1331 <li>xterm-compatible shim <a href="https://git.codemadness.org/sfeed/file/minicurses.h.html">minicurses.h</a></li>
         1332 </ul>
         1333 </li>
         1334 <li>Easy to customize by modifying the small source-code and shellscripts.</li>
         1335 <li>Plumb support: open the URL or an enclosure URL directly with any program.</li>
         1336 <li>Pipe support: pipe the selected Tab-Separated Value line to a program for
         1337 scripting purposes. Like viewing the content in any way you like.</li>
         1338 <li>Yank support: copy the URL or an enclosure URL to the clipboard.</li>
         1339 <li>Familiar keybinds: supports both vi-like, emacs-like and arrow keys for
         1340 actions.</li>
         1341 <li>Mouse support: it supports xterm X10 and extended SGR encoding.</li>
         1342 <li>Support two ways of managing read/unread items.
         1343 By default sfeed_curses marks the feed items of the last day as new/bold.
         1344 Alternatively a simple plain-text list with the read URLs can be used.</li>
         1345 <li>UI layouts: supports vertical, horizontal and monocle (full-screen) layouts.
         1346 Useful for different kind of screen sizes.</li>
         1347 <li>Auto-execute keybind commands at startup to automate setting a preferred
         1348 layout, toggle showing new items or other actions.</li>
         1349 </ul>
         1350 <p>Like the format programs included in sfeed you can run it by giving the feed
         1351 files as arguments like this:</p>
         1352 <pre><code>sfeed_curses ~/.sfeed/feeds/*
         1353 </code></pre>
         1354 <p>... or by reading directly from stdin:</p>
         1355 <pre><code>sfeed_curses &lt; ~/.sfeed/feeds/xkcd
         1356 </code></pre>
         1357 <p>It will show a sidebar if one or more files are specified as parameters. It
         1358 will not show the sidebar by default when reading from stdin.</p>
         1359 <p><a href="downloads/screenshots/sfeed_curses_screenshot.png"><img src="downloads/screenshots/sfeed_curses_screenshot.png" alt="Screenshot showing what the UI looks" width="480" height="270" loading="lazy" /></a></p>
         1360 <p>On pressing the 'o' or ENTER keybind it will open the link URL of an item with
         1361 the plumb program.  On pressing the 'a', 'e' or '@' keybind it will open the
         1362 enclosure URL if there is one.  The default plumb program is set to <a href="https://portland.freedesktop.org/doc/xdg-open.html">xdg-open</a>,
         1363 but can be modified by setting the environment variable $SFEED_PLUMBER.  The
         1364 plumb program receives the URL as a command-line argument.</p>
         1365 <p>The TAB-Separated-Value line of the current selected item in the feed file can
         1366 be piped to a program by pressing the 'c', 'p' or '|' keybind. This allows much
         1367 flexibility to make a content formatter or write other custom actions or views.
         1368 This line is in the exact same format as described in the sfeed(5) man page.</p>
         1369 <p>The pipe program can be changed by setting the environment variable
         1370 $SFEED_PIPER.</p>
         1371 <p><a href="downloads/screenshots/sfeed_curses_pipe_screenshot.png"><img src="downloads/screenshots/sfeed_curses_pipe_screenshot.png" alt="Screenshot showing the output of the pipe content script" width="480" height="270" loading="lazy" /></a></p>
         1372 <p>The above screenshot shows the included <a href="https://git.codemadness.org/sfeed/file/sfeed_content.html">sfeed_content</a> shellscript which uses
         1373 the <a href="https://invisible-island.net/lynx/">lynx text-browser</a> to convert HTML to plain-text.  It pipes the formatted
         1374 plain-text to the user $PAGER (or "less").</p>
         1375 <p>Of course the script can be easily changed to use a different browser or
         1376 HTML-to-text converter like:</p>
         1377 <ul>
         1378 <li><a href="https://www.dillo.org/">dillo</a></li>
         1379 <li><a href="http://www.jikos.cz/~mikulas/links/">links</a></li>
         1380 <li><a href="http://w3m.sourceforge.net/">w3m</a></li>
         1381 <li><a href="https://git.codemadness.org/webdump/file/README.html">webdump</a></li>
         1382 </ul>
         1383 <p>It's easy to modify the color-theme by changing the macros in the source-code
         1384 or set a predefined theme at compile-time. The README file contains information
         1385 how to set a theme.  On the left a <a href="https://templeos.org/">TempleOS</a>-like color-theme on the right a
         1386 <a href="https://newsboat.org/">newsboat</a>-like colorscheme.</p>
         1387 <p><a href="downloads/screenshots/sfeed_curses_theme_screenshot.png"><img src="downloads/screenshots/sfeed_curses_theme_screenshot.png" alt="Screenshot showing a custom colorscheme" width="480" height="270" loading="lazy" /></a></p>
         1388 <p>It supports a vertical layout, horizontal and monocle (full-screen) layout.
         1389 This can be useful for different kind of screen sizes.  The keybinds '1', '2'
         1390 and '3' can be used to switch between these layouts.</p>
         1391 <p><a href="downloads/screenshots/sfeed_curses_horizontal_screenshot.png"><img src="downloads/screenshots/sfeed_curses_horizontal_screenshot.png" alt="Screenshot showing the horizontal layout" width="480" height="270" loading="lazy" /></a></p>
         1392 <h2>Clone</h2>
         1393 <pre><code>git clone git://git.codemadness.org/sfeed
         1394 </code></pre>
         1395 <h2>Browse</h2>
         1396 <p>You can browse the source-code at:</p>
         1397 <ul>
         1398 <li><a href="https://git.codemadness.org/sfeed/">https://git.codemadness.org/sfeed/</a></li>
         1399 <li><a href="gopher://codemadness.org/1/git/sfeed">gopher://codemadness.org/1/git/sfeed</a></li>
         1400 </ul>
         1401 <h2>Download releases</h2>
         1402 <p>Releases are available at:</p>
         1403 <ul>
         1404 <li><a href="https://codemadness.org/releases/sfeed/">https://codemadness.org/releases/sfeed/</a></li>
         1405 <li><a href="gopher://codemadness.org/1/releases/sfeed">gopher://codemadness.org/1/releases/sfeed</a></li>
         1406 </ul>
         1407 <h2>Build and install</h2>
         1408 <pre><code>$ make
         1409 # make install
         1410 </code></pre>
         1411 ]]></description>
         1412 </item>
         1413 <item>
         1414         <title>hurl: HTTP, HTTPS and Gopher file grabber</title>
         1415         <link>gopher://codemadness.org/1/phlog/hurl</link>
         1416         <guid>gopher://codemadness.org/1/phlog/hurl</guid>
         1417         <dc:date>2019-11-10T00:00:00Z</dc:date>
         1418         <author>Hiltjo</author>
         1419         <description><![CDATA[<h1>hurl: HTTP, HTTPS and Gopher file grabber</h1>
         1420         <p><strong>Last modification on </strong> <time>2020-07-20</time></p>
         1421         <p>hurl is a relatively simple HTTP, HTTPS and Gopher client/file grabber.</p>
         1422 <h2>Why?</h2>
         1423 <p>Sometimes (or most of the time?) you just want to fetch a file via the HTTP,
         1424 HTTPS or Gopher protocol.</p>
         1425 <p>The focus of this tool is only this.</p>
         1426 <h2>Features</h2>
         1427 <ul>
         1428 <li>Uses OpenBSD pledge(2) and unveil(2). Allow no filesystem access (writes to
         1429 stdout).</li>
         1430 <li>Impose time-out and maximum size limits.</li>
         1431 <li>Use well-defined exitcodes for reliable scripting (curl sucks at this).</li>
         1432 <li>Send as little information as possible (no User-Agent etc by default).</li>
         1433 </ul>
         1434 <h2>Anti-features</h2>
         1435 <ul>
         1436 <li>No HTTP byte range support.</li>
         1437 <li>No HTTP User-Agent.</li>
         1438 <li>No HTTP If-Modified-Since/If-* support.</li>
         1439 <li>No HTTP auth support.</li>
         1440 <li>No HTTP/2+ support.</li>
         1441 <li>No HTTP keep-alive.</li>
         1442 <li>No HTTP chunked-encoding support.</li>
         1443 <li>No HTTP redirect support.</li>
         1444 <li>No (GZIP) compression support.</li>
         1445 <li>No cookie-jar or cookie parsing support.</li>
         1446 <li>No Gopher text handling (".\r\n").</li>
         1447 <li>... etc...</li>
         1448 </ul>
         1449 <h2>Dependencies</h2>
         1450 <ul>
         1451 <li>C compiler (C99).</li>
         1452 <li>libc + some BSD functions like err() and strlcat().</li>
         1453 <li>LibreSSL(-portable)</li>
         1454 <li>libtls (part of LibreSSL).</li>
         1455 </ul>
         1456 <h2>Optional dependencies</h2>
         1457 <ul>
         1458 <li>POSIX make(1) (for Makefile).</li>
         1459 <li>mandoc for documentation: <a href="https://mdocml.bsd.lv/">https://mdocml.bsd.lv/</a></li>
         1460 </ul>
         1461 <h2>Clone</h2>
         1462 <pre><code>git clone git://git.codemadness.org/hurl
         1463 </code></pre>
         1464 <h2>Browse</h2>
         1465 <p>You can browse the source-code at:</p>
         1466 <ul>
         1467 <li><a href="https://git.codemadness.org/hurl/">https://git.codemadness.org/hurl/</a></li>
         1468 <li><a href="gopher://codemadness.org/1/git/hurl">gopher://codemadness.org/1/git/hurl</a></li>
         1469 </ul>
         1470 <h2>Download releases</h2>
         1471 <p>Releases are available at:</p>
         1472 <ul>
         1473 <li><a href="https://codemadness.org/releases/hurl/">https://codemadness.org/releases/hurl/</a></li>
         1474 <li><a href="gopher://codemadness.org/1/releases/hurl">gopher://codemadness.org/1/releases/hurl</a></li>
         1475 </ul>
         1476 <h2>Build and install</h2>
         1477 <pre><code>$ make
         1478 # make install
         1479 </code></pre>
         1480 <h2>Examples</h2>
         1481 <p>Fetch the Atom feed from this site using a maximum filesize limit of 1MB and
         1482 a time-out limit of 15 seconds:</p>
         1483 <pre><code>hurl -m 1048576 -t 15 "https://codemadness.org/atom.xml"
         1484 </code></pre>
         1485 <p>There is an -H option to add custom headers. This way some of the anti-features
         1486 listed above are supported. For example some CDNs like Cloudflare are known to
         1487 block empty or certain User-Agents.</p>
         1488 <p>User-Agent:</p>
         1489 <pre><code>hurl -H 'User-Agent: some browser' 'https://codemadness.org/atom.xml'
         1490 </code></pre>
         1491 <p>HTTP Basic Auth (base64-encoded username:password):</p>
         1492 <pre><code>hurl -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
         1493         'https://codemadness.org/atom.xml'
         1494 </code></pre>
         1495 <p>GZIP (this assumes the served response Content-Type is gzip):</p>
         1496 <pre><code>hurl -H 'Accept-Encoding: gzip' 'https://somesite/' | gzip -d
         1497 </code></pre>
         1498 ]]></description>
         1499 </item>
         1500 <item>
         1501         <title>json2tsv: a JSON to TSV converter</title>
         1502         <link>gopher://codemadness.org/1/phlog/json2tsv</link>
         1503         <guid>gopher://codemadness.org/1/phlog/json2tsv</guid>
         1504         <dc:date>2019-10-13T00:00:00Z</dc:date>
         1505         <author>Hiltjo</author>
         1506         <description><![CDATA[<h1>json2tsv: a JSON to TSV converter</h1>
         1507         <p><strong>Last modification on </strong> <time>2021-09-25</time></p>
         1508         <p>Convert JSON to TSV or separated output.</p>
         1509 <p>json2tsv reads JSON data from stdin.  It outputs each JSON type to a TAB-
         1510 Separated Value format per line by default.</p>
         1511 <h2>TAB-Separated Value format</h2>
         1512 <p>The output format per line is:</p>
         1513 <pre><code>nodename&lt;TAB&gt;type&lt;TAB&gt;value&lt;LF&gt;
         1514 </code></pre>
         1515 <p>Control-characters such as a newline, TAB and backslash (\n, \t and \) are
         1516 escaped in the nodename and value fields.  Other control-characters are
         1517 removed.</p>
         1518 <p>The type field is a single byte and can be:</p>
         1519 <ul>
         1520 <li>a for array</li>
         1521 <li>b for bool</li>
         1522 <li>n for number</li>
         1523 <li>o for object</li>
         1524 <li>s for string</li>
         1525 <li>? for null</li>
         1526 </ul>
         1527 <p>Filtering on the first field "nodename" is easy using awk for example.</p>
         1528 <h2>Features</h2>
         1529 <ul>
         1530 <li>Accepts all <strong>valid</strong> JSON.</li>
         1531 <li>Designed to work well with existing UNIX programs like awk and grep.</li>
         1532 <li>Straightforward and not much lines of code: about 475 lines of C.</li>
         1533 <li>Few dependencies: C compiler (C99), libc.</li>
         1534 <li>No need to learn a new (meta-)language for processing data.</li>
         1535 <li>The parser supports code point decoding and UTF-16 surrogates to UTF-8.</li>
         1536 <li>It does not output control-characters to the terminal for security reasons by
         1537 default (but it has a -r option if needed).</li>
         1538 <li>On OpenBSD it supports <a href="https://man.openbsd.org/pledge">pledge(2)</a> for syscall restriction:
         1539 pledge("stdio", NULL).</li>
         1540 <li>Supports setting a different field separator and record separator with the -F
         1541 and -R option.</li>
         1542 </ul>
         1543 <h2>Cons</h2>
         1544 <ul>
         1545 <li>For the tool there is additional overhead by processing and filtering data
         1546 from stdin after parsing.</li>
         1547 <li>The parser does not do complete validation on numbers.</li>
         1548 <li>The parser accepts some bad input such as invalid UTF-8
         1549 (see <a href="https://tools.ietf.org/html/rfc8259#section-8.1">RFC8259 - 8.1. Character Encoding</a>).
         1550 json2tsv reads from stdin and does not do assumptions about a "closed
         1551 ecosystem" as described in the RFC.</li>
         1552 <li>The parser accepts some bad JSON input and "extensions"
         1553 (see <a href="https://tools.ietf.org/html/rfc8259#section-9">RFC8259 - 9. Parsers</a>).</li>
         1554 <li>Encoded NUL bytes (\u0000) in strings are ignored.
         1555 (see <a href="https://tools.ietf.org/html/rfc8259#section-9">RFC8259 - 9. Parsers</a>).
         1556 "An implementation may set limits on the length and character contents of
         1557 strings."</li>
         1558 <li>The parser is not the fastest possible JSON parser (but also not the
         1559 slowest).  For example: for ease of use, at the cost of performance all
         1560 strings are decoded, even though they may be unused.</li>
         1561 </ul>
         1562 <h2>Why Yet Another JSON parser?</h2>
         1563 <p>I wanted a tool that makes parsing JSON easier and work well from the shell,
         1564 similar to <a href="https://stedolan.github.io/jq/">jq</a>.</p>
         1565 <p>sed and grep often work well enough for matching some value using some regex
         1566 pattern, but it is not good enough to parse JSON correctly or to extract all
         1567 information: just like parsing HTML/XML using some regex is not good (enough)
         1568 or a good idea :P.</p>
         1569 <p>I didn't want to learn a new specific <a href="https://stedolan.github.io/jq/manual/#Builtinoperatorsandfunctions">meta-language</a> which jq has and wanted
         1570 something simpler.</p>
         1571 <p>While it is more efficient to embed this query language for data aggregation,
         1572 it is also less simple. In my opinion it is simpler to separate this and use
         1573 pattern-processing by awk or an other filtering/aggregating program.</p>
         1574 <p>For the parser, there are many JSON parsers out there, like the efficient
         1575 <a href="https://github.com/zserge/jsmn">jsmn parser</a>, however a few parser behaviours I want to have are:</p>
         1576 <ul>
         1577 <li>jsmn buffers data as tokens, which is very efficient, but also a bit
         1578 annoying as an API as it requires another layer of code to interpret the
         1579 tokens.</li>
         1580 <li>jsmn does not handle decoding strings by default. Which is very efficient
         1581 if you don't need parts of the data though.</li>
         1582 <li>jsmn does not keep context of nested structures by default, so may require
         1583 writing custom utility functions for nested data.</li>
         1584 </ul>
         1585 <p>This is why I went for a parser design that uses a single callback per "node"
         1586 type and keeps track of the current nested structure in a single array and
         1587 emits that.</p>
         1588 <h2>Clone</h2>
         1589 <pre><code>git clone git://git.codemadness.org/json2tsv
         1590 </code></pre>
         1591 <h2>Browse</h2>
         1592 <p>You can browse the source-code at:</p>
         1593 <ul>
         1594 <li><a href="https://git.codemadness.org/json2tsv/">https://git.codemadness.org/json2tsv/</a></li>
         1595 <li><a href="gopher://codemadness.org/1/git/json2tsv">gopher://codemadness.org/1/git/json2tsv</a></li>
         1596 </ul>
         1597 <h2>Download releases</h2>
         1598 <p>Releases are available at:</p>
         1599 <ul>
         1600 <li><a href="https://codemadness.org/releases/json2tsv/">https://codemadness.org/releases/json2tsv/</a></li>
         1601 <li><a href="gopher://codemadness.org/1/releases/json2tsv">gopher://codemadness.org/1/releases/json2tsv</a></li>
         1602 </ul>
         1603 <h2>Build and install</h2>
         1604 <pre><code>$ make
         1605 # make install
         1606 </code></pre>
         1607 <h2>Examples</h2>
         1608 <p>An usage example to parse posts of the JSON API of <a href="https://www.reddit.com/">reddit.com</a> and format them
         1609 to a plain-text list using awk:</p>
         1610 <pre><code>#!/bin/sh
         1611 curl -s -H 'User-Agent:' 'https://old.reddit.com/.json?raw_json=1&amp;limit=100' | \
         1612 json2tsv | \
         1613 awk -F '\t' '
         1614 function show() {
         1615         if (length(o["title"]) == 0)
         1616                 return;
         1617         print n ". " o["title"] " by " o["author"] " in r/" o["subreddit"];
         1618         print o["url"];
         1619         print "";
         1620 }
         1621 $1 == ".data.children[].data" {
         1622         show();
         1623         n++;
         1624         delete o;
         1625 }
         1626 $1 ~ /^\.data\.children\[\]\.data\.[a-zA-Z0-9_]*$/ {
         1627         o[substr($1, 23)] = $3;
         1628 }
         1629 END {
         1630         show();
         1631 }'
         1632 </code></pre>
         1633 <h2>References</h2>
         1634 <ul>
         1635 <li>Sites:
         1636 <ul>
         1637 <li><a href="http://seriot.ch/parsing_json.php">seriot.ch - Parsing JSON is a Minefield</a></li>
         1638 <li><a href="https://github.com/nst/JSONTestSuite">A comprehensive test suite for RFC 8259 compliant JSON parsers</a></li>
         1639 <li><a href="https://json.org/">json.org</a></li>
         1640 </ul>
         1641 </li>
         1642 <li>Current standard:
         1643 <ul>
         1644 <li><a href="https://tools.ietf.org/html/rfc8259">RFC8259 - The JavaScript Object Notation (JSON) Data Interchange Format</a></li>
         1645 <li><a href="https://www.ecma-international.org/publications/standards/Ecma-404.htm">Standard ECMA-404 - The JSON Data Interchange Syntax (2nd edition (December 2017)</a></li>
         1646 </ul>
         1647 </li>
         1648 <li>Historic standards:
         1649 <ul>
         1650 <li><a href="https://tools.ietf.org/html/rfc7159">RFC7159 - The JavaScript Object Notation (JSON) Data Interchange Format (obsolete)</a></li>
         1651 <li><a href="https://tools.ietf.org/html/rfc7158">RFC7158 - The JavaScript Object Notation (JSON) Data Interchange Format (obsolete)</a></li>
         1652 <li><a href="https://tools.ietf.org/html/rfc4627">RFC4627 - The JavaScript Object Notation (JSON) Data Interchange Format (obsolete, original)</a></li>
         1653 </ul>
         1654 </li>
         1655 </ul>
         1656 ]]></description>
         1657 </item>
         1658 <item>
         1659         <title>OpenBSD: setup a local auto-installation server</title>
         1660         <link>gopher://codemadness.org/1/phlog/openbsd-autoinstall</link>
         1661         <guid>gopher://codemadness.org/1/phlog/openbsd-autoinstall</guid>
         1662         <dc:date>2019-04-24T00:00:00Z</dc:date>
         1663         <author>Hiltjo</author>
         1664         <description><![CDATA[<h1>OpenBSD: setup a local auto-installation server</h1>
         1665         <p><strong>Last modification on </strong> <time>2020-04-30</time></p>
         1666         <p>This guide describes how to setup a local mirror and installation/upgrade
         1667 server that requires little or no input interaction.</p>
         1668 <h2>Setup a local HTTP mirror</h2>
         1669 <p>The HTTP mirror will be used to fetch the base sets and (optional) custom sets.
         1670 In this guide we will assume <strong>192.168.0.2</strong> is the local installation server
         1671 and mirror, the CPU architecture is amd64 and the OpenBSD release version is
         1672 6.5.  We will store the files in the directory with the structure:</p>
         1673 <pre><code>http://192.168.0.2/pub/OpenBSD/6.5/amd64/
         1674 </code></pre>
         1675 <p>Create the www serve directory and fetch all sets and install files
         1676 (if needed to save space *.iso and install65.fs can be skipped):</p>
         1677 <pre><code>$ cd /var/www/htdocs
         1678 $ mkdir -p pub/OpenBSD/6.5/amd64/
         1679 $ cd pub/OpenBSD/6.5/amd64/
         1680 $ ftp 'ftp://ftp.nluug.nl/pub/OpenBSD/6.5/amd64/*'
         1681 </code></pre>
         1682 <p>Verify signature and check some checksums:</p>
         1683 <pre><code>$ signify -C -p /etc/signify/openbsd-65-base.pub -x SHA256.sig
         1684 </code></pre>
         1685 <p>Setup <a href="https://man.openbsd.org/httpd.8">httpd(8)</a> for simple file serving:</p>
         1686 <pre><code># $FAVORITE_EDITOR /etc/httpd.conf
         1687 </code></pre>
         1688 <p>A minimal example config for <a href="https://man.openbsd.org/httpd.conf.5">httpd.conf(5)</a>:</p>
         1689 <pre><code>server "*" {
         1690         listen on * port 80
         1691 }
         1692 </code></pre>
         1693 <p>The default www root directory is: /var/www/htdocs/</p>
         1694 <p>Enable the httpd daemon to start by default and start it now:</p>
         1695 <pre><code># rcctl enable httpd
         1696 # rcctl start httpd
         1697 </code></pre>
         1698 <h2>Creating an installation response/answer file</h2>
         1699 <p>The installer supports loading responses to the installation/upgrade questions
         1700 from a simple text file. We can do a regular installation and copy the answers
         1701 from the saved file to make an automated version of it.</p>
         1702 <p>Do a test installation, at the end of the installation or upgrade when asked the
         1703 question:</p>
         1704 <pre><code>Exit to (S)hell, (H)alt or (R)eboot?
         1705 </code></pre>
         1706 <p>Type S to go to the shell. Find the response file for an installation and copy
         1707 it to some USB stick or write down the response answers:</p>
         1708 <pre><code>cp /tmp/i/install.resp /mnt/usbstick/
         1709 </code></pre>
         1710 <p>A response file could be for example:</p>
         1711 <pre><code>System hostname = testvm
         1712 Which network interface do you wish to configure = em0
         1713 IPv4 address for em0 = dhcp
         1714 IPv6 address for em0 = none
         1715 Which network interface do you wish to configure = done
         1716 Password for root account = $2b$10$IqI43aXjgD55Q3nLbRakRO/UAG6SAClL9pyk0vIUpHZSAcLx8fWk.
         1717 Password for user testuser = $2b$10$IqI43aXjgD55Q3nLbRakRO/UAG6SAClL9pyk0vIUpHZSAcLx8fWk.
         1718 Start sshd(8) by default = no
         1719 Do you expect to run the X Window System = no
         1720 Setup a user = testuser
         1721 Full name for user testuser = testuser
         1722 What timezone are you in = Europe/Amsterdam
         1723 Which disk is the root disk = wd0
         1724 Use (W)hole disk MBR, whole disk (G)PT, (O)penBSD area or (E)dit = OpenBSD
         1725 Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout = a
         1726 Location of sets = http
         1727 HTTP proxy URL = none
         1728 HTTP Server = 192.168.0.2
         1729 Server directory = pub/OpenBSD/6.5/amd64
         1730 Unable to connect using https. Use http instead = yes
         1731 Location of sets = http
         1732 Set name(s) = done
         1733 Location of sets = done
         1734 Exit to (S)hell, (H)alt or (R)eboot = R
         1735 </code></pre>
         1736 <p>Get custom encrypted password for response file:</p>
         1737 <pre><code>$ printf '%s' 'yourpassword' | encrypt
         1738 </code></pre>
         1739 <h2>Changing the RAMDISK kernel disk image</h2>
         1740 <p><a href="https://man.openbsd.org/rdsetroot.8">rdsetroot(8)</a> is publicly exposed now in base since 6.5. Before 6.5 it is
         1741 available in the /usr/src/ tree as elfrdsetroot, see also the <a href="https://man.openbsd.org/rd.4">rd(4)</a> man page.</p>
         1742 <pre><code>$ mkdir auto
         1743 $ cd auto
         1744 $ cp pubdir/bsd.rd .
         1745 $ rdsetroot -x bsd.rd disk.fs
         1746 # vnconfig vnd0 disk.fs
         1747 # mkdir mount
         1748 # mount /dev/vnd0a mount
         1749 </code></pre>
         1750 <p>Copy the response file (install.resp) to: mount/auto_install.conf
         1751 (installation) <strong>or</strong> mount/auto_upgrade.conf (upgrade), but not both. In this
         1752 guide we will do an auto-installation.</p>
         1753 <p>Unmount, detach and patch RAMDISK:</p>
         1754 <pre><code># umount mount
         1755 # vnconfig -u vnd0
         1756 $ rdsetroot bsd.rd disk.fs
         1757 </code></pre>
         1758 <p>To test copy bsd.rd to the root of some testmachine like /bsd.test.rd then
         1759 (re)boot and type:</p>
         1760 <pre><code>boot /bsd.test.rd
         1761 </code></pre>
         1762 <p>In the future (6.5+) it will be possible to copy to a file named "/bsd.upgrade"
         1763 in the root of a current system and automatically load the kernel:
         1764 <a href="https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/stand/boot/boot.c?rev=1.46&amp;content-type=text/x-cvsweb-markup">See the script bsd.upgrade in CVS.</a>
         1765 Of course this is possible with PXE boot or some custom USB/ISO also.
         1766 As explained in the <a href="https://man.openbsd.org/autoinstall.8">autoinstall(8)</a> man page: create either an
         1767 auto_upgrade.conf <strong>or</strong> an auto_install.conf, but not both.</p>
         1768 <h2>Create bootable miniroot</h2>
         1769 <p>In this example the miniroot will boot the custom kernel, but fetch all the
         1770 sets from the local network.</p>
         1771 <p>We will base our miniroot of the official version: miniroot65.fs.</p>
         1772 <p>We will create a 16MB miniroot to boot from (in this guide it is assumed the
         1773 original miniroot is about 4MB and the modified kernel image fits in the new
         1774 allocated space):</p>
         1775 <pre><code>$ dd if=/dev/zero of=new.fs bs=512 count=32768
         1776 </code></pre>
         1777 <p>Copy first part of the original image to the new disk (no truncation):</p>
         1778 <pre><code>$ dd conv=notrunc if=miniroot65.fs of=new.fs
         1779 # vnconfig vnd0 new.fs
         1780 </code></pre>
         1781 <p>Expand disk OpenBSD boundaries:</p>
         1782 <pre><code># disklabel -E vnd0
         1783 &gt; b
         1784 Starting sector: [1024]
         1785 Size ('*' for entire disk): [8576] *
         1786 &gt; r
         1787 Total free sectors: 1168.
         1788 &gt; c a
         1789 Partition a is currently 8576 sectors in size, and can have a maximum
         1790 size of 9744 sectors.
         1791 size: [8576] *
         1792 &gt; w
         1793 &gt; q
         1794 </code></pre>
         1795 <p>or:</p>
         1796 <pre><code># printf 'b\n\n*\nc a\n*\nw\n' | disklabel -E vnd0
         1797 </code></pre>
         1798 <p>Grow filesystem and check it and mark as clean:</p>
         1799 <pre><code># growfs -y /dev/vnd0a
         1800 # fsck -y /dev/vnd0a
         1801 </code></pre>
         1802 <p>Mount filesystem:</p>
         1803 <pre><code># mount /dev/vnd0a mount/
         1804 </code></pre>
         1805 <p>The kernel on the miniroot is GZIP compressed. Compress our modified bsd.rd and
         1806 overwrite the original kernel:</p>
         1807 <pre><code># gzip -c9n bsd.rd &gt; mount/bsd
         1808 </code></pre>
         1809 <p>Or to save space (+- 500KB) by stripping debug symbols, taken from bsd.gz target
         1810 <a href="https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/distrib/amd64/iso/Makefile">in this Makefile</a>.</p>
         1811 <pre><code>$ cp bsd.rd bsd.strip
         1812 $ strip bsd.strip
         1813 $ strip -R .comment -R .SUNW_ctf bsd.strip
         1814 $ gzip -c9n bsd.strip &gt; bsd.gz
         1815 $ cp bsd.gz mount/bsd
         1816 </code></pre>
         1817 <p>Now unmount and detach:</p>
         1818 <pre><code># umount mount/
         1819 # vnconfig -u vnd0
         1820 </code></pre>
         1821 <p>Now you can <a href="https://man.openbsd.org/dd.1">dd(1)</a> the image new.fs to your bootable (USB) medium.</p>
         1822 <h2>Adding custom sets (optional)</h2>
         1823 <p>For patching <a href="https://man.openbsd.org/rc.firsttime.8">/etc/rc.firsttime</a> and other system files it is useful to use a
         1824 customized installation set like siteVERSION.tgz, for example: site65.tgz.  The
         1825 sets can even be specified per host/MAC address like
         1826 siteVERSION-$(hostname -s).tgz so for example: site65-testvm.tgz</p>
         1827 <p>When the installer checks the base sets of the mirror it looks for a file
         1828 index.txt.  To add custom sets the site entries have to be added.</p>
         1829 <p>For example:</p>
         1830 <pre><code>-rw-r--r--  1 1001  0    4538975 Oct 11 13:58:26 2018 site65-testvm.tgz
         1831 </code></pre>
         1832 <p>The filesize, permissions etc do not matter and are not checked by the
         1833 installer.  Only the filename is matched by a regular expression.</p>
         1834 <h2>Sign custom site* tarball sets (optional)</h2>
         1835 <p>If you have custom sets without creating a signed custom release you will be
         1836 prompted for the messages:</p>
         1837 <pre><code>checksum test failed
         1838 </code></pre>
         1839 <p>and:</p>
         1840 <pre><code>unverified sets: continue without verification
         1841 </code></pre>
         1842 <p>OpenBSD uses the program <a href="https://man.openbsd.org/signify.1">signify(1)</a> to cryptographically sign and
         1843 verify filesets.</p>
         1844 <p>To create a custom public/private keypair (ofcourse make sure to store the
         1845 private key privately):</p>
         1846 <pre><code>$ signify -G -n -c "Custom 6.5 install" -p custom-65-base.pub -s custom-65-base.sec
         1847 </code></pre>
         1848 <p>Create new checksum file with filelist of the current directory (except SHA256*
         1849 files):</p>
         1850 <pre><code>$ printf '%s\n' * | grep -v SHA256 | xargs sha256 &gt; SHA256
         1851 </code></pre>
         1852 <p>Sign SHA256 and store as SHA256.sig, embed signature:</p>
         1853 <pre><code>$ signify -S -e -s /privatedir/custom-65-base.sec -m SHA256 -x SHA256.sig
         1854 </code></pre>
         1855 <p>Verify the created signature and data is correct:</p>
         1856 <pre><code>$ signify -C -p /somelocation/custom-65-base.pub -x SHA256.sig
         1857 </code></pre>
         1858 <p>Copy <strong>only</strong> the <strong>public</strong> key to the RAMDISK:</p>
         1859 <pre><code>$ cp custom-65-base.pub mount/etc/signify/custom-65-base.pub
         1860 </code></pre>
         1861 <p>Now we have to patch the install.sub file to check our public key.  If you know
         1862 a better way without having to patch this script, please let me know.</p>
         1863 <p>Change the variable PUB_KEY in the shellscript mount/install.sub from:</p>
         1864 <pre><code>PUB_KEY=/etc/signify/openbsd-${VERSION}-base.pub
         1865 </code></pre>
         1866 <p>To:</p>
         1867 <pre><code>PUB_KEY=/etc/signify/custom-${VERSION}-base.pub
         1868 </code></pre>
         1869 <p>And for upgrades from:</p>
         1870 <pre><code>$UPGRADE_BSDRD &amp;&amp;
         1871         PUB_KEY=/mnt/etc/signify/openbsd-$((VERSION + 1))-base.pub
         1872 </code></pre>
         1873 <p>To:</p>
         1874 <pre><code>$UPGRADE_BSDRD &amp;&amp;
         1875         PUB_KEY=/mnt/etc/signify/custom-$((VERSION + 1))-base.pub
         1876 </code></pre>
         1877 <h2>Ideas</h2>
         1878 <ul>
         1879 <li>Patch <a href="https://man.openbsd.org/rc.firsttime.8">rc.firsttime(8)</a>: and run syspatch, add ports, setup xenodm etc.</li>
         1880 <li>Custom partitioning scheme, see <a href="https://man.openbsd.org/autoinstall.8">autoinstall(8)</a> "URL to autopartitioning
         1881 template for disklabel = url".</li>
         1882 <li>Setup <a href="https://man.openbsd.org/pxeboot.8">pxeboot(8)</a> to boot and install over the network using
         1883 <a href="https://man.openbsd.org/dhcpd.8">dhcpd(8)</a> and
         1884 <a href="https://man.openbsd.org/tftpd.8">tftpd(8)</a> then not even some USB stick is required.</li>
         1885 </ul>
         1886 <h2>References</h2>
         1887 <ul>
         1888 <li>Main OpenBSD installation and upgrade shellscript:
         1889 <a href="https://cvsweb.openbsd.org/src/distrib/miniroot/install.sub">/usr/src/distrib/miniroot/install.sub</a></li>
         1890 </ul>
         1891 ]]></description>
         1892 </item>
         1893 <item>
         1894         <title>Idiotbox: Youtube interface</title>
         1895         <link>gopher://codemadness.org/1/phlog/idiotbox</link>
         1896         <guid>gopher://codemadness.org/1/phlog/idiotbox</guid>
         1897         <dc:date>2019-02-10T00:00:00Z</dc:date>
         1898         <author>Hiltjo</author>
         1899         <description><![CDATA[<h1>Idiotbox: Youtube interface</h1>
         1900         <p><strong>Last modification on </strong> <time>2021-12-25</time></p>
         1901         <p>Idiotbox is a less resource-heavy Youtube interface.  For viewing videos it is
         1902 recommended to use it with <a href="https://mpv.io/">mpv</a> or
         1903 <a href="https://mplayerhq.hu/">mplayer</a> with
         1904 <a href="https://youtube-dl.org/">youtube-dl</a> or
         1905 <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a>.</p>
         1906 <p>For more (up-to-date) information see the <a href="/git/frontends/file/youtube/README.html">README</a> file.</p>
         1907 <h2>Why</h2>
         1908 <p>In my opinion the standard Youtube web interface is:</p>
         1909 <ul>
         1910 <li>Non-intuitive, too much visual crap.</li>
         1911 <li>Too resource-hungry, both in CPU and bandwidth.</li>
         1912 <li>Doesn't work well on simpler (text-based) browsers such as netsurf and links.</li>
         1913 </ul>
         1914 <h2>Features</h2>
         1915 <ul>
         1916 <li>Doesn't use JavaScript.</li>
         1917 <li>Doesn't use (tracking) cookies.</li>
         1918 <li>CSS is optional.</li>
         1919 <li>Multiple interfaces available: HTTP CGI, command-line, Gopher CGI (gph),
         1920 this is a work-in-progress.</li>
         1921 <li>Doesn't use or require the Google API.</li>
         1922 <li>CGI interface works nice in most browsers, including text-based ones.</li>
         1923 <li>On OpenBSD it runs "sandboxed" and it can be compiled as a static-linked
         1924 binary with <a href="https://man.openbsd.org/pledge">pledge(2)</a>,
         1925 <a href="https://man.openbsd.org/unveil">unveil(2)</a> in a chroot.</li>
         1926 </ul>
         1927 <h2>Cons</h2>
         1928 <ul>
         1929 <li>Order by upload date is incorrect (same as on Youtube).</li>
         1930 <li>Some Youtube features are not supported.</li>
         1931 <li>Uses scraping so might break at any point.</li>
         1932 </ul>
         1933 <h2>Clone</h2>
         1934 <pre><code>git clone git://git.codemadness.org/frontends
         1935 </code></pre>
         1936 <h2>Browse</h2>
         1937 <p>You can browse the source-code at:</p>
         1938 <ul>
         1939 <li><a href="https://git.codemadness.org/frontends/">https://git.codemadness.org/frontends/</a></li>
         1940 <li><a href="gopher://codemadness.org/1/git/frontends">gopher://codemadness.org/1/git/frontends</a></li>
         1941 </ul>
         1942 <h2>Download releases</h2>
         1943 <p>Releases are available at:</p>
         1944 <ul>
         1945 <li><a href="https://codemadness.org/releases/frontends/">https://codemadness.org/releases/frontends/</a></li>
         1946 <li><a href="gopher://codemadness.org/1/releases/frontends">gopher://codemadness.org/1/releases/frontends</a></li>
         1947 </ul>
         1948 <h2>View</h2>
         1949 <p>You can view it here: <a href="https://codemadness.org/idiotbox/">https://codemadness.org/idiotbox/</a></p>
         1950 <p>For example you can search using the query string parameter "q":
         1951 <a href="https://codemadness.org/idiotbox/?q=gunther+tralala">https://codemadness.org/idiotbox/?q=gunther+tralala</a></p>
         1952 <p>The gopher version is here: <a href="gopher://codemadness.org/7/idiotbox.cgi">gopher://codemadness.org/7/idiotbox.cgi</a></p>
         1953 ]]></description>
         1954 </item>
         1955 <item>
         1956         <title>Gopher HTTP proxy</title>
         1957         <link>gopher://codemadness.org/1/phlog/gopher-proxy</link>
         1958         <guid>gopher://codemadness.org/1/phlog/gopher-proxy</guid>
         1959         <dc:date>2018-08-17T00:00:00Z</dc:date>
         1960         <author>Hiltjo</author>
         1961         <description><![CDATA[<h1>Gopher HTTP proxy</h1>
         1962         <p><strong>Last modification on </strong> <time>2020-08-30</time></p>
         1963         <p>For fun I wrote a small HTTP Gopher proxy CGI program in C. It only supports
         1964 the basic Gopher types and has some restrictions to prevent some abuse.</p>
         1965 <p>For your regular Gopher browsing I recommend the simple Gopher client <a href="https://git.fifth.space/sacc/">sacc</a>.</p>
         1966 <p>For more information about Gopher check out <a href="http://gopherproject.org/">gopherproject.org</a>.</p>
         1967 <h2>Clone</h2>
         1968 <pre><code>git clone git://git.codemadness.org/gopherproxy-c
         1969 </code></pre>
         1970 <h2>Browse</h2>
         1971 <p>You can browse the source-code at:</p>
         1972 <ul>
         1973 <li><a href="https://git.codemadness.org/gopherproxy-c/">https://git.codemadness.org/gopherproxy-c/</a></li>
         1974 <li><a href="gopher://codemadness.org/1/git/gopherproxy-c">gopher://codemadness.org/1/git/gopherproxy-c</a></li>
         1975 </ul>
         1976 <h2>View</h2>
         1977 <p>You can view it here:
         1978 <a href="https://codemadness.org/gopherproxy/">https://codemadness.org/gopherproxy/</a></p>
         1979 <p>For example you can also view my gopherhole using the proxy, the query string
         1980 parameter "q" reads the URI:
         1981 <a href="https://codemadness.org/gopherproxy/?q=codemadness.org">https://codemadness.org/gopherproxy/?q=codemadness.org</a></p>
         1982 <p><strong>Due to abuse this service is (temporary) disabled, but of course you can self-host it</strong></p>
         1983 <p><strong>For authors writing crawler bots: please respect robots.txt, HTTP status codes and test your code properly</strong></p>
         1984 ]]></description>
         1985 </item>
         1986 <item>
         1987         <title>Setup your own file paste service</title>
         1988         <link>gopher://codemadness.org/1/phlog/paste-service</link>
         1989         <guid>gopher://codemadness.org/1/phlog/paste-service</guid>
         1990         <dc:date>2018-03-10T00:00:00Z</dc:date>
         1991         <author>Hiltjo</author>
         1992         <description><![CDATA[<h1>Setup your own file paste service</h1>
         1993         <p><strong>Last modification on </strong> <time>2018-03-10</time></p>
         1994         <h2>Setup SSH authentication</h2>
         1995 <p>Make sure to setup SSH public key authentication so you don't need to enter a
         1996 password each time and have a more secure authentication.</p>
         1997 <p>For example in the file $HOME/.ssh/config:</p>
         1998 <pre><code>Host codemadness
         1999         Hostname codemadness.org
         2000         Port 22
         2001         IdentityFile ~/.ssh/codemadness/id_rsa
         2002 </code></pre>
         2003 <p>Of course also make sure to generate the private and public keys.</p>
         2004 <h2>Shell alias</h2>
         2005 <p>Make an alias or function in your shell config:</p>
         2006 <pre><code>pastesrv() {
         2007         ssh user@codemadness "cat &gt; /your/www/publicdir/paste/$1"
         2008         echo "https://codemadness.org/paste/$1"
         2009 }
         2010 </code></pre>
         2011 <p>This function reads any data from stdin and transfers the output securely via
         2012 SSH and writes it to a file at the specified path. This path can be visible via
         2013 HTTP, gopher or an other protocol. Then it writes the absolute URL to stdout,
         2014 this URL can be copied to the clipboard and pasted anywhere like to an e-mail,
         2015 IRC etc.</p>
         2016 <h2>Usage and examples</h2>
         2017 <p>To use it, here are some examples:</p>
         2018 <p>Create a patch of the last commit in the git repo and store it:</p>
         2019 <pre><code>git format-patch --stdout HEAD^ | pastesrv 'somepatch.diff'
         2020 </code></pre>
         2021 <p>Create a screenshot of your current desktop and paste it:</p>
         2022 <pre><code>xscreenshot | ff2png | pastesrv 'screenshot.png'
         2023 </code></pre>
         2024 <p>There are many other uses of course, use your imagination :)</p>
         2025 ]]></description>
         2026 </item>
         2027 <item>
         2028         <title>Setup your own git hosting service</title>
         2029         <link>gopher://codemadness.org/1/phlog/setup-git-hosting</link>
         2030         <guid>gopher://codemadness.org/1/phlog/setup-git-hosting</guid>
         2031         <dc:date>2018-02-25T00:00:00Z</dc:date>
         2032         <author>Hiltjo</author>
         2033         <description><![CDATA[<h1>Setup your own git hosting service</h1>
         2034         <p><strong>Last modification on </strong> <time>2022-08-07</time></p>
         2035         <p><strong>This article assumes you use OpenBSD for the service files and OS-specific
         2036 examples.</strong></p>
         2037 <h2>Why</h2>
         2038 <p>A good reason to host your own git repositories is because of having and
         2039 keeping control over your own computing infrastructure.</p>
         2040 <p>Some bad examples:</p>
         2041 <ul>
         2042 <li><a href="https://en.wikipedia.org/wiki/SourceForge#Controversies">The SourceForge ads/malware/hijack controversies. Injecting malware into projects</a>.</li>
         2043 <li><a href="https://gitlab.com/gitlab-org/gitaly/issues/2113">As of 2019-10-23 Gitlab added telemetry to their software</a>.</li>
         2044 <li><a href="https://about.gitlab.com/blog/2019/10/10/update-free-software-and-telemetry/">On 2019-10-24 Gitlab reverted it again because many people complained</a>.</li>
         2045 <li><a href="https://github.blog/2020-11-16-standing-up-for-developers-youtube-dl-is-back/">On 2020-11-16 Github reinstated youtube-dl, to reverse a Digital Millennium Copyright Act (DMCA) takedown</a>.</li>
         2046 <li><a href="https://arstechnica.com/gadgets/2021/03/critics-fume-after-github-removes-exploit-code-for-exchange-vulnerabilities/">On 2021-03-11 Github (owned by Microsoft) removes exploit code for Microsoft Exchange vulnerabilities</a>.</li>
         2047 <li><a href="https://www.bleepingcomputer.com/news/security/github-suspends-accounts-of-russian-devs-at-sanctioned-companies/">On 2022-04-16 Russian software developers are reporting that their GitHub accounts are being suspended without warning if they work for or previously worked for companies under US sanctions</a>.</li>
         2048 <li><a href="https://www.theregister.com/2022/08/04/gitlab_data_retention_policy/">On 2022-08-04 GitLab plans to delete dormant projects in free accounts</a>.</li>
         2049 <li><a href="https://www.theregister.com/2022/08/05/gitlab_reverses_deletion_policy/">On 2022-08-05 GitLab U-turns on deleting dormant projects after backlash</a>.</li>
         2050 </ul>
         2051 <p>The same thing can happen with Github, Atlassian Bitbucket or other similar
         2052 services.  After all: they are just a company with commercial interests.  These
         2053 online services also have different pricing plans and various (arbitrary)
         2054 restrictions.  When you host it yourself the restrictions are the resource
         2055 limits of the system and your connection, therefore it is a much more flexible
         2056 solution.</p>
         2057 <p>Always make sure you own the software (which is <a href="https://www.gnu.org/philosophy/free-sw.html">Free</a> or open-source) and you
         2058 can host it yourself, so you will be in control of it.</p>
         2059 <h2>Creating repositories</h2>
         2060 <p>For the hosting it is recommended to use a so-called "bare" repository.  A bare
         2061 repository means no files are checked out in the folder itself.  To create a
         2062 bare repository use git init with the --bare argument:</p>
         2063 <pre><code>$ git init --bare
         2064 </code></pre>
         2065 <p>I recommend to create a separate user and group for the source-code
         2066 repositories.  In the examples we will assume the user is called "src".</p>
         2067 <p>Login as the src user and create the files. To create a directory for the
         2068 repos, in this example /home/src/src:</p>
         2069 <pre><code>$ mkdir -p /home/src/src
         2070 $ cd /home/src/src
         2071 $ git init --bare someproject
         2072 $ $EDITOR someproject/description
         2073 </code></pre>
         2074 <p>Make sure the git-daemon process has access permissions to these repositories.</p>
         2075 <h2>Install git-daemon (optional)</h2>
         2076 <p>Using git-daemon you can clone the repositories publicly using the efficient
         2077 git:// protocol. An alternative without having to use git-daemon is by using
         2078 (anonymous) SSH, HTTPS or any public shared filesystem.</p>
         2079 <p>When you use a private-only repository I recommend to just use SSH without
         2080 git-daemon because it is secure.</p>
         2081 <p>Install the git package. The package should contain "git daemon":</p>
         2082 <pre><code># pkg_add git
         2083 </code></pre>
         2084 <p>Enable the daemon:</p>
         2085 <pre><code># rcctl enable gitdaemon
         2086 </code></pre>
         2087 <p>Set the gitdaemon service flags to use the src directory and use all the
         2088 available repositories in this directory. The command-line flags "--export-all"
         2089 exports all repositories in the base path. Alternatively you can use the
         2090 "git-daemon-export-ok" file (see the git-daemon man page).</p>
         2091 <pre><code># rcctl set gitdaemon flags --export-all --base-path="/home/src/src"
         2092 </code></pre>
         2093 <p>To configure the service to run as the user _gitdaemon:</p>
         2094 <pre><code># rcctl set gitdaemon user _gitdaemon
         2095 </code></pre>
         2096 <p>To run the daemon directly as the user _gitdaemon (without dropping privileges
         2097 from root to the user) set the following flags in /etc/rc.d/gitdaemon:</p>
         2098 <pre><code>daemon_flags="--user=_gitdaemon"
         2099 </code></pre>
         2100 <p>Which will also avoid this warning while cloning:</p>
         2101 <pre><code>"can't access /root/.git/config"
         2102 </code></pre>
         2103 <p>Now start the daemon:</p>
         2104 <pre><code># rcctl start gitdaemon
         2105 </code></pre>
         2106 <h2>Cloning and fetching changes</h2>
         2107 <p>To test and clone the repository do:</p>
         2108 <pre><code>$ git clone git://yourdomain/someproject
         2109 </code></pre>
         2110 <p>if you skipped the optional git-daemon installation then just clone via SSH:</p>
         2111 <pre><code>$ git clone ssh://youraccount@yourdomain:/home/src/src/someproject
         2112 </code></pre>
         2113 <p>When cloning via SSH make sure to setup private/public key authentication for
         2114 security and convenience.</p>
         2115 <p>You should also make sure the firewall allows connections to the services like
         2116 the git daemon, HTTPd or SSH, for example using OpenBSD pf something like this
         2117 can be set in <a href="https://man.openbsd.org/pf.conf">/etc/pf.conf</a>:</p>
         2118 <pre><code>tcp_services="{ ssh, gopher, http, https, git }"
         2119 pass in on egress proto tcp from any to (egress) port $tcp_services
         2120 </code></pre>
         2121 <h2>Pushing changes</h2>
         2122 <p>Add the repository as a remote:</p>
         2123 <pre><code>$ git remote add myremote ssh://youraccount@yourdomain:/home/src/src/someproject
         2124 </code></pre>
         2125 <p>Then push the changes:</p>
         2126 <pre><code>$ git push myremote master:master
         2127 </code></pre>
         2128 <h2>Git history web browsing (optional)</h2>
         2129 <p>Sometimes it's nice to browse the git history log of the repository in a web
         2130 browser or some other program without having to look at the local repository.</p>
         2131 <ul>
         2132 <li><a href="stagit.html">Stagit</a> is a static HTML page generator for git.</li>
         2133 <li><a href="stagit-gopher.html">Stagit-gopher</a> is a static page generator for
         2134 <a href="http://gopherproject.org/">gopher</a> and
         2135 <a href="gopher://bitreich.org/1/scm/geomyidae">geomyidae</a>.</li>
         2136 <li>cgit is a CGI-based program which shows HTML views of your repository, see
         2137 also the page: <a href="openbsd-httpd-and-cgit.html">OpenBSD httpd, slowcgi and cgit</a>.</li>
         2138 </ul>
         2139 <p>It's also possible with these tools to generate an Atom feed and then use a
         2140 RSS/Atom reader to track the git history:</p>
         2141 <ul>
         2142 <li>An example url from cgit: <a href="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/atom/?h=master">Linux kernel tree</a>.</li>
         2143 <li>An example url from stagit for the <a href="/git/stagit/atom.xml">commit log</a>.</li>
         2144 <li>An example url from stagit for the <a href="/git/stagit/tags.xml">releases</a>.</li>
         2145 </ul>
         2146 <p>My <a href="sfeed.html">sfeed</a> program can be used as a RSS/Atom reader.</p>
         2147 <h2>Setting up git hooks (optional)</h2>
         2148 <p>Using git hooks you can setup automated triggers, for example when pushing to a
         2149 repository.  Some useful examples can be:</p>
         2150 <ul>
         2151 <li><a href="/git/stagit/file/example_post-receive.sh.html">For stagit: update the repo files (example post-receive hook).</a></li>
         2152 <li>Send an e-mail with the commit subject and message.</li>
         2153 <li>Log/notify commits and changes to an IRC channel using a fifo: <a href="https://tools.suckless.org/ii/">ii</a>.</li>
         2154 <li>Create a release tarball and checksum file on a tag push/change.</li>
         2155 <li>Checkout files for website content.</li>
         2156 </ul>
         2157 ]]></description>
         2158 </item>
         2159 <item>
         2160         <title>Setup an OpenBSD SPARC64 VM in QEMU</title>
         2161         <link>gopher://codemadness.org/1/phlog/openbsd-sparc64-vm</link>
         2162         <guid>gopher://codemadness.org/1/phlog/openbsd-sparc64-vm</guid>
         2163         <dc:date>2017-12-11T00:00:00Z</dc:date>
         2164         <author>Hiltjo</author>
         2165         <description><![CDATA[<h1>Setup an OpenBSD SPARC64 VM in QEMU</h1>
         2166         <p><strong>Last modification on </strong> <time>2020-04-18</time></p>
         2167         <p>This describes how to setup an OpenBSD SPARC64 VM in QEMU.</p>
         2168 <h2>Create a disk image</h2>
         2169 <p>To create a 5GB disk image:</p>
         2170 <pre><code>qemu-img create -f qcow2 fs.qcow2 5G
         2171 </code></pre>
         2172 <h2>Install</h2>
         2173 <p>In this guide we'll use the installation ISO to install OpenBSD. Make sure to
         2174 download the latest (stable) OpenBSD ISO, for example install62.iso.</p>
         2175 <ul>
         2176 <li>Change -boot c to -boot d to boot from the CD-ROM and do a clean install.</li>
         2177 <li>Change -cdrom install62.iso to the location of your ISO file.</li>
         2178 <li>When the install is done type: halt -p</li>
         2179 <li>Change -boot d back to -boot c.</li>
         2180 </ul>
         2181 <p>Start the VM:</p>
         2182 <pre><code>#!/bin/sh
         2183 LC_ALL=C QEMU_AUDIO_DRV=none \
         2184 qemu-system-sparc64 \
         2185         -machine sun4u,usb=off \
         2186         -realtime mlock=off \
         2187         -smp 1,sockets=1,cores=1,threads=1 \
         2188         -rtc base=utc \
         2189         -m 1024 \
         2190         -boot c \
         2191         -drive file=fs.qcow2,if=none,id=drive-ide0-0-1,format=qcow2,cache=none \
         2192         -cdrom install62.iso \
         2193         -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-1,id=ide0-0-1 \
         2194         -msg timestamp=on \
         2195         -serial pty -nographic \
         2196         -net nic,model=ne2k_pci -net user
         2197 </code></pre>
         2198 <p>The VM has the following properties:</p>
         2199 <ul>
         2200 <li>No audio.</li>
         2201 <li>No USB.</li>
         2202 <li>No VGA graphics: serial console.</li>
         2203 <li>Netdev is ne0 (Realtek 8029).</li>
         2204 <li>1024MB memory.</li>
         2205 </ul>
         2206 <p>From your host connect to the serial device indicated by QEMU, for example:</p>
         2207 <pre><code>(qemu) 2017-11-19T15:14:20.884312Z qemu-system-sparc64: -serial pty: char device redirected to /dev/ttyp0 (label serial0)
         2208 </code></pre>
         2209 <p>Then you can use the serial terminal emulator <strong>cu</strong> to attach:</p>
         2210 <pre><code>cu -l /dev/ttyp0
         2211 </code></pre>
         2212 <p>Another option could be using the <a href="https://git.suckless.org/st/">simple terminal(st)</a> from suckless.</p>
         2213 <pre><code>st -l /dev/ttyp0
         2214 </code></pre>
         2215 <p>using cu to detach the <a href="https://man.openbsd.org/cu#~^D">cu(1) man page</a> says:</p>
         2216 <pre><code>Typed characters are normally transmitted directly to the remote machine (which
         2217 does the echoing as well).  A tilde ('~') appearing as the first character of a
         2218 line is an escape signal; the following are recognized:
         2219 
         2220     ~^D or ~.  Drop the connection and exit.  Only the connection is
         2221                the login session is not terminated.
         2222 </code></pre>
         2223 <p>On boot you have to type:</p>
         2224 <pre><code>root device: wd0a
         2225 for swap use the default (wd0b) Press enter
         2226 </code></pre>
         2227 <h2>Initial settings on first boot (optional)</h2>
         2228 <p>Automatic network configuration using DHCP</p>
         2229 <pre><code>echo "dhcp" &gt; /etc/hostname.ne0
         2230 </code></pre>
         2231 <p>To bring up the interface (will be automatic on the next boot):</p>
         2232 <pre><code>sh /etc/netstart
         2233 </code></pre>
         2234 <p>Add a mirror to /etc/installurl for package installation. Make sure to lookup
         2235 the most efficient/nearby mirror site on the OpenBSD mirror page.</p>
         2236 <pre><code>echo "https://ftp.hostserver.de/pub/OpenBSD" &gt; /etc/installurl
         2237 </code></pre>
         2238 ]]></description>
         2239 </item>
         2240 <item>
         2241         <title>Tscrape: a Twitter scraper</title>
         2242         <link>gopher://codemadness.org/1/phlog/tscrape</link>
         2243         <guid>gopher://codemadness.org/1/phlog/tscrape</guid>
         2244         <dc:date>2017-09-24T00:00:00Z</dc:date>
         2245         <author>Hiltjo</author>
         2246         <description><![CDATA[<h1>Tscrape: a Twitter scraper</h1>
         2247         <p><strong>Last modification on </strong> <time>2020-07-20</time></p>
         2248         <p>Tscrape is a Twitter web scraper and archiver.</p>
         2249 <p>Twitter removed the functionality to follow users using a RSS feed without
         2250 authenticating or using their API. With this program you can format tweets in
         2251 any way you like relatively anonymously.</p>
         2252 <p>For more (up-to-date) information see the <a href="/git/tscrape/file/README.html">README</a> file.</p>
         2253 <h2>Clone</h2>
         2254 <pre><code>git clone git://git.codemadness.org/tscrape
         2255 </code></pre>
         2256 <h2>Browse</h2>
         2257 <p>You can browse the source-code at:</p>
         2258 <ul>
         2259 <li><a href="https://git.codemadness.org/tscrape/">https://git.codemadness.org/tscrape/</a></li>
         2260 <li><a href="gopher://codemadness.org/1/git/tscrape">gopher://codemadness.org/1/git/tscrape</a></li>
         2261 </ul>
         2262 <h2>Download releases</h2>
         2263 <p>Releases are available at:</p>
         2264 <ul>
         2265 <li><a href="https://codemadness.org/releases/tscrape/">https://codemadness.org/releases/tscrape/</a></li>
         2266 <li><a href="gopher://codemadness.org/1/releases/tscrape">gopher://codemadness.org/1/releases/tscrape</a></li>
         2267 </ul>
         2268 <h2>Examples</h2>
         2269 <p>Output format examples:</p>
         2270 <ul>
         2271 <li><a href="tscrape/tscrape_html.html">tscrape_html: HTML</a></li>
         2272 <li><a href="tscrape/tscrape_plain.txt">tscrape_plain: Text</a></li>
         2273 </ul>
         2274 ]]></description>
         2275 </item>
         2276 <item>
         2277         <title>jsdatatable: a small datatable Javascript</title>
         2278         <link>gopher://codemadness.org/1/phlog/datatable</link>
         2279         <guid>gopher://codemadness.org/1/phlog/datatable</guid>
         2280         <dc:date>2017-09-24T00:00:00Z</dc:date>
         2281         <author>Hiltjo</author>
         2282         <description><![CDATA[<h1>jsdatatable: a small datatable Javascript</h1>
         2283         <p><strong>Last modification on </strong> <time>2020-07-20</time></p>
         2284         <p>This is a small datatable Javascript with no dependencies.</p>
         2285 <h2>Features</h2>
         2286 <ul>
         2287 <li>Small:
         2288 <ul>
         2289 <li>Filesize: +- 9.1KB.</li>
         2290 <li>Lines: +- 300, not much code, so hopefully easy to understand.</li>
         2291 <li>No dependencies on other libraries like jQuery.</li>
         2292 </ul>
         2293 </li>
         2294 <li>Sorting on columns, multi-column support with shift-click.</li>
         2295 <li>Filtering values: case-insensitively, tokenized (separated by space).</li>
         2296 <li>Able to add custom filtering, parsing and sorting functions.</li>
         2297 <li>Helper function for delayed (150ms) filtering, so filtering feels more
         2298 responsive for big datasets.</li>
         2299 <li>Permissive ISC license, see LICENSE file.</li>
         2300 <li>"Lazy scroll" mode:
         2301 <ul>
         2302 <li>fixed column headers and renders only visible rows, this allows you to
         2303 "lazily" render millions of rows.</li>
         2304 </ul>
         2305 </li>
         2306 <li>Officially supported browsers are:
         2307 <ul>
         2308 <li>Firefox and Firefox ESR.</li>
         2309 <li>Chrome and most recent webkit-based browsers.</li>
         2310 <li>IE10+.</li>
         2311 </ul>
         2312 </li>
         2313 </ul>
         2314 <h2>Why? and a comparison</h2>
         2315 <p>It was created because all the other datatable scripts suck balls.</p>
         2316 <p>Most Javascripts nowadays have a default dependency on jQuery, Bootstrap or
         2317 other frameworks.</p>
         2318 <p>jQuery adds about 97KB and Bootstrap adds about 100KB to your scripts and CSS
         2319 as a dependency.  This increases the CPU, memory and bandwidth consumption and
         2320 latency. It also adds complexity to your scripts.</p>
         2321 <p>jQuery was mostly used for backwards-compatibility in the Internet Explorer
         2322 days, but is most often not needed anymore. It contains functionality to query
         2323 the DOM using CSS-like selectors, but this is now supported with for example
         2324 document.querySelectorAll.  Functionality like a JSON parser is standard
         2325 available now: JSON.parse().</p>
         2326 <h3>Size comparison</h3>
         2327 <p>All sizes are not "minified" or gzipped.</p>
         2328 <pre><code>Name                             |   Total |      JS |   CSS | Images | jQuery
         2329 ---------------------------------+---------+---------+-------+--------+-------
         2330 jsdatatable                      |  12.9KB |   9.1KB | 2.5KB |  1.3KB |      -
         2331 datatables.net (without plugins) | 563.4KB | 449.3KB |  16KB |  0.8KB | 97.3KB
         2332 jdatatable                       | 154.6KB |    53KB |   1KB |  3.3KB | 97.3KB
         2333 </code></pre>
         2334 <ul>
         2335 <li><a href="https://datatables.net/">datatables.net</a> (without plugins).</li>
         2336 <li><a href="https://plugins.jquery.com/jdatatable/">jdatatable</a></li>
         2337 </ul>
         2338 <p>Of course jsdatatable has less features (less is more!), but it does 90% of
         2339 what's needed.  Because it is so small it is also much simpler to understand and
         2340 extend with required features if needed.</p>
         2341 <p>See also:
         2342 <a href="https://idlewords.com/talks/website_obesity.htm">The website obesity crisis</a></p>
         2343 <h2>Clone</h2>
         2344 <pre><code>git clone git://git.codemadness.org/jscancer
         2345 </code></pre>
         2346 <h2>Browse</h2>
         2347 <p>You can browse the source-code at:</p>
         2348 <ul>
         2349 <li><a href="https://git.codemadness.org/jscancer/">https://git.codemadness.org/jscancer/</a></li>
         2350 <li><a href="gopher://codemadness.org/1/git/jscancer">gopher://codemadness.org/1/git/jscancer</a></li>
         2351 </ul>
         2352 <p>It is in the datatable directory.</p>
         2353 <h2>Download releases</h2>
         2354 <p>Releases are available at:</p>
         2355 <ul>
         2356 <li><a href="https://codemadness.org/releases/jscancer/">https://codemadness.org/releases/jscancer/</a></li>
         2357 <li><a href="gopher://codemadness.org/1/releases/jscancer">gopher://codemadness.org/1/releases/jscancer</a></li>
         2358 </ul>
         2359 <h2>Usage</h2>
         2360 <h3>Examples</h3>
         2361 <p>See example.html for an example. A stylesheet file datatable.css is also
         2362 included, it contains the icons as embedded images.</p>
         2363 <p>A table should have the classname "datatable" set, it must contain a &lt;thead&gt;
         2364 for the column headers (&lt;td&gt; or &lt;th&gt;) and &lt;tbody&gt; element for the data. The
         2365 minimal code needed for a working datatable:</p>
         2366 <pre><code>&lt;html&gt;
         2367 &lt;body&gt;
         2368 &lt;input class="filter-text" /&gt;&lt;!-- optional --&gt;
         2369 &lt;table class="datatable"&gt;
         2370         &lt;thead&gt;&lt;!-- columns --&gt;
         2371                 &lt;tr&gt;&lt;td&gt;Click me&lt;/td&gt;&lt;/tr&gt;
         2372         &lt;/thead&gt;
         2373         &lt;tbody&gt;&lt;!-- data --&gt;
         2374                 &lt;tr&gt;&lt;td&gt;a&lt;/td&gt;&lt;/tr&gt;
         2375                 &lt;tr&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;
         2376         &lt;/tbody&gt;
         2377 &lt;/table&gt;
         2378 &lt;script type="text/javascript" src="datatable.js"&gt;&lt;/script&gt;
         2379 &lt;script type="text/javascript"&gt;var datatables = datatable_autoload();&lt;/script&gt;
         2380 &lt;/body&gt;
         2381 &lt;/html&gt;
         2382 </code></pre>
         2383 <h3>Column attributes</h3>
         2384 <p>The following column attributes are supported:</p>
         2385 <ul>
         2386 <li>data-filterable: if "1" or "true" specifies if the column can be filtered,
         2387 default: "true".</li>
         2388 <li>data-parse: specifies how to parse the values, default: "string", which is
         2389 datatable_parse_string(). See PARSING section below.</li>
         2390 <li>data-sort: specifies how to sort the values: default: "default", which is
         2391 datatable_sort_default(). See SORTING section below.</li>
         2392 <li>data-sortable: if "1" or "true" specifies if the column can be sorted,
         2393 default: "true".</li>
         2394 </ul>
         2395 <h3>Parsing</h3>
         2396 <p>By default only parsing for the types: date, float, int and string are
         2397 supported, but other types can be easily added as a function with the name:
         2398 datatable_parse_&lt;typename&gt;(). The parse functions parse the data-value
         2399 attribute when set or else the cell content (in order). Because of this
         2400 behaviour you can set the actual values as the data-value attribute and use the
         2401 cell content for display. This is useful to display and properly sort
         2402 locale-aware currency, datetimes etc.</p>
         2403 <h3>Filtering</h3>
         2404 <p>Filtering will be done case-insensitively on the cell content and when set also
         2405 on the data-value attribute. The filter string is split up as tokens separated
         2406 by space. Each token must match at least once per row to display it.</p>
         2407 <h3>Sorting</h3>
         2408 <p>Sorting is done on the parsed values by default with the function:
         2409 datatable_sort_default(). To change this you can set a customname string on
         2410 the data-sort attribute on the column which translates to the function:
         2411 datatable_sort_&lt;customname&gt;().</p>
         2412 <p>In some applications locale values are used, like for currency, decimal numbers
         2413 datetimes. Some people also like to use icons or extended HTML elements inside
         2414 the cell. Because jsdatatable sorts on the parsed value (see section PARSING)
         2415 it is possible to sort on the data-value attribute values and use the cell
         2416 content for display.</p>
         2417 <p>For example:</p>
         2418 <ul>
         2419 <li>currency, decimal numbers: use data-value attribute with floating-point
         2420 number, set data-parse column to "float".</li>
         2421 <li>date/datetimes: use data-value attribute with UNIX timestamps (type int), set
         2422 data-parse on column to "int" or set the data-parse attribute on column to
         2423 "date" which is datatable_parse_date(), then make sure to use Zulu times, like:
         2424 "2016-01-01T01:02:03Z" or other time strings that are parsable as the
         2425 data-value attribute.</li>
         2426 <li>icons: generally use data-value attribute with integer as weight value to
         2427 sort on, set data-parse column to "int".</li>
         2428 </ul>
         2429 <h3>Dynamically update data</h3>
         2430 <p>To update data dynamically see example-ajax.html for an example how to do this.</p>
         2431 <h3>Caveats</h3>
         2432 <ul>
         2433 <li>A date, integer, float or other values must be able to parse properly, when
         2434 the parse function returns NaN, null or undefined etc. the sorting behaviour is
         2435 also undefined. It is recommended to always set a zero value for each type.</li>
         2436 <li>&lt;tfoot&gt; is not supported in datatables in "lazy" mode.</li>
         2437 </ul>
         2438 <h2>Demo / example</h2>
         2439 <p><strong>For the below example to work you need to have Javascript enabled.</strong></p>
         2440 <p><a href="datatable-example.html">datatable-example.html</a></p>
         2441 ]]></description>
         2442 </item>
         2443 <item>
         2444         <title>Stagit-gopher: a static git page generator for gopher</title>
         2445         <link>gopher://codemadness.org/1/phlog/stagit-gopher</link>
         2446         <guid>gopher://codemadness.org/1/phlog/stagit-gopher</guid>
         2447         <dc:date>2017-08-04T00:00:00Z</dc:date>
         2448         <author>Hiltjo</author>
         2449         <description><![CDATA[<h1>Stagit-gopher: a static git page generator for gopher</h1>
         2450         <p><strong>Last modification on </strong> <time>2021-04-11</time></p>
         2451         <p>stagit-gopher is a static page generator for Gopher.  It creates the pages as
         2452 static <a href="http://git.r-36.net/geomyidae/">geomyidae</a> .gph files.  stagit-gopher is a modified version from the
         2453 HTML version of stagit.</p>
         2454 <p><a href="/git/stagit-gopher/file/README.html">Read the README for more information about it.</a></p>
         2455 <p>I also run a gopherhole and stagit-gopher, you can see how it looks here:
         2456 <a href="gopher://codemadness.org/1/git/">gopher://codemadness.org/1/git/</a></p>
         2457 <p><a href="https://git.fifth.space/sacc/log.html">sacc</a> is a good Gopher client to view it.</p>
         2458 <h2>Features</h2>
         2459 <ul>
         2460 <li>Log of all commits from HEAD.</li>
         2461 <li>Log and diffstat per commit.</li>
         2462 <li>Show file tree with line numbers.</li>
         2463 <li>Show references: local branches and tags.</li>
         2464 <li>Detect README and LICENSE file from HEAD and link it as a webpage.</li>
         2465 <li>Detect submodules (.gitmodules file) from HEAD and link it as a webpage.</li>
         2466 <li>Atom feed of the commit log (atom.xml).</li>
         2467 <li>Atom feed of the tags/refs (tags.xml).</li>
         2468 <li>Make index page for multiple repositories with stagit-gopher-index.</li>
         2469 <li>After generating the pages (relatively slow) serving the files is very fast,
         2470 simple and requires little resources (because the content is static), a
         2471 geomyidae Gopher server is required.</li>
         2472 <li>Security: all pages are static. No CGI or dynamic code is run for the
         2473 interface.  Using it with a secure Gopher server such as geomyidae it is
         2474 privilege-dropped and chroot(2)'d.</li>
         2475 <li>Simple to setup: the content generation is clearly separated from serving it.
         2476 This makes configuration as simple as copying a few directories and scripts.</li>
         2477 <li>Usable with Gopher clients such as lynx and <a href="https://git.fifth.space/sacc/log.html">sacc</a>.</li>
         2478 </ul>
         2479 <h2>Cons</h2>
         2480 <ul>
         2481 <li>Not suitable for large repositories (2000+ commits), because diffstats are
         2482 an expensive operation, the cache (-c flag) is a workaround for this in
         2483 some cases.</li>
         2484 <li>Not suitable for large repositories with many files, because all files are
         2485 written for each execution of stagit. This is because stagit shows the lines
         2486 of textfiles and there is no "cache" for file metadata (this would add more
         2487 complexity to the code).</li>
         2488 <li>Not suitable for repositories with many branches, a quite linear history is
         2489 assumed (from HEAD).</li>
         2490 <li>Relatively slow to run the first time (about 3 seconds for sbase,
         2491 1500+ commits), incremental updates are faster.</li>
         2492 <li>Does not support some of the dynamic features cgit has (for HTTP), like:
         2493 <ul>
         2494 <li>Snapshot tarballs per commit.</li>
         2495 <li>File tree per commit.</li>
         2496 <li>History log of branches diverged from HEAD.</li>
         2497 <li>Stats (git shortlog -s).</li>
         2498 </ul>
         2499 </li>
         2500 </ul>
         2501 <p>This is by design, just use git locally.</p>
         2502 <h2>Clone</h2>
         2503 <pre><code>git clone git://git.codemadness.org/stagit-gopher
         2504 </code></pre>
         2505 <h2>Browse</h2>
         2506 <p>You can browse the source-code at:</p>
         2507 <ul>
         2508 <li><a href="https://git.codemadness.org/stagit-gopher/">https://git.codemadness.org/stagit-gopher/</a></li>
         2509 <li><a href="gopher://codemadness.org/1/git/stagit-gopher">gopher://codemadness.org/1/git/stagit-gopher</a></li>
         2510 </ul>
         2511 <h2>Download releases</h2>
         2512 <p>Releases are available at:</p>
         2513 <ul>
         2514 <li><a href="https://codemadness.org/releases/stagit-gopher/">https://codemadness.org/releases/stagit-gopher/</a></li>
         2515 <li><a href="gopher://codemadness.org/1/releases/stagit-gopher">gopher://codemadness.org/1/releases/stagit-gopher</a></li>
         2516 </ul>
         2517 ]]></description>
         2518 </item>
         2519 <item>
         2520         <title>Saait: a boring HTML page generator</title>
         2521         <link>gopher://codemadness.org/1/phlog/saait</link>
         2522         <guid>gopher://codemadness.org/1/phlog/saait</guid>
         2523         <dc:date>2017-06-10T00:00:00Z</dc:date>
         2524         <author>Hiltjo</author>
         2525         <description><![CDATA[<h1>Saait: a boring HTML page generator</h1>
         2526         <p><strong>Last modification on </strong> <time>2020-07-20</time></p>
         2527         <p>Saait is the most boring static HTML page generator.</p>
         2528 <p>Meaning of saai (dutch): boring. Pronunciation: site</p>
         2529 <p><a href="/git/saait/file/README.html">Read the README for more information about it.</a></p>
         2530 <p>I used to use <a href="/git/static-site-scripts/files.html">shellscripts</a> to generate the static pages, but realised I
         2531 wanted a small program that works on each platform consistently.  There are
         2532 many incompatibilities or unimplemented features in base tools across different
         2533 platforms: Linux, UNIX, Windows.</p>
         2534 <p>This site is created using saait.</p>
         2535 <h2>Features</h2>
         2536 <ul>
         2537 <li>Single small binary that handles all the things. At run-time no dependency on
         2538 other tools.</li>
         2539 <li>Few lines of code (about 575 lines of C) and no dependencies except: a C
         2540 compiler and libc.</li>
         2541 <li>Works on most platforms: tested on Linux, *BSD, Windows.</li>
         2542 <li>Simple template syntax.</li>
         2543 <li>Uses HTML output by default, but can easily be modified to generate any
         2544 textual content, like gopher pages, wiki pages or other kinds of documents.</li>
         2545 <li>Out-of-the-box supports: creating an index page of all pages, Atom feed,
         2546 twtxt.txt feed, sitemap.xml and urllist.txt.</li>
         2547 </ul>
         2548 <h2>Cons</h2>
         2549 <ul>
         2550 <li>Simple template syntax, but very basic. Requires C knowledge to extend it if
         2551 needed.</li>
         2552 <li>Only basic (no nested) template blocks supported.</li>
         2553 </ul>
         2554 <h2>Clone</h2>
         2555 <pre><code>git clone git://git.codemadness.org/saait
         2556 </code></pre>
         2557 <h2>Browse</h2>
         2558 <p>You can browse the source-code at:</p>
         2559 <ul>
         2560 <li><a href="https://git.codemadness.org/saait/">https://git.codemadness.org/saait/</a></li>
         2561 <li><a href="gopher://codemadness.org/1/git/saait">gopher://codemadness.org/1/git/saait</a></li>
         2562 </ul>
         2563 <h2>Download releases</h2>
         2564 <p>Releases are available at:</p>
         2565 <ul>
         2566 <li><a href="https://codemadness.org/releases/saait/">https://codemadness.org/releases/saait/</a></li>
         2567 <li><a href="gopher://codemadness.org/1/releases/saait">gopher://codemadness.org/1/releases/saait</a></li>
         2568 </ul>
         2569 <h2>Documentation / man page</h2>
         2570 <p>Below is the saait(1) man page, which includes usage examples.</p>
         2571 <pre><code>
         2572 SAAIT(1)                    General Commands Manual                      SAAIT(1)
         2573 
         2574 NAME
         2575      saait  the most boring static page generator
         2576 
         2577 SYNOPSIS
         2578      saait [-c configfile] [-o outputdir] [-t templatesdir] pages...
         2579 
         2580 DESCRIPTION
         2581      saait writes HTML pages to the output directory.
         2582 
         2583      The arguments pages are page config files, which are processed in the
         2584      given order.
         2585 
         2586      The options are as follows:
         2587 
         2588      -c configfile
         2589              The global configuration file, the default is "config.cfg". Each
         2590              page configuration file inherits variables from this file. These
         2591              variables can be overwritten per page.
         2592 
         2593      -o outputdir
         2594              The output directory, the default is "output".
         2595 
         2596      -t templatesdir
         2597              The templates directory, the default is "templates".
         2598 
         2599 DIRECTORY AND FILE STRUCTURE
         2600      A recommended directory structure for pages, although the names can be
         2601      anything:
         2602      pages/001-page.cfg
         2603      pages/001-page.html
         2604      pages/002-page.cfg
         2605      pages/002-page.html
         2606 
         2607      The directory and file structure for templates must be:
         2608      templates/&lt;templatename&gt;/header.ext
         2609      templates/&lt;templatename&gt;/item.ext
         2610      templates/&lt;templatename&gt;/footer.ext
         2611 
         2612      The following filename prefixes are detected for template blocks and
         2613      processed in this order:
         2614 
         2615      "header."
         2616              Header block.
         2617 
         2618      "item."
         2619              Item block.
         2620 
         2621      "footer."
         2622              Footer block.
         2623 
         2624      The files are saved as output/&lt;templatename&gt;, for example
         2625      templates/atom.xml/* will become: output/atom.xml. If a template block
         2626      file does not exist then it is treated as if it was empty.
         2627 
         2628      Template directories starting with a dot (".") are ignored.
         2629 
         2630      The "page" templatename is special and will be used per page.
         2631 
         2632 CONFIG FILE
         2633      A config file has a simple key=value configuration syntax, for example:
         2634 
         2635      # this is a comment line.
         2636      filename = example.html
         2637      title = Example page
         2638      description = This is an example page
         2639      created = 2009-04-12
         2640      updated = 2009-04-14
         2641 
         2642      The following variable names are special with their respective defaults:
         2643 
         2644      contentfile
         2645              Path to the input content filename, by default this is the path
         2646              of the config file with the last extension replaced to ".html".
         2647 
         2648      filename
         2649              The filename or relative file path for the output file for this
         2650              page.  By default the value is the basename of the contentfile.
         2651              The path of the written output file is the value of filename
         2652              appended to the outputdir path.
         2653 
         2654      A line starting with # is a comment and is ignored.
         2655 
         2656      TABs and spaces before and after a variable name are ignored.  TABs and
         2657      spaces before a value are ignored.
         2658 
         2659 TEMPLATES
         2660      A template (block) is text.  Variables are replaced with the values set
         2661      in the config files.
         2662 
         2663      The possible operators for variables are:
         2664 
         2665      $             Escapes a XML string, for example: &lt; to the entity &amp;lt;.
         2666 
         2667      #             Literal raw string value.
         2668 
         2669      %             Insert contents of file of the value of the variable.
         2670 
         2671      For example in a HTML item template:
         2672 
         2673      &lt;article&gt;
         2674              &lt;header&gt;
         2675                      &lt;h1&gt;&lt;a href=""&gt;${title}&lt;/a&gt;&lt;/h1&gt;
         2676                      &lt;p&gt;
         2677                              &lt;strong&gt;Last modification on &lt;/strong&gt;
         2678                              &lt;time datetime="${updated}"&gt;${updated}&lt;/time&gt;
         2679                      &lt;/p&gt;
         2680              &lt;/header&gt;
         2681              %{contentfile}
         2682      &lt;/article&gt;
         2683 
         2684 EXIT STATUS
         2685      The saait utility exits 0 on success, and &gt;0 if an error occurs.
         2686 
         2687 EXAMPLES
         2688      A basic usage example:
         2689 
         2690      1.   Create a directory for a new site:
         2691 
         2692           mkdir newsite
         2693 
         2694      2.   Copy the example pages, templates, global config file and example
         2695           stylesheets to a directory:
         2696 
         2697           cp -r pages templates config.cfg style.css print.css newsite/
         2698 
         2699      3.   Change the current directory to the created directory.
         2700 
         2701           cd newsite/
         2702 
         2703      4.   Change the values in the global config.cfg file.
         2704 
         2705      5.   If you want to modify parts of the header, like the navigation menu
         2706           items, you can change the following two template files:
         2707           templates/page/header.html
         2708           templates/index.html/header.html
         2709 
         2710      6.   Create any new pages in the pages directory. For each config file
         2711           there has to be a corresponding HTML file.  By default this HTML
         2712           file has the path of the config file, but with the last extension
         2713           (".cfg" in this case) replaced to ".html".
         2714 
         2715      7.   Create an output directory:
         2716 
         2717           mkdir -p output
         2718 
         2719      8.   After any modifications the following commands can be used to
         2720           generate the output and process the pages in descending order:
         2721 
         2722           find pages -type f -name '*.cfg' -print0 | sort -zr | xargs -0 saait
         2723 
         2724      9.   Copy the modified stylesheets to the output directory also:
         2725 
         2726           cp style.css print.css output/
         2727 
         2728      10.  Open output/index.html locally in your webbrowser to review the
         2729           changes.
         2730 
         2731      11.  To synchronize files, you can securely transfer them via SSH using
         2732           rsync:
         2733 
         2734           rsync -av output/ user@somehost:/var/www/htdocs/
         2735 
         2736 TRIVIA
         2737      The most boring static page generator.
         2738 
         2739      Meaning of saai (dutch): boring, pronunciation of saait: site
         2740 
         2741 SEE ALSO
         2742      find(1), sort(1), xargs(1)
         2743 
         2744 AUTHORS
         2745      Hiltjo Posthuma &lt;hiltjo@codemadness.org&gt;
         2746 </code></pre>
         2747 ]]></description>
         2748 </item>
         2749 <item>
         2750         <title>Stagit: a static git page generator</title>
         2751         <link>gopher://codemadness.org/1/phlog/stagit</link>
         2752         <guid>gopher://codemadness.org/1/phlog/stagit</guid>
         2753         <dc:date>2017-05-10T00:00:00Z</dc:date>
         2754         <author>Hiltjo</author>
         2755         <description><![CDATA[<h1>Stagit: a static git page generator</h1>
         2756         <p><strong>Last modification on </strong> <time>2021-04-11</time></p>
         2757         <p>stagit is a static page generator for git.</p>
         2758 <p><a href="/git/stagit/file/README.html">Read the README for more information about it.</a></p>
         2759 <p>My git repository uses stagit, you can see how it looks here:
         2760 <a href="https://codemadness.org/git/">https://codemadness.org/git/</a></p>
         2761 <h2>Features</h2>
         2762 <ul>
         2763 <li>Log of all commits from HEAD.</li>
         2764 <li>Log and diffstat per commit.</li>
         2765 <li>Show file tree with linkable line numbers.</li>
         2766 <li>Show references: local branches and tags.</li>
         2767 <li>Detect README and LICENSE file from HEAD and link it as a webpage.</li>
         2768 <li>Detect submodules (.gitmodules file) from HEAD and link it as a webpage.</li>
         2769 <li>Atom feed of the commit log (atom.xml).</li>
         2770 <li>Atom feed of the tags/refs (tags.xml).</li>
         2771 <li>Make index page for multiple repositories with stagit-index.</li>
         2772 <li>After generating the pages (relatively slow) serving the files is very fast,
         2773 simple and requires little resources (because the content is static), only
         2774 a HTTP file server is required.</li>
         2775 <li>Security: all pages are static. No CGI or dynamic code is run for the
         2776 interface. Using it with a secure httpd such as OpenBSD httpd it is
         2777 privilege-separated, chroot(2)'d and pledge(2)'d.</li>
         2778 <li>Simple to setup: the content generation is clearly separated from serving
         2779 it. This makes configuration as simple as copying a few directories and
         2780 scripts.</li>
         2781 <li>Usable with text-browsers such as dillo, links, lynx and w3m.</li>
         2782 </ul>
         2783 <h2>Cons</h2>
         2784 <ul>
         2785 <li>Not suitable for large repositories (2000+ commits), because diffstats are
         2786 an expensive operation, the cache (-c flag) or (-l maxlimit) is a workaround
         2787 for this in some cases.</li>
         2788 <li>Not suitable for large repositories with many files, because all files are
         2789 written for each execution of stagit. This is because stagit shows the lines
         2790 of textfiles and there is no "cache" for file metadata (this would add more
         2791 complexity to the code).</li>
         2792 <li>Not suitable for repositories with many branches, a quite linear history is
         2793 assumed (from HEAD).</li>
         2794 </ul>
         2795 <p>In these cases it is better to use <a href="https://git.zx2c4.com/cgit/">cgit</a> or
         2796 possibly change stagit to run as a CGI program.</p>
         2797 <ul>
         2798 <li>Relatively slow to run the first time (about 3 seconds for sbase,
         2799 1500+ commits), incremental updates are faster.</li>
         2800 <li>Does not support some of the dynamic features cgit has, like:
         2801 <ul>
         2802 <li>Snapshot tarballs per commit.</li>
         2803 <li>File tree per commit.</li>
         2804 <li>History log of branches diverged from HEAD.</li>
         2805 <li>Stats (git shortlog -s).</li>
         2806 </ul>
         2807 </li>
         2808 </ul>
         2809 <p>This is by design, just use git locally.</p>
         2810 <h2>Clone</h2>
         2811 <pre><code>git clone git://git.codemadness.org/stagit
         2812 </code></pre>
         2813 <h2>Browse</h2>
         2814 <p>You can browse the source-code at:</p>
         2815 <ul>
         2816 <li><a href="https://git.codemadness.org/stagit/">https://git.codemadness.org/stagit/</a></li>
         2817 <li><a href="gopher://codemadness.org/1/git/stagit">gopher://codemadness.org/1/git/stagit</a></li>
         2818 </ul>
         2819 <h2>Download releases</h2>
         2820 <p>Releases are available at:</p>
         2821 <ul>
         2822 <li><a href="https://codemadness.org/releases/stagit/">https://codemadness.org/releases/stagit/</a></li>
         2823 <li><a href="gopher://codemadness.org/1/releases/stagit">gopher://codemadness.org/1/releases/stagit</a></li>
         2824 </ul>
         2825 ]]></description>
         2826 </item>
         2827 <item>
         2828         <title>OpenBSD httpd, slowcgi and cgit</title>
         2829         <link>gopher://codemadness.org/1/phlog/openbsd-httpd-and-cgit</link>
         2830         <guid>gopher://codemadness.org/1/phlog/openbsd-httpd-and-cgit</guid>
         2831         <dc:date>2015-07-05T00:00:00Z</dc:date>
         2832         <author>Hiltjo</author>
         2833         <description><![CDATA[<h1>OpenBSD httpd, slowcgi and cgit</h1>
         2834         <p><strong>Last modification on </strong> <time>2021-04-11</time></p>
         2835         <p>This is a guide to get <a href="https://git.zx2c4.com/cgit/">cgit</a> working with
         2836 <a href="https://man.openbsd.org/httpd.8">OpenBSD httpd(8)</a> and
         2837 <a href="https://man.openbsd.org/slowcgi.8">slowcgi(8)</a> in base.  OpenBSD httpd is very simple to setup, but nevertheless
         2838 this guide might help someone out there.</p>
         2839 <h2>Installation</h2>
         2840 <p>Install the cgit package:</p>
         2841 <pre><code># pkg_add cgit
         2842 </code></pre>
         2843 <p>or build it from ports:</p>
         2844 <pre><code># cd /usr/ports/www/cgit &amp;&amp; make &amp;&amp; make install
         2845 </code></pre>
         2846 <h2>Configuration</h2>
         2847 <h3>httpd</h3>
         2848 <p>An example of <a href="https://man.openbsd.org/httpd.conf.5">httpd.conf(5)</a>:
         2849 <a href="downloads/openbsd-httpd/httpd.conf">httpd.conf</a>.</p>
         2850 <h3>slowcgi</h3>
         2851 <p>By default the slowcgi UNIX domain socket is located at:
         2852 /var/www/run/slowcgi.sock.  For this example we use the defaults.</p>
         2853 <h3>cgit</h3>
         2854 <p>The cgit binary should be located at: /var/www/cgi-bin/cgit.cgi (default).</p>
         2855 <p>cgit uses the $CGIT_CONFIG environment variable to locate its config.  By
         2856 default on OpenBSD this is set to /conf/cgitrc (chroot), which is
         2857 /var/www/conf/cgitrc.  An example of the cgitrc file is here: <a href="downloads/openbsd-httpd/cgitrc">cgitrc</a>.</p>
         2858 <p>In this example the cgit cache directory is set to /cgit/cache (chroot), which
         2859 is /var/www/cgit/cache.  Make sure to give this path read and write permissions
         2860 for cgit (www:daemon).</p>
         2861 <p>In the example the repository path (scan-path) is set to /htdocs/src (chroot),
         2862 which is /var/www/htdocs/src.</p>
         2863 <p>The footer file is set to /conf/cgit.footer. Make sure this file exists or you
         2864 will get warnings:</p>
         2865 <pre><code># &gt;/var/www/conf/cgit.footer
         2866 </code></pre>
         2867 <p>Make sure cgit.css (stylesheet) and cgit.png (logo) are accessible, by default:
         2868 /var/www/cgit/cgit.{css,png} (location can be changed in httpd.conf).</p>
         2869 <p>To support .tar.gz snapshots a static gzip binary is required in the chroot
         2870 /bin directory:</p>
         2871 <pre><code>cd /usr/src/usr.bin/compress
         2872 make clean &amp;&amp; make LDFLAGS="-static -pie"
         2873 cp obj/compress /var/www/bin/gzip
         2874 </code></pre>
         2875 <h2>Running the services</h2>
         2876 <p>Enable the httpd and slowcgi services to automatically start them at boot:</p>
         2877 <pre><code># rcctl enable httpd slowcgi
         2878 </code></pre>
         2879 <p>Start the services:</p>
         2880 <pre><code># rcctl start httpd slowcgi
         2881 </code></pre>
         2882 ]]></description>
         2883 </item>
         2884 <item>
         2885         <title>twitch: application to watch Twitch streams</title>
         2886         <link>gopher://codemadness.org/1/phlog/twitch-interface</link>
         2887         <guid>gopher://codemadness.org/1/phlog/twitch-interface</guid>
         2888         <dc:date>2014-11-23T00:00:00Z</dc:date>
         2889         <author>Hiltjo</author>
         2890         <description><![CDATA[<h1>twitch: application to watch Twitch streams</h1>
         2891         <p><strong>Last modification on </strong> <time>2020-12-14</time></p>
         2892         <p><strong>Update: as of 2020-05-06:</strong> I stopped maintaining it.
         2893 Twitch now requires OAUTH and 2-factor authentication. It requires me to expose
         2894 personal information such as my phone number.</p>
         2895 <p><strong>Update: as of ~2020-01-03:</strong> I rewrote this application from Golang to C.
         2896 The Twitch Kraken API used by the Golang version was deprecated.  It was
         2897 rewritten to use the Helix API.</p>
         2898 <p>This program/script allows to view streams in your own video player like so the
         2899 bloated Twitch interface is not needed.  It is written in C.</p>
         2900 <h2>Features</h2>
         2901 <ul>
         2902 <li>No Javascript, cookies, CSS optional.</li>
         2903 <li>Works well in all browsers, including text-based ones.</li>
         2904 <li>Has a HTTP CGI and Gopher CGI version.</li>
         2905 <li>Atom feed for VODs.</li>
         2906 </ul>
         2907 <h2>Clone</h2>
         2908 <pre><code>git clone git://git.codemadness.org/frontends
         2909 </code></pre>
         2910 <h2>Browse</h2>
         2911 <p>You can browse the source-code at:</p>
         2912 <ul>
         2913 <li><a href="https://git.codemadness.org/frontends/">https://git.codemadness.org/frontends/</a></li>
         2914 <li><a href="gopher://codemadness.org/1/git/frontends">gopher://codemadness.org/1/git/frontends</a></li>
         2915 </ul>
         2916 ]]></description>
         2917 </item>
         2918 <item>
         2919         <title>Userscript: focus input field</title>
         2920         <link>gopher://codemadness.org/1/phlog/userscript-focus-input-field</link>
         2921         <guid>gopher://codemadness.org/1/phlog/userscript-focus-input-field</guid>
         2922         <dc:date>2014-03-02T00:00:00Z</dc:date>
         2923         <author>Hiltjo</author>
         2924         <description><![CDATA[<h1>Userscript: focus input field</h1>
         2925         <p><strong>Last modification on </strong> <time>2014-03-02</time></p>
         2926         <p>This is an userscript I wrote a while ago which allows to focus the first input
         2927 field on a page with ctrl+space.  This is useful if a site doesn't specify the
         2928 autofocus attribute for an input field and you don't want to switch to it using
         2929 the mouse.</p>
         2930 <h2>Download</h2>
         2931 <p><a href="downloads/input_focus.user.js">Download userscript input_focus.user.js</a></p>
         2932 ]]></description>
         2933 </item>
         2934 <item>
         2935         <title>Userscript: Youtube circumvent age verification</title>
         2936         <link>gopher://codemadness.org/1/phlog/userscript-youtube-circumvent-age-verification</link>
         2937         <guid>gopher://codemadness.org/1/phlog/userscript-youtube-circumvent-age-verification</guid>
         2938         <dc:date>2013-02-21T00:00:00Z</dc:date>
         2939         <author>Hiltjo</author>
         2940         <description><![CDATA[<h1>Userscript: Youtube circumvent age verification</h1>
         2941         <p><strong>Last modification on </strong> <time>2020-12-27</time></p>
         2942         <p>This is an userscript I wrote a while ago which circumvents requiring to login
         2943 with an account on Youtube if a video requires age verification.</p>
         2944 <p><strong>Note: this is an old script and does not work anymore.</strong></p>
         2945 <h2>Download</h2>
         2946 <p><a href="downloads/youtube_circumvent_sign_in.user.js">Download userscript Youtube_circumvent_sign_in.user.js</a></p>
         2947 ]]></description>
         2948 </item>
         2949 <item>
         2950         <title>Userscript: block stupid fonts</title>
         2951         <link>gopher://codemadness.org/1/phlog/userscript-block-stupid-fonts</link>
         2952         <guid>gopher://codemadness.org/1/phlog/userscript-block-stupid-fonts</guid>
         2953         <dc:date>2012-10-21T00:00:00Z</dc:date>
         2954         <author>Hiltjo</author>
         2955         <description><![CDATA[<h1>Userscript: block stupid fonts</h1>
         2956         <p><strong>Last modification on </strong> <time>2020-03-10</time></p>
         2957         <p>This is an userscript I wrote a while ago which white-lists fonts I like and
         2958 blocks the rest.  The reason I made this is because I don't like the
         2959 inconsistency of custom fonts used on a lot of websites.</p>
         2960 <h2>Download</h2>
         2961 <p><a href="downloads/block_stupid_fonts_v1.2.user.js">Download userscript Block_stupid_fonts_v1.2.user.js</a></p>
         2962 <p>Old version: <a href="downloads/block_stupid_fonts.user.js">Download userscript Block_stupid_fonts.user.js</a></p>
         2963 ]]></description>
         2964 </item>
         2965 <item>
         2966         <title>Sfeed: simple RSS and Atom parser</title>
         2967         <link>gopher://codemadness.org/1/phlog/sfeed</link>
         2968         <guid>gopher://codemadness.org/1/phlog/sfeed</guid>
         2969         <dc:date>2011-04-01T00:00:00Z</dc:date>
         2970         <author>Hiltjo</author>
         2971         <description><![CDATA[<h1>Sfeed: simple RSS and Atom parser</h1>
         2972         <p><strong>Last modification on </strong> <time>2022-11-05</time></p>
         2973         <p>Sfeed is a RSS and Atom parser (and some format programs).</p>
         2974 <p>It converts RSS or Atom feeds from XML to a TAB-separated file. There are
         2975 formatting programs included to convert this TAB-separated format to various
         2976 other formats. There are also some programs and scripts included to import and
         2977 export OPML and to fetch, filter, merge and order feed items.</p>
         2978 <p>For the most (up-to-date) information see the <a href="/git/sfeed/file/README.html">README</a>.</p>
         2979 <h2>Clone</h2>
         2980 <pre><code>git clone git://git.codemadness.org/sfeed
         2981 </code></pre>
         2982 <h2>Browse</h2>
         2983 <p>You can browse the source-code at:</p>
         2984 <ul>
         2985 <li><a href="https://git.codemadness.org/sfeed/">https://git.codemadness.org/sfeed/</a></li>
         2986 <li><a href="gopher://codemadness.org/1/git/sfeed">gopher://codemadness.org/1/git/sfeed</a></li>
         2987 </ul>
         2988 <h2>Download releases</h2>
         2989 <p>Releases are available at:</p>
         2990 <ul>
         2991 <li><a href="https://codemadness.org/releases/sfeed/">https://codemadness.org/releases/sfeed/</a></li>
         2992 <li><a href="gopher://codemadness.org/1/releases/sfeed">gopher://codemadness.org/1/releases/sfeed</a></li>
         2993 </ul>
         2994 <h2>Build and install</h2>
         2995 <pre><code>$ make
         2996 # make install
         2997 </code></pre>
         2998 <h2>Screenshot and examples</h2>
         2999 <p><a href="downloads/screenshots/sfeed-screenshot.png"><img src="downloads/screenshots/sfeed-thumb.png" alt="Screenshot of sfeed piped to sfeed_plain using dmenu in vertical-list mode" width="400" height="232" loading="lazy" /></a></p>
         3000 <p>The above screenshot uses the sfeed_plain format program with <a href="https://tools.suckless.org/dmenu/">dmenu</a>.  This
         3001 program outputs the feed items in a compact way per line as plain-text to
         3002 stdout.  The dmenu program reads these lines from stdin and displays them as a
         3003 X11 list menu. When an item is selected in dmenu it prints this item to stdout.
         3004 A simple written script can then filter for the URL in this output and do some
         3005 action, like opening it in some browser or open a podcast in your music player.</p>
         3006 <p>For example:</p>
         3007 <pre><code>#!/bin/sh
         3008 url=$(sfeed_plain "$HOME/.sfeed/feeds/"* | dmenu -l 35 -i | \
         3009         sed -n 's@^.* \([a-zA-Z]*://\)\(.*\)$@\1\2@p')
         3010 test -n "${url}" &amp;&amp; $BROWSER "${url}"
         3011 </code></pre>
         3012 <p>However this is just one way to format and interact with feed items.
         3013 See also the README for other practical examples.</p>
         3014 <p>Below are some examples of output that are supported by the included format
         3015 programs:</p>
         3016 <ul>
         3017 <li><a href="downloads/sfeed/plain/feeds.txt">plain text (UTF-8)</a></li>
         3018 <li><a href="downloads/sfeed/atom/feeds.xml">atom</a></li>
         3019 <li>gopher</li>
         3020 <li><a href="downloads/sfeed/html/feeds.html">HTML (CSS)</a></li>
         3021 <li><a href="downloads/sfeed/frames/index.html">HTML frames</a></li>
         3022 <li><a href="jsonfeed_content.json">JSON Feed</a></li>
         3023 <li><a href="downloads/sfeed/mbox/feeds.mbox">mbox</a></li>
         3024 <li><a href="downloads/sfeed/twtxt/twtxt.txt">twtxt</a></li>
         3025 </ul>
         3026 <p>There is also a curses UI front-end, see the page <a href="sfeed_curses.html">sfeed_curses</a>.
         3027 It is now part of sfeed.</p>
         3028 <h2>Videos</h2>
         3029 <p>Here are some videos of other people showcasing some of the functionalities of
         3030 sfeed, sfeed_plain and sfeed_curses.  To the creators: thanks for making these!</p>
         3031 <ul>
         3032 <li><a href="https://www.youtube.com/watch?v=RnuY32DP9jU">sfeed: RSS/Atom Feeds without the Suck (Youtube)</a><br />  
         3033 by <a href="https://www.youtube.com/channel/UCQQB104oMOos758GTOdx_kQ">noocsharp</a>
         3034 <a href="downloads/sfeed/videos/sfeed_without_the_suck.mp4">(mirror)</a><br />  
         3035 Video published on March 8 2020.</li>
         3036 <li><a href="https://www.youtube.com/watch?v=ok8k639GoRU">Sfeed - news in the terminal with minimalism (Youtube)</a><br />  
         3037 by <a href="https://www.youtube.com/channel/UCJetJ7nDNLlEzDLXv7KIo0w">Gavin Freeborn</a>
         3038 <a href="downloads/sfeed/videos/sfeed_news_in_terminal.mp4">(mirror)</a><br />  
         3039 Video published on January 15 2021.</li>
         3040 <li><a href="https://www.youtube.com/watch?v=xMkW4iJzot0">Sfeed - Peak Minimal RSS Feed Reader (Youtube)</a><br />  
         3041 by <a href="https://www.youtube.com/channel/UCld68syR8Wi-GY_n4CaoJGA">Brodie Robertson</a>
         3042 <a href="downloads/sfeed/videos/sfeed_minimalism.mp4">(mirror)</a><br />  
         3043 Video published on February 23 2021.</li>
         3044 <li><a href="https://www.youtube.com/watch?v=O8x0MAyqvt0">RSS with sfeed, fdm, and mblaze! (Youtube)</a><br />  
         3045 by <a href="https://www.youtube.com/channel/UCz_u0h4usMbnFsIHSVdjUQw">Joseph Choe</a>
         3046 <a href="downloads/sfeed/videos/rss_with_sfeed_fdm_and_mblaze.mp4">(mirror)</a><br />  
         3047 Website: <a href="https://josephchoe.com/rss-terminal">https://josephchoe.com/rss-terminal</a><br />  
         3048 Video published on 4 November 2022.</li>
         3049 </ul>
         3050 ]]></description>
         3051 </item>
         3052 <item>
         3053         <title>Vim theme: relaxed</title>
         3054         <link>gopher://codemadness.org/1/phlog/vim-theme-relaxed</link>
         3055         <guid>gopher://codemadness.org/1/phlog/vim-theme-relaxed</guid>
         3056         <dc:date>2011-01-07T00:00:00Z</dc:date>
         3057         <author>Hiltjo</author>
         3058         <description><![CDATA[<h1>Vim theme: relaxed</h1>
         3059         <p><strong>Last modification on </strong> <time>2011-01-07</time></p>
         3060         <p>This is a dark theme I made for <a href="https://www.vim.org/">vim</a>.  This is a theme I personally used for
         3061 quite a while now and over time tweaked to my liking.  It is made for gvim, but
         3062 also works for 16-colour terminals (with small visual differences).  The
         3063 relaxed.vim file also has my .Xdefaults file colours listed at the top for
         3064 16+-colour terminals on X11.</p>
         3065 <p>It is inspired by the "desert" theme available at
         3066 <a href="https://www.vim.org/scripts/script.php?script_id=105">https://www.vim.org/scripts/script.php?script_id=105</a>, although I removed the
         3067 cursive and bold styles and changed some colours I didn't like.</p>
         3068 <h2>Download</h2>
         3069 <p><a href="downloads/themes/vim/relaxed.vim">relaxed.vim</a></p>
         3070 <h2>Screenshot</h2>
         3071 <p><a href="downloads/themes/vim/vim_relaxed_theme.png"><img src="downloads/themes/vim/vim_relaxed_theme_thumb.png" alt="Screenshot of VIM theme relaxed on the left is gvim (GUI), on the right is vim in urxvt (terminal)" width="480" height="300" loading="lazy" /></a></p>
         3072 ]]></description>
         3073 </item>
         3074 <item>
         3075         <title>Seturgent: set urgency hints for X applications</title>
         3076         <link>gopher://codemadness.org/1/phlog/seturgent</link>
         3077         <guid>gopher://codemadness.org/1/phlog/seturgent</guid>
         3078         <dc:date>2010-10-31T00:00:00Z</dc:date>
         3079         <author>Hiltjo</author>
         3080         <description><![CDATA[<h1>Seturgent: set urgency hints for X applications</h1>
         3081         <p><strong>Last modification on </strong> <time>2020-07-20</time></p>
         3082         <p>Seturgent is a small utility to set an application its urgency hint.  For most
         3083 windowmanager's and panel applications this will highlight the application and
         3084 will allow special actions.</p>
         3085 <h2>Clone</h2>
         3086 <pre><code>    git clone git://git.codemadness.org/seturgent
         3087 </code></pre>
         3088 <h2>Browse</h2>
         3089 <p>You can browse the source-code at:</p>
         3090 <ul>
         3091 <li><a href="https://git.codemadness.org/seturgent/">https://git.codemadness.org/seturgent/</a></li>
         3092 <li><a href="gopher://codemadness.org/1/git/seturgent">gopher://codemadness.org/1/git/seturgent</a></li>
         3093 </ul>
         3094 <h2>Download releases</h2>
         3095 <p>Releases are available at:</p>
         3096 <ul>
         3097 <li><a href="https://codemadness.org/releases/seturgent/">https://codemadness.org/releases/seturgent/</a></li>
         3098 <li><a href="gopher://codemadness.org/1/releases/seturgent">gopher://codemadness.org/1/releases/seturgent</a></li>
         3099 </ul>
         3100 ]]></description>
         3101 </item>
         3102 <item>
         3103         <title>DWM-hiltjo: my windowmanager configuration</title>
         3104         <link>gopher://codemadness.org/1/phlog/dwm</link>
         3105         <guid>gopher://codemadness.org/1/phlog/dwm</guid>
         3106         <dc:date>2010-08-12T00:00:00Z</dc:date>
         3107         <author>Hiltjo</author>
         3108         <description><![CDATA[<h1>DWM-hiltjo: my windowmanager configuration</h1>
         3109         <p><strong>Last modification on </strong> <time>2020-07-20</time></p>
         3110         <p><a href="https://dwm.suckless.org/">DWM</a> is a very minimal windowmanager. It has the most essential features I
         3111 need, everything else is "do-it-yourself" or extending it with the many
         3112 available <a href="https://dwm.suckless.org/patches/">patches</a>. The vanilla version is less than 2000 SLOC. This makes it
         3113 easy to understand and modify it.</p>
         3114 <p>I really like my configuration at the moment and want to share my changes. Some
         3115 of the features listed below are patches from suckless.org I applied, but there
         3116 are also some changes I made.</p>
         3117 <p>This configuration is entirely tailored for my preferences of course.</p>
         3118 <h2>Features</h2>
         3119 <ul>
         3120 <li>Titlebar:
         3121 <ul>
         3122 <li>Shows all clients of the selected / active tags.</li>
         3123 <li>Divide application titlebars evenly among available space.</li>
         3124 <li>Colour urgent clients in the taskbar on active tags.</li>
         3125 <li>Left-click focuses clicked client.</li>
         3126 <li>Right-click toggles monocle layout.</li>
         3127 <li>Middle-click kills the clicked client.</li>
         3128 </ul>
         3129 </li>
         3130 <li>Tagbar:
         3131 <ul>
         3132 <li>Only show active tags.</li>
         3133 <li>Colour inactive tags with urgent clients.</li>
         3134 </ul>
         3135 </li>
         3136 <li>Layouts:
         3137 <ul>
         3138 <li>Cycle layouts with Modkey + Space (next) and Modkey + Control + Space
         3139 (previous).</li>
         3140 <li>Fullscreen layout (hides topbar and removes borders).</li>
         3141 </ul>
         3142 </li>
         3143 <li>Other:
         3144 <ul>
         3145 <li>Move tiled clients around with the mouse (drag-move), awesomewm-like.</li>
         3146 <li>Add some keybinds for multimedia keyboards (audio play / pause, mute, www,
         3147 volume buttons, etc).</li>
         3148 </ul>
         3149 </li>
         3150 <li>... and more ;) ...</li>
         3151 </ul>
         3152 <h2>Clone</h2>
         3153 <pre><code>git clone -b hiltjo git://git.codemadness.org/dwm
         3154 </code></pre>
         3155 <h2>Screenshot</h2>
         3156 <p><a href="downloads/screenshots/dwm-screenshot.png"><img src="downloads/screenshots/dwm-screenshot-thumb.png" alt="Screenshot showing what dwm-hiltjo looks like" width="480" height="300" loading="lazy" /></a></p>
         3157 ]]></description>
         3158 </item>
         3159 <item>
         3160         <title>Query unused CSS rules on current document state</title>
         3161         <link>gopher://codemadness.org/1/phlog/query-unused-css-rules-on-current-document-state</link>
         3162         <guid>gopher://codemadness.org/1/phlog/query-unused-css-rules-on-current-document-state</guid>
         3163         <dc:date>2010-04-21T00:00:00Z</dc:date>
         3164         <author>Hiltjo</author>
         3165         <description><![CDATA[<h1>Query unused CSS rules on current document state</h1>
         3166         <p><strong>Last modification on </strong> <time>2010-04-21</time></p>
         3167         <p>Today I was doing some web development and wanted to see all the rules in a
         3168 stylesheet (CSS) that were not used for the current document. I wrote the
         3169 following Javascript code which you can paste in the Firebug console and run:</p>
         3170 <pre><code>(function() {
         3171         for (var i=0;i&lt;document.styleSheets.length;i++) {
         3172                 var rules = document.styleSheets[i].cssRules || [];
         3173                 var sheethref = document.styleSheets[i].href || 'inline';
         3174                 for (var r=0;r&lt;rules.length;r++)
         3175                         if (!document.querySelectorAll(rules[r].selectorText).length)
         3176                                 console.log(sheethref + ': "' + rules[r].selectorText + '" not found.');
         3177         }
         3178 })();
         3179 </code></pre>
         3180 <p>This will output all the (currently) unused CSS rules per selector, the output can be for example:</p>
         3181 <pre><code>http://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: "fieldset, a img" not found.
         3182 http://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: "#headerimg" not found.
         3183 http://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: "a:hover" not found.
         3184 http://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: "h2 a:hover, h3 a:hover" not found.
         3185 http://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: ".postmetadata-center" not found.
         3186 http://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: ".thread-alt" not found.
         3187 </code></pre>
         3188 <p>Just a trick I wanted to share, I hope someone finds this useful :)</p>
         3189 <p>For webkit-based browsers you can use "Developer Tools" and use "Audits" under
         3190 "Web Page Performance" it says "Remove unused CSS rules". For Firefox there is
         3191 also Google Page Speed: <a href="https://code.google.com/speed/page-speed/">https://code.google.com/speed/page-speed/</a> this adds
         3192 an extra section under Firebug.</p>
         3193 <p>Tested on Chrome and Firefox.</p>
         3194 ]]></description>
         3195 </item>
         3196 <item>
         3197         <title>Driconf: enabling S3 texture compression on Linux</title>
         3198         <link>gopher://codemadness.org/1/phlog/driconf</link>
         3199         <guid>gopher://codemadness.org/1/phlog/driconf</guid>
         3200         <dc:date>2009-07-05T00:00:00Z</dc:date>
         3201         <author>Hiltjo</author>
         3202         <description><![CDATA[<h1>Driconf: enabling S3 texture compression on Linux</h1>
         3203         <p><strong>Last modification on </strong> <time>2020-08-21</time></p>
         3204         <p><strong>Update: the DXTC patent expired on 2018-03-16, many distros enable this by
         3205 default now.</strong></p>
         3206 <p>S3TC (also known as DXTn or DXTC) is a patented lossy texture compression
         3207 algorithm.  See: <a href="https://en.wikipedia.org/wiki/S3TC">https://en.wikipedia.org/wiki/S3TC</a> for more detailed
         3208 information.  Many games use S3TC and if you use Wine to play games you
         3209 definitely want to enable it if your graphics card supports it.</p>
         3210 <p>Because this algorithm was <a href="https://dri.freedesktop.org/wiki/S3TC/">patented it is disabled by default on many Linux
         3211 distributions</a>.</p>
         3212 <p>To enable it you can install the library "libtxc" if your favorite OS has not
         3213 installed it already.</p>
         3214 <p>For easy configuration you can install the optional utility DRIconf, which you
         3215 can find at: <a href="https://dri.freedesktop.org/wiki/DriConf">https://dri.freedesktop.org/wiki/DriConf</a>.  DriConf can safely be
         3216 removed after configuration.</p>
         3217 <h2>Steps to enable it</h2>
         3218 <p>Install libtxc_dxtn:</p>
         3219 <p>ArchLinux:
         3220 <pre><code># pacman -S libtxc_dxtn
         3221 </code></pre>
         3222 <p>Debian:
         3223 <pre><code># aptitude install libtxc-dxtn-s2tc0
         3224 </code></pre>
         3225 </p>
         3226 </p>
         3227 <p>Install driconf (optional):</p>
         3228 <p>ArchLinux:</p>
         3229 <pre><code># pacman -S driconf
         3230 </code></pre>
         3231 <p>Debian:</p>
         3232 <pre><code># aptitude install driconf
         3233 </code></pre>
         3234 <p>Run driconf and enable S3TC:</p>
         3235 <p><a href="downloads/screenshots/driconf.png"><img src="downloads/screenshots/driconf-thumb.png" alt="Screenshot of DRIconf window and its options" width="300" height="266" loading="lazy" /></a></p>
         3236 <h2>Additional links</h2>
         3237 <ul>
         3238 <li>S3TC: <a href="https://dri.freedesktop.org/wiki/S3TC/">https://dri.freedesktop.org/wiki/S3TC/</a></li>
         3239 <li>DriConf: <a href="https://dri.freedesktop.org/wiki/DriConf">https://dri.freedesktop.org/wiki/DriConf</a></li>
         3240 </ul>
         3241 ]]></description>
         3242 </item>
         3243 <item>
         3244         <title>Getting the USB-powerline bridge to work on Linux</title>
         3245         <link>gopher://codemadness.org/1/phlog/getting-the-usb-powerline-bridge-to-work-on-linux</link>
         3246         <guid>gopher://codemadness.org/1/phlog/getting-the-usb-powerline-bridge-to-work-on-linux</guid>
         3247         <dc:date>2009-04-13T00:00:00Z</dc:date>
         3248         <author>Hiltjo</author>
         3249         <description><![CDATA[<h1>Getting the USB-powerline bridge to work on Linux</h1>
         3250         <p><strong>Last modification on </strong> <time>2019-12-06</time></p>
         3251         <p><strong>NOTE: this guide is obsolete, a working driver is now included in the Linux
         3252 kernel tree (<a href="https://lkml.org/lkml/2009/4/18/121">since Linux 2.6.31</a>)</strong></p>
         3253 <h2>Introduction</h2>
         3254 <p>A USB to powerline bridge is a network device that instead of using an ordinary
         3255 Ethernet cable (CAT5 for example) or wireless LAN it uses the powerlines as a
         3256 network to communicate with similar devices.  A more comprehensive explanation
         3257 of what it is and how it works you can find here:
         3258 <a href="https://en.wikipedia.org/wiki/IEEE_1901">https://en.wikipedia.org/wiki/IEEE_1901</a>.</p>
         3259 <p>Known products that use the Intellon 51x1 chipset:</p>
         3260 <ul>
         3261 <li>MicroLink dLAN USB</li>
         3262 <li>"Digitus network"</li>
         3263 <li>Intellon USB Ethernet powerline adapter</li>
         3264 <li>Lots of other USB-powerline adapters...</li>
         3265 </ul>
         3266 <p>To check if your device is supported:</p>
         3267 <pre><code>$ lsusb | grep -i 09e1
         3268 Bus 001 Device 003: ID 09e1:5121 Intellon Corp.
         3269 </code></pre>
         3270 <p>If the vendor (09e1) and product (5121) ID match then it's probably supported.</p>
         3271 <h2>Installation</h2>
         3272 <p>Get drivers from the official site:
         3273 <a href="http://www.devolo.co.uk/consumer/downloads-44-microlink-dlan-usb.html?l=en">http://www.devolo.co.uk/consumer/downloads-44-microlink-dlan-usb.html?l=en</a> or
         3274 <a href="downloads/int51x1/dLAN-linux-package-v4.tar.gz">mirrored here</a>.
         3275 The drivers from the official site were/are more up-to-date.</p>
         3276 <p>Extract them:</p>
         3277 <pre><code>$ tar -xzvf dLAN-linux-package-v4.tar.gz
         3278 </code></pre>
         3279 <p>Go to the extracted directory and compile them:</p>
         3280 <pre><code>$ ./configure
         3281 $ make
         3282 </code></pre>
         3283 <p>Depending on the errors you got you might need to <a href="downloads/int51x1/int51x1.patch">download</a> and apply
         3284 my patch:</p>
         3285 <pre><code>$ cd dLAN-linux-package-v4/     (or other path to the source code)
         3286 $ patch &lt; int51x1.patch
         3287 </code></pre>
         3288 <p>Try again:</p>
         3289 <pre><code>$ ./configure
         3290 $ make
         3291 </code></pre>
         3292 <p>If that failed try:</p>
         3293 <pre><code>$ ./configure
         3294 $ KBUILD_NOPEDANTIC=1 make
         3295 </code></pre>
         3296 <p>If that went OK install the drivers (as root):</p>
         3297 <pre><code># make install
         3298 </code></pre>
         3299 <p>Check if the "devolo_usb" module is loaded:</p>
         3300 <pre><code>$ lsmod | grep -i devolo_usb
         3301 </code></pre>
         3302 <p>If it shows up then it's loaded. Now check if the interface is added:</p>
         3303 <pre><code>$ ifconfig -a | grep -i dlanusb
         3304 dlanusb0 Link encap:Ethernet HWaddr 00:12:34:56:78:9A
         3305 </code></pre>
         3306 <h2>Configuration</h2>
         3307 <p>It is assumed you use a static IP, otherwise you can just use your DHCP client
         3308 to get an unused IP address from your DHCP server. Setting up the interface is
         3309 done like this (change the IP address and netmask accordingly if it's
         3310 different):</p>
         3311 <pre><code># ifconfig dlanusb0 192.168.2.12 netmask 255.255.255.0
         3312 </code></pre>
         3313 <h2>Checking if the network works</h2>
         3314 <p>Try to ping an IP address on your network to test for a working connection:</p>
         3315 <pre><code>$ ping 192.168.2.1
         3316 PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
         3317 64 bytes from 192.168.2.1: icmp_seq=1 ttl=30 time=2.49 ms
         3318 64 bytes from 192.168.2.1: icmp_seq=2 ttl=30 time=3.37 ms
         3319 64 bytes from 192.168.2.1: icmp_seq=3 ttl=30 time=2.80 ms
         3320 --- 192.168.2.1 ping statistics ---
         3321 3 packets transmitted, 3 received, 0% packet loss, time 2005ms
         3322 rtt min/avg/max/mdev = 2.497/2.891/3.374/0.368 ms
         3323 </code></pre>
         3324 <p>You can now set up a network connection like you normally do with any Ethernet
         3325 device.  The route can be added like this for example:</p>
         3326 <pre><code># route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.2.1 dlanusb0
         3327 </code></pre>
         3328 <p>Change the IP address of your local gateway accordingly. Also make sure your
         3329 nameserver is set in /etc/resolv.conf, something like:</p>
         3330 <pre><code>nameserver 192.168.2.1
         3331 </code></pre>
         3332 <p>Test your internet connection by doing for example:</p>
         3333 <pre><code>$ ping codemadness.org
         3334 PING codemadness.org (64.13.232.151) 56(84) bytes of data.
         3335 64 bytes from acmkoieeei.gs02.gridserver.com (64.13.232.151): icmp_seq=1 ttl=52 time=156 ms
         3336 64 bytes from acmkoieeei.gs02.gridserver.com (64.13.232.151): icmp_seq=2 ttl=52 time=156 ms
         3337 64 bytes from acmkoieeei.gs02.gridserver.com (64.13.232.151): icmp_seq=3 ttl=52 time=155 ms
         3338 --- codemadness.org ping statistics ---
         3339 3 packets transmitted, 3 received, 0% packet loss, time 1999ms
         3340 rtt min/avg/max/mdev = 155.986/156.312/156.731/0.552 ms
         3341 </code></pre>
         3342 <p>If this command failed you probably have not setup your DNS/gateway properly.
         3343 If it worked then good for you :)</p>
         3344 <h2>References</h2>
         3345 <ul>
         3346 <li><a href="http://www.devolo.co.uk/consumer/downloads-44-microlink-dlan-usb.html?l=en">Devolo download page with drivers (USB version).</a></li>
         3347 <li><a href="downloads/int51x1/dLAN-linux-package-v4.tar.gz">dLAN-linux-package-v4.tar.gz</a></li>
         3348 <li><a href="downloads/int51x1/int51x1.patch">Patch for recent 2.6.x kernels</a></li>
         3349 <li><a href="downloads/int51x1/INT51X1_datasheet.pdf">INT51X1 datasheet</a></li>
         3350 </ul>
         3351 ]]></description>
         3352 </item>
         3353 <item>
         3354         <title>Gothic 1 game guide</title>
         3355         <link>gopher://codemadness.org/1/phlog/gothic</link>
         3356         <guid>gopher://codemadness.org/1/phlog/gothic</guid>
         3357         <dc:date>2009-04-12T00:00:00Z</dc:date>
         3358         <author>Hiltjo</author>
         3359         <description><![CDATA[<h1>Gothic 1 game guide</h1>
         3360         <p><strong>Last modification on </strong> <time>2026-03-14</time></p>
         3361         <p><strong>Disclaimer:</strong>
         3362 Some (including myself) may find some of these hints/exploits cheating. This
         3363 guide is just for educational and fun purposes. Some of these hints/tips apply
         3364 to Gothic 2 as well. I got the meat exploit from a guide somewhere on the
         3365 internet I can't recall where, anyway kudos to that person. Some of the
         3366 exploits I discovered myself.</p>
         3367 <h2>Configuration</h2>
         3368 <h3>Widescreen resolution</h3>
         3369 <p>Gothic supports widescreen resolutions with a small tweak, add the following
         3370 text string as a command-line argument:</p>
         3371 <pre><code>-zRes:1920,1200,32
         3372 </code></pre>
         3373 <p>This also works for Gothic 2. Here 1920 is the width, 1200 the height and 32
         3374 the bits per pixel, change this to your preferred resolution.</p>
         3375 <h3>Fix crash with Steam version</h3>
         3376 <p>Disable steam overlay. If that doesn't work rename GameOverlayRenderer.dll in
         3377 your steam folder to _GameOverlayRenderer.dll.  I strongly recommend to buy the
         3378 better version from <a href="https://www.gog.com/game/gothic">GOG.com</a>.  The GOG version has no DRM and allows easier
         3379 modding, it also allows playing in most published languages: German, English,
         3380 Polish, furthermore it has some original artwork and soundtrack included.</p>
         3381 <h3>Upgrade Steam version to stand-alone version and remove Steam DRM (Gothic 1 and 2)</h3>
         3382 <p>You can install the Gothic playerkit and patches to remove the Steam DRM.</p>
         3383 <p><a href="https://www.worldofgothic.de/">WorldOfGothic</a> playerkit patches:</p>
         3384 <ul>
         3385 <li>Gothic 1 (EN):    <a href="https://www.worldofgothic.com/dl/?go=dlfile&amp;fileid=28">https://www.worldofgothic.com/dl/?go=dlfile&amp;fileid=28</a></li>
         3386 <li>Gothic 1 (DE):    <a href="https://www.worldofgothic.de/dl/download_34.htm">https://www.worldofgothic.de/dl/download_34.htm</a></li>
         3387 <li>Gothic 2 (EN/DE): <a href="https://www.worldofgothic.de/dl/download_168.htm">https://www.worldofgothic.de/dl/download_168.htm</a></li>
         3388 </ul>
         3389 <h3>Play Gothic in a different language with English subtitles</h3>
         3390 <p>If you're like me and have played the English version many times, but would
         3391 like to hear the (original) German voice audio or if you would like to play
         3392 with different audio than you're used to, then you can copy the speech.vdf file
         3393 of your preferred version to your game files. Optionally turn on subtitles.
         3394 I've used this to play the English version of Gothic with the original German
         3395 voice audio and English subtitles.
         3396 This works best with the version from GOG as it allows easier modding.</p>
         3397 <h2>Easy money/weapons/armour/other items</h2>
         3398 <h3>Steal from Huno</h3>
         3399 <p>At night attack Huno the smith in the Old Camp and steal all his steel. Then
         3400 make some weapons and sell them with a merchant.  When you ask Huno about
         3401 blacksmith equipment it will respawn with 5 of each kind of steel. This is also
         3402 a fairly good starting weapon (requires 20 strength).  Also his chest located
         3403 near the sharpening stone and fire contains some steel as well, lock-pick it.
         3404 The combination is: RRLRLL. The chest contains at least 20 raw steel, forge it
         3405 to get 20 crude swords which you can sell for 50 ore each to a merchant.  This
         3406 will generate some nice starting money (1000+ ore) :)</p>
         3407 <h3>Steal weapons from the castle in the Old Camp</h3>
         3408 <p>This tip is useful for getting pretty good starting weapons.</p>
         3409 <p>Before entering the castle itself drop your ore (Left control + down for me)
         3410 in front of it. This will ensure when you get caught (and you probably will ;))
         3411 no ore will get stolen by the guards. Now use the "slip past guard" technique
         3412 described below and you should be able to get into Gomez his castle. Run to the
         3413 left where some weapons are stored. Now make sure you at least steal the best
         3414 weapon (battle sword) and steal as much as you can until you get whacked.  I
         3415 usually stand in the corner since that's where the best weapons are (battle
         3416 sword, judgement sword, etc). You'll now have some nice starting weapon(s) and
         3417 the good thing is they require very little attributes (about 13 strength).</p>
         3418 <p>Location: <a href="downloads/gothic1/old_camp_swords.png">screenshot</a></p>
         3419 <h3>Free scraper armour the New Camp</h3>
         3420 <p>In the New Camp go to the mine and talk to Swiney at the bottom of "The
         3421 Hollow". Ask who he is and then ask to join the scrapers.  He will give you a
         3422 "Diggers dress" worth 250 ore. It has the following stats: + 10 against
         3423 weapons. + 5 against fire.  This will also give you free entrance to the bar in
         3424 the New Camp.</p>
         3425 <h3>Unlimited water bottles in the New Camp</h3>
         3426 <p>In the quest from Lefty you will be assigned to get water bottles from the
         3427 rice lord.  He will give you infinite amounts of water bottles, in batches of
         3428 12.</p>
         3429 <h3>Armour amulet and increase HP potion</h3>
         3430 <p>In the Old Camp in the main castle there are at least 3 chests with valuable
         3431 items that don't require a key:</p>
         3432 <ul>
         3433 <li><p>Middle right side (looking from the entrance), 1 chest:
         3434 <ul>
         3435 <li>lock combination: LLLLRLRL</li>
         3436 <li>loot:
         3437 <ul>
         3438 <li>+15 against weapons, +15 against arrows (amulet of stone skin)
         3439 (worth: 1000 ore)</li>
         3440 </ul>
         3441 </li>
         3442 <li>additionally there are 2 locked doors at the right side in this room. In
         3443 the final room there are 3 floors with lots of chests.<br />  
         3444 <a href="downloads/gothic1/video/amulet.mp4">Video of the location</a></li>
         3445 </ul>
         3446 </p>
         3447 </li>
         3448 <li><p>Left side, 1 chest:
         3449 <ul>
         3450 <li>lock combination: RLLLLLRR</li>
         3451 <li>loot:
         3452 <ul>
         3453 <li>+8 mana amulet (worth: 600 ore)</li>
         3454 <li>2 potions (+70 hp)</li>
         3455 <li>dreamcall (weed)</li>
         3456 <li>120 coins (worth: nothing)</li>
         3457 </ul>
         3458 </li>
         3459 </ul>
         3460 </p>
         3461 </li>
         3462 <li><p>Right side, 2 chests with:
         3463 <ul>
         3464 <li>lock combination: RLLLRLLR</li>
         3465 <li>loot:
         3466 <ul>
         3467 <li>armour amulets, +15 against weapons (worth: 600 ore)</li>
         3468 <li>maximum life potion, +10 maximum life (worth: 1000 ore)</li>
         3469 <li>speed potion (1 minute duration)</li>
         3470 <li>4 potions (+70 hp)</li>
         3471 </ul>
         3472 </li>
         3473 </ul>
         3474 </p>
         3475 </li>
         3476 </ul>
         3477 <h3>Swamp/Sect Camp harvest twice</h3>
         3478 <p>In the swamp-weed harvest quest you must get swamp-weed for a guru. After this
         3479 quest you can get the harvest again, but you can keep the harvest without
         3480 consequences.</p>
         3481 <h2>Exploits</h2>
         3482 <h3>Slip past guards</h3>
         3483 <p>This exploit is really simple, just draw your weapon before you're "targeted"
         3484 by the guard and run past them, this bypasses the dialog sequence.  When you're
         3485 just out of their range holster your weapon again, so the people around won't
         3486 get pissed off.</p>
         3487 <p>Works really well on the guards in front of the Old camp's castle, Y'Berrion
         3488 templars and New Camp mercenaries near the Water magicians, just to name a few.</p>
         3489 <p><a href="downloads/gothic1/video/amulet.mp4">Video</a></p>
         3490 <h3>Meat duplication</h3>
         3491 <p>Go to a pan and focus / target it so it says "frying pan" or similar. Now open
         3492 your inventory and select the meat. Now cook the meat (for me Left Control +
         3493 Arrow up). The inventory should remain open. You'll now have twice as much meat
         3494 as you had before. Do this a few times and you'll have a lot of meat, easy for
         3495 trading with ore/other items as well. This exploit does not work with the
         3496 community patch applied.</p>
         3497 <h3>Glitch through (locked) doors and walls</h3>
         3498 <p>You can glitch through walls by strafing into them. Then when the player is
         3499 partially collided into a door or wall you can jump forward to glitch through
         3500 it.</p>
         3501 <p><a href="downloads/gothic1/video/bloodsword.mp4">Video</a></p>
         3502 <h3>Fall from great heights</h3>
         3503 <p>When you fall or jump from where you usually get fall damage you can do the
         3504 following trick: slightly before the ground use left or right strafe.  This
         3505 works because it resets the falling animation. There are also other ways to
         3506 achieve the same thing cancelling the falling animation, such as attacking with
         3507 a weapon in the air.</p>
         3508 <p><a href="downloads/gothic1/video/fall.mp4">Video</a></p>
         3509 <h2>Experience / level up tips</h2>
         3510 <h3>Test of faith (extra exp)</h3>
         3511 <p>You get an additional 750 exp (from Lares) when you forge the letter in the new
         3512 camp and then give it to Diego. You can still join both camps after this.</p>
         3513 <h3>Fighting skeleton mages and their skeletons</h3>
         3514 <p>An easy way to get more experience is to let the skeleton mages summon as much
         3515 skeletons as they can, instead of rushing to kill the summoner immediately.
         3516 After you have defeated all of them: kill the skeleton mage.</p>
         3517 <h3>Permanent str/dex/mana/hp potions/items and teachers</h3>
         3518 <p>When you want to get the maximum power at the end of the game you should save
         3519 up the items that give you a permanent boost. Teachers of strength, dexterity
         3520 and mana won't train over 100 of each skill.  However using potions and quest
         3521 rewards you can increase this over 100.</p>
         3522 <p>You should also look out for the following:</p>
         3523 <ul>
         3524 <li><p>Learn to get extra force into your punch from Horatio (strength +5, this
         3525 can't be done after level 100 strength). Talking to Jeremiah in the New Camp
         3526 bar unlocks the dialog option to train strength at Horatio.</p>
         3527 </li>
         3528 <li><p>Smoke the strongest non-quest joint (+2 mana).</p>
         3529 </li>
         3530 </ul>
         3531 <h3>Permanent potions in Sleeper temple</h3>
         3532 <p>This one is really obvious, but I would like to point out the mummy's on each
         3533 side where Xardas is located have lots and I mean lots of permanent potions.
         3534 This will give you a nice boost before the end battle.</p>
         3535 <p>Location, left and right corridor in the Sleeper temple: <a href="downloads/gothic1/sleeper_temple_potions.png">screenshot</a><br />  
         3536 Mummies, you can loot them: <a href="downloads/gothic1/sleeper_temple_potions_mummies.png">screenshot</a><br />  </p>
         3537 <h3>Permanent potions as reward in quests</h3>
         3538 <p>Always pick the permanent potion as a reward for quests when you can, for
         3539 example the quest for delivering the message to the High Fire magicians (mana
         3540 potion) or the one for fetching the almanac for the Sect Camp.  Don't forget to
         3541 pick up the potions from Riordian the water magician when you're doing the
         3542 focus stones quest, it contains a strength and dexterity potion (+3).</p>
         3543 <h3>Improve ancient ore armour further</h3>
         3544 <p>In the last chapters the blacksmith Stone from the Old Camp is captured If you
         3545 save him from the prison cell in the Old Camp the reward will have a few
         3546 options.  One of the options is improving the Ancient Ore armour.</p>
         3547 <h2>Good early game weapons available in chapter 1</h2>
         3548 <h3>Orc Hammer</h3>
         3549 <p>Location: in a cave near bloodhounds near the mountain fort.<br />  
         3550 It can be reached from a path from the swamp camp up to the mountain.
         3551 Watch out for the bloodhounds. They can instantly kill you in the early game.</p>
         3552 <p>Location: <a href="downloads/gothic1/early_weapon_old_orc_hammer_location.png">screenshot</a><br />  
         3553 Stats: <a href="downloads/gothic1/early_weapon_old_orc_hammer_stats.png">screenshot</a><br />  </p>
         3554 <p>Stats:
         3555 <ul>
         3556 <li>Type: one-handed</li>
         3557 <li>Damage: 50</li>
         3558 <li>Required strength: 22</li>
         3559 <li>Worth: 1000 ore</li>
         3560 </ul>
         3561 </p>
         3562 <p>It has very low strength stat requirement and has high damage for the early
         3563 game chapters.  A downside is the lower weapon swing range.
         3564 It is also a decent weapon against stone golems.</p>
         3565 <h3>Old Battle Axe</h3>
         3566 <p>Location: near Xardas his tower.<br />  
         3567 Watch out for a group of Biters lurking there.</p>
         3568 <p>Location: <a href="downloads/gothic1/early_weapon_old_battle_axe_location.png">screenshot</a><br />  
         3569 Stats: <a href="downloads/gothic1/early_weapon_old_battle_axe_stats.png">screenshot</a><br />  </p>
         3570 <p>Stats:
         3571 <ul>
         3572 <li>Type: two-handed</li>
         3573 <li>Damage: 67</li>
         3574 <li>Required strength: 36</li>
         3575 <li>Worth: 1800 ore</li>
         3576 </ul>
         3577 </p>
         3578 <p>It has a relatively low strength requirements and is available in game chapter
         3579 1 or could be sold for a decent amount.</p>
         3580 <h3>Random/beginner tips</h3>
         3581 <ul>
         3582 <li><p>If you want to talk to a NPC, but some animation of them takes too long (like
         3583 eating, drinking, smoking) you can sometimes force them out of it by quickly
         3584 unsheathing/sheathing your weapon.</p>
         3585 </li>
         3586 <li><p>When in the Old Camp: Baal Parvez can take you to the Sect Camp, he can be
         3587 found near the campfire near Fisk and Dexter.
         3588 Mordrag can take you to the New Camp, he can be found near the south gate,
         3589 slightly after the campfire near Baal Parvez.</p>
         3590 <p>When you follow them and when they kill monsters then you also get the
         3591 experience.</p>
         3592 </li>
         3593 <li><p>The NPC Wolf in the New Camp sells "The Bloodflies" book for 150 ore. When
         3594 you read this book you learn how to remove bloodflies parts (without having to
         3595 spend learning points). After you read the book and learned its skill then you
         3596 can sell the book back for 75 ore. This investment quickly pays back: Per
         3597 bloodfly: sting: 25 ore (unsold value), 2x wings (15 ore each unsold value).</p>
         3598 </li>
         3599 <li><p>The templar Gor Na Drak (usually near the old mine and walks around with
         3600 another templar): talking to him teaches you how to learn to get secretion from
         3601 minecrawlers for free.</p>
         3602 </li>
         3603 <li><p>The spell scroll "Transform into bloodfly" is very useful:
         3604 <ul>
         3605 <li>A bloodfly is very fast.</li>
         3606 <li>Can also fly over water.</li>
         3607 <li>The scroll costs 100 ore. Its the same price as a potion of speed, but it
         3608 has no duration (just until you transform back).</li>
         3609 <li>You have no fall damage.</li>
         3610 <li>You can climb some steep mountains this way.</li>
         3611 <li>Some monsters won't attack you, but some NPCs will attack you.</li>
         3612 <li>Your attribute stats will temporary change.</li>
         3613 <li>It requires 10 mana to cast (low requirement).</li>
         3614 </ul>
         3615 </p>
         3616 </li>
         3617 <li><p>Almost all mummies that are lootable in the game (Orc temple and The Sleeper
         3618 temple) have really good loot: permanent and regular potions and amulets and
         3619 rings.<br />  </p>
         3620 </li>
         3621 <li><p>Skill investments:
         3622 <ul>
         3623 <li>For melee skills:
         3624 <ul>
         3625 <li>Strength</li>
         3626 <li>One-handed weapons have a bit lower weapon damage but are less clunky and
         3627 faster. You can also interrupt enemy attacks.</li>
         3628 <li>Two-handed weapons have the highest damage, but are slower.</li>
         3629 <li>Get at least the first tier of one-handed training. It will change the
         3630 combat animations and make combat less slow and clunky.</li>
         3631 </ul>
         3632 </li>
         3633 <li>For ranged skills:
         3634 <ul>
         3635 <li>Dexterity</li>
         3636 <li>Cross-bows have high damage and are very good.
         3637 <ul>
         3638 <li>Cross-bow: the path for cross-bow training is easier in the old camp.
         3639 When you become the Old Camp guard Scorpio can train you. Later in the
         3640 game in chapter 4 after some story progression he will train everyone.</li>
         3641 </ul>
         3642 </li>
         3643 </ul>
         3644 </li>
         3645 <li>For mage characters:
         3646 <ul>
         3647 <li>Investing a little bit into strength, lets say 30 STR is OK.</li>
         3648 <li>Magic skills are powerful but are a bit clunky and slow.</li>
         3649 <li>Joining the Old Camp (fire mage) or New Camp (water mage) for the magician
         3650 path is probably easier.</li>
         3651 </ul>
         3652 </li>
         3653 <li>Harvest animals:
         3654 <ul>
         3655 <li>Early investments of a few skill points into getting skins, teeth and claws
         3656 from animals is OK (it is easy to get a lot of ore if you loot everything
         3657 though).</li>
         3658 </ul>
         3659 </li>
         3660 <li>Lockpicking: training in lockpicking only reduces the chance to break locks
         3661 when you fail the combination. Investing in it is OK but not necessary.
         3662 A small cheat: the lock pick combination stays the same, you can save and
         3663 reload the game to avoid losing lockpicks.</li>
         3664 <li>Bad skill investments to avoid:
         3665 <ul>
         3666 <li>Sneak and pickpocket are nearly useless.</li>
         3667 </ul>
         3668 </li>
         3669 </ul>
         3670 </p>
         3671 </li>
         3672 </ul>
         3673 <p>Overall recommendation: I'd recommend a hybrid of melee/magic or melee/range.
         3674 Early game for melee: get max strength to 100 and get at least the first tier
         3675 of one-handed training.<br />  
         3676 In the later game focus more on ranged combat or learning the magic circles.</p>
         3677 <h1>Side-quest Chromanin / The Stranger</h1>
         3678 <p>This describes an interesting side quest in the Gothic 1 game, which is not too
         3679 obvious to find and may be overlooked.</p>
         3680 <p>The first Chromanin book is found by defeating the skeleton mage in the Fog
         3681 Tower. On its bones you can find the Chromanin book. Reading the book starts
         3682 the Chromanin / The Stranger quest.  The books contain some typos, being
         3683 demonicly possessed could be an excuse for that :)</p>
         3684 <p>Note that the Old books only spawn in a specific order after reading each found
         3685 book.  So they have to be done in this specific order.</p>
         3686 <p><a href="downloads/gothic1/chromanin/0_mage_fog_tower.png">Fog tower mage</a><br />  
         3687 <a href="downloads/gothic1/chromanin/0_fog_tower.png">Location</a><br />  
         3688 <a href="downloads/gothic1/chromanin/0_map.png">Map</a><br />  </p>
         3689 <p>Text:</p>
         3690 <pre><code>"He who is willing to
         3691 renounce all depravity
         3692 and wanders on the path
         3693 of righteousness, shall
         3694 know where the source
         3695 of my power lies
         3696 hidden. So that he might
         3697 use it to break the chains
         3698 of this world and prove
         3699 worthy to receive Chromanin."
         3700 
         3701 "The Wise One sees to
         3702 having a general overview before he
         3703 dedicates himself to his
         3704 next mission."
         3705 </code></pre>
         3706 <h2>Chromanin</h2>
         3707 <p>The clue is in the words "general overview" on the second page.
         3708 One of the highest points on the map is the tower where you find and free the orc Ur-Shak
         3709 from being attacked by other orcs.</p>
         3710 <p>The Wise One sees to having a general overview before he dedicates himself to
         3711 his next mission".<br />  
         3712 Location: on top of the tower near where the orc Ur-Shak was.<br />  
         3713 Item: Old Book.</p>
         3714 <p><a href="downloads/gothic1/chromanin/1_book.png">Item</a><br />  
         3715 <a href="downloads/gothic1/chromanin/1_tower.png">Location</a><br />  
         3716 <a href="downloads/gothic1/chromanin/1_map.png">Map</a><br />  </p>
         3717 <h2>Chromanin 2</h2>
         3718 <p>Text:</p>
         3719 <pre><code>"Carried from the tides
         3720 of time, Chromanin's
         3721 visions have opened my
         3722 eyes. No price could be
         3723 high enough to ever
         3724 renounce my faith in
         3725 them, for it touched my
         3726 heart too insensely."
         3727 
         3728 "What is devided will be
         3729 reunited, after being
         3730 massively separated for
         3731 a short time."
         3732 </code></pre>
         3733 <p>Clue: "What is devided (sic) will be reunited, after being massively separated for a short time".
         3734 Location: small island near the (divided) river near the Old Camp.</p>
         3735 <p><a href="downloads/gothic1/chromanin/2_book.png">Item</a><br />  
         3736 <a href="downloads/gothic1/chromanin/2_river.png">Location</a><br />  
         3737 <a href="downloads/gothic1/chromanin/2_map.png">Map</a><br />  </p>
         3738 <h2>Chromanin 3</h2>
         3739 <p>Text:</p>
         3740 <pre><code>"Oh, Ancient Gods. How
         3741 can it be that a man like
         3742 me, simple and unworthy,
         3743 may receive such great a
         3744 legacy. I feel great
         3745 fear to lose all of it
         3746 again by a slight
         3747 faltering in word or
         3748 deed."
         3749 
         3750 "The wise fisherman
         3751 occasionally tries to get
         3752 lucky on the other side
         3753 of the lake."
         3754 </code></pre>
         3755 <p>Clue: a fisherman lake and (partially sunken hut) can be found close the the entrance of the New Camp.
         3756 At the other side is the Old Book.</p>
         3757 <p><a href="downloads/gothic1/chromanin/3_book.png">Item</a><br />  
         3758 <a href="downloads/gothic1/chromanin/3_lake_new_camp.png">Location</a><br />  
         3759 <a href="downloads/gothic1/chromanin/3_map.png">Map</a><br />  </p>
         3760 <h2>Chromanin 4</h2>
         3761 <p>Text:</p>
         3762 <pre><code>"I dare not to be in
         3763 the presence of
         3764 Chromanin one day. Gone
         3765 are the days of wasting
         3766 and wailing. So easy it
         3767 will be to acheive
         3768 absolute perfection. I'm
         3769 not far from it!"
         3770 
         3771 "Long forgotten are the
         3772 deeds of those who once
         3773 were aboard."
         3774 </code></pre>
         3775 <p>Clue: "Long forgotten are the deeds of those who once were aboard."
         3776 A broken ship can be found near the beach at the entrance of the Fog Tower.</p>
         3777 <p><a href="downloads/gothic1/chromanin/4_book.png">Item</a><br />  
         3778 <a href="downloads/gothic1/chromanin/4_aboard.png">Location</a><br />  
         3779 <a href="downloads/gothic1/chromanin/4_map.png">Map</a><br />  </p>
         3780 <h2>Chromanin 5</h2>
         3781 <p>Text:</p>
         3782 <pre><code>"But I shall not walk this
         3783 path alone. This honor is
         3784 mine. I must accept to
         3785 share the power within
         3786 myself with the worthy
         3787 ones who are to come and
         3788 find me. I hope they're
         3789 coming soon..."
         3790 
         3791 "You will find me where it all began."
         3792 </code></pre>
         3793 <p>Clue: "You will find me where it all began."
         3794 Very obvious it is the same location as were the first book was found.</p>
         3795 <p><a href="downloads/gothic1/chromanin/5_book.png">Item</a><br />  
         3796 <a href="downloads/gothic1/chromanin/5_begin.png">Location</a><br />  
         3797 <a href="downloads/gothic1/chromanin/5_map.png">Map</a><br />  </p>
         3798 <h2>Chromanin 6</h2>
         3799 <p>Text:</p>
         3800 <pre><code>"Empty pages"
         3801 </code></pre>
         3802 <p><a href="downloads/gothic1/chromanin/6_book.png">Item</a></p>
         3803 <p>On the corpse is the last chromanin book.
         3804 When reading this last book the book is empty.
         3805 Then there is evil laugh and 2 skeleton mages and skeleton minions will spawn.</p>
         3806 <h2>Chromanin quest log</h2>
         3807 <p>Here are the texts in the quest log:</p>
         3808 <p><a href="downloads/gothic1/chromanin/quest_log_part_1.png">Quest log part 1</a><br />  
         3809 <a href="downloads/gothic1/chromanin/quest_log_part_2.png">Quest log part 2</a><br />  </p>
         3810 <h3>The End</h3>
         3811 <p>When you use the tips described above Gothic should be an easier game and you
         3812 should be able to get at a high(er) level with lots of mana/strength/hp.</p>
         3813 <p>Have fun!</p>
         3814 ]]></description>
         3815 </item>
         3816 </channel>
         3817 </rss>