1706832000	Chess puzzle book generator	https://www.codemadness.org/chess-puzzles.html	<h1>Chess puzzle book generator</h1>\n\t<p><strong>Last modification on </strong> <time>2024-11-09</time></p>\n\t<p>This was a christmas hack for fun and non-profit.\nI wanted to write a chess puzzle book generator.\nInspired by <a href="https://archive.org/details/1001deadlycheckm0000nunn">1001 Deadly Checkmates by John Nunn, ISBN-13: 978-1906454258</a> and\nsimilar puzzle books.</p>\n<h1>Example output</h1>\n<ul>\n<li>English version: <a href="https://codemadness.org/downloads/puzzles/">https://codemadness.org/downloads/puzzles/</a></li>\n<li>Dutch version: <a href="https://hiltjo.nl/puzzles/">https://hiltjo.nl/puzzles/</a></li>\n</ul>\n<p>Terminal version:</p>\n<pre><code>curl -s 'https://codemadness.org/downloads/puzzles/index.vt' | less -R\n</code></pre>\n<p>I may or may not periodially update this page :)</p>\n<p>Time flies (since Christmas), here is a valentine edition with <a href="https://lichess.org/practice/intermediate-tactics/attraction/">attraction</a>\npuzzles (not only checkmates) using the red "love" theme.\nIt is optimized for his and her pleasure:</p>\n<p><a href="https://codemadness.org/downloads/puzzles-valentine/">https://codemadness.org/downloads/puzzles-valentine/</a></p>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/chess-puzzles\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/chess-puzzles/">https://git.codemadness.org/chess-puzzles/</a></li>\n<li><a href="gopher://codemadness.org/1/git/chess-puzzles">gopher://codemadness.org/1/git/chess-puzzles</a></li>\n</ul>\n<h1>Quick overview of how it works</h1>\n<p>The generate.sh shellscript generates the output and files for the puzzles.</p>\n<p>The puzzles used are from the lichess.org puzzle database:\n<a href="https://database.lichess.org/#puzzles">https://database.lichess.org/#puzzles</a></p>\n<p>This database is a big CSV file containing the initial board state in the\nForsyth-Edwards Notation (FEN) format and the moves in Universal Chess\nInterface (UCI) format. Each line contains the board state and the initial and\nsolution moves.</p>\n<p>The generated index page is a HTML page, it lists the puzzles.  Each puzzle on\nthis page is an SVG image. This scalable image format looks good in all\nresolutions.</p>\n<h1>Open puzzle data</h1>\n<p>Lichess is an <a href="https://lichess.org/source">open-source</a> and gratis website to play on-line chess. There are\nno paid levels to unlock features.  All the software hosting Lichess is\nopen-source and anyone can register and play chess on it for free. Most of the\ndata about the games played is also open.</p>\n<p>However, the website depends on your donations or contributions. If you can,\n<a href="https://lichess.org/about">please do so</a>.</p>\n<h1>generate.sh</h1>\n<p>Reads puzzles from the database and shuffle them. Do some rough sorting and\ncategorization based on difficulty and assign score points.</p>\n<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\nsame machine with the same puzzle database it will regenerate the same sequence\nof random puzzles in a deterministic manner.</p>\n<p>It outputs HTML, with support for CSS dark mode and does not require Javascript.\nIt includes a plain-text listing of the solutions in PGN notation for the\npuzzles.\nIt also outputs .vt files suitable for the terminal. It uses unicode symbols\nfor the chess pieces and RGB color sequence for the board theme</p>\n<h1>fen.c</h1>\n<p>This is a program written in C to read and parse the board state in FEN format\nand read the UCI moves. It can output to various formats.</p>\n<p>See the man page for detailed usage information.</p>\n<p>fen.c supports the following output formats:</p>\n<ul>\n<li>ascii - very simple ASCII mode.</li>\n<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>\n<li><a href="https://en.wikipedia.org/wiki/Portable_Game_Notation">pgn</a> - Portable Game Notation.</li>\n<li>speak - mode to output a description of the moves in words.</li>\n<li><a href="https://en.wikipedia.org/wiki/SVG">SVG</a> - Scalable Vector Graphics image.</li>\n<li>tty - Terminal output with some markup using escape codes.</li>\n</ul>\n<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>\n<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>\n<ul>\n<li><a href="https://codemadness.org/onlyfens">https://codemadness.org/onlyfens</a></li>\n<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>\n<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>\n<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>\n<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>\n<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>\n</ul>\n<p>Terminal output:</p>\n<pre><code>curl -s 'https://codemadness.org/onlyfens?moves=e2e4%20e7e5&amp;output=tty'\n</code></pre>\n<h1>Support for Dutch notated PGN and output</h1>\n<p>For pgn and "speak mode" it has an option to output Dutch notated PGN or speech\ntoo.</p>\n<p>For example:</p>\n<ul>\n<li>Queen = Dame (Q -&gt; D), translated: lady.</li>\n<li>Rook = Toren (R -&gt; T), translated: tower.</li>\n<li>Bishop = Loper (B -&gt; L), translated: walker.</li>\n<li>Knight = Paard (N -&gt; P), translated: horse.</li>\n</ul>\n<h1>Example script to stream games from Lichess</h1>\n<p>There is an included example script that can stream Lichess games to the\nterminal. It uses the <a href="https://lichess.org/api">Lichess API</a>.  It will display the board using terminal\nescape codes. The games are automatically annotated with PGN notation and with\ntext how a human would say the notation. This can also be piped to a speech\nsynthesizer like <a href="https://github.com/espeak-ng/espeak-ng/">espeak</a> as audio.</p>\n<p>pgn-extract is a useful tool to convert Portable Game Notation (PGN) to\nUniversal Chess Interface (UCI) moves (or do many other useful chess related\nthings!).</p>\n<h1>Example script to generate an animated gif from PGN</h1>\n<p>Theres also an example script included that can generate an animated gif from\nPGN using <a href="https://ffmpeg.org/">ffmpeg</a>.</p>\n<p>It creates an optimal color palette from the input images and generates an\noptimized animated gif. The last move (typically some checkmate) is displayed\nslightly longer.</p>\n<h1>References and chess related links</h1>\n<ul>\n<li><p>chess-puzzles source-code:<br />  \n<a href="https://www.codemadness.org/git/chess-puzzles/file/README.html">https://www.codemadness.org/git/chess-puzzles/file/README.html</a></p>\n</li>\n<li><p>Lichess FEN puzzle database:<br />  \n<a href="https://database.lichess.org/#puzzles">https://database.lichess.org/#puzzles</a></p>\n</li>\n<li><p>lichess.org:<br />  \n<a href="https://lichess.org/">https://lichess.org/</a></p>\n</li>\n<li><p>SVG of the individual pieces used in fen.c:<br />  \n<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>\n</li>\n<li><p>pgn-extract:<br />  \nA great multi-purpose PGN manipulation program with many options:<br />  \n<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>\n<p>An example to convert PGN games to UCI moves:<br />  \n<code>pgn-extract --notags -Wuc</code></p>\n</li>\n<li><p>Lichess API:<br />  \n<a href="https://lichess.org/api">https://lichess.org/api</a></p>\n</li>\n<li><p>Stockfish:<br />  \nStrong open-source chess engine and analysis tool:<br />  \n<a href="https://stockfishchess.org/">https://stockfishchess.org/</a></p>\n</li>\n</ul>	html	https://www.codemadness.org/chess-puzzles.html	Hiltjo		
1700611200	xargs: an example for parallel batch jobs	https://www.codemadness.org/xargs.html	<h1>xargs: an example for parallel batch jobs</h1>\n\t<p><strong>Last modification on </strong> <time>2023-12-17</time></p>\n\t<p>This describes a simple shellscript programming pattern to process a list of\njobs in parallel. This script example is contained in one file.</p>\n<h1>Simple but less optimal example</h1>\n<pre><code>#!/bin/sh\nmaxjobs=4\n\n# fake program for example purposes.\nsomeprogram() {\n\techo "Yep yep, I'm totally a real program!"\n\tsleep "$1"\n}\n\n# run(arg1, arg2)\nrun() {\n\techo "[$1] $2 started" &gt;&amp;2\n\tsomeprogram "$1" &gt;/dev/null\n\tstatus="$?"\n\techo "[$1] $2 done" &gt;&amp;2\n\treturn "$status"\n}\n\n# process the jobs.\nj=1\nfor f in 1 2 3 4 5 6 7 8 9 10; do\n\trun "$f" "something" &amp;\n\n\tjm=$((j % maxjobs)) # shell arithmetic: modulo\n\ttest "$jm" = "0" &amp;&amp; wait\n\tj=$((j+1))\ndone\nwait\n</code></pre>\n<h1>Why is this less optimal</h1>\n<p>This is less optimal because it waits until all jobs in the same batch are finished\n(each batch contain $maxjobs items).</p>\n<p>For example with 2 items per batch and 4 total jobs it could be:</p>\n<ul>\n<li>Job 1 is started.</li>\n<li>Job 2 is started.</li>\n<li>Job 2 is done.</li>\n<li>Job 1 is done.</li>\n<li>Wait: wait on process status of all background processes.</li>\n<li>Job 3 in new batch is started.</li>\n</ul>\n<p>This could be optimized to:</p>\n<ul>\n<li>Job 1 is started.</li>\n<li>Job 2 is started.</li>\n<li>Job 2 is done.</li>\n<li>Job 3 in new batch is started (immediately).</li>\n<li>Job 1 is done.</li>\n<li>...</li>\n</ul>\n<p>It also does not handle signals such as SIGINT (^C). However the xargs example\nbelow does:</p>\n<h1>Example</h1>\n<pre><code>#!/bin/sh\nmaxjobs=4\n\n# fake program for example purposes.\nsomeprogram() {\n\techo "Yep yep, I'm totally a real program!"\n\tsleep "$1"\n}\n\n# run(arg1, arg2)\nrun() {\n\techo "[$1] $2 started" &gt;&amp;2\n\tsomeprogram "$1" &gt;/dev/null\n\tstatus="$?"\n\techo "[$1] $2 done" &gt;&amp;2\n\treturn "$status"\n}\n\n# child process job.\nif test "$CHILD_MODE" = "1"; then\n\trun "$1" "$2"\n\texit "$?"\nfi\n\n# generate a list of jobs for processing.\nlist() {\n\tfor f in 1 2 3 4 5 6 7 8 9 10; do\n\t\tprintf '%s\\0%s\\0' "$f" "something"\n\tdone\n}\n\n# process jobs in parallel.\nlist | CHILD_MODE="1" xargs -r -0 -P "${maxjobs}" -L 2 "$(readlink -f "$0")"\n</code></pre>\n<h1>Run and timings</h1>\n<p>Although the above example is kindof stupid, it already shows the queueing of\njobs is more efficient.</p>\n<p>Script 1:</p>\n<pre><code>time ./script1.sh\n[...snip snip...]\nreal    0m22.095s\n</code></pre>\n<p>Script 2:</p>\n<pre><code>time ./script2.sh\n[...snip snip...]\nreal    0m18.120s\n</code></pre>\n<h1>How it works</h1>\n<p>The parent process:</p>\n<ul>\n<li>The parent, using xargs, handles the queue of jobs and schedules the jobs to\nexecute as a child process.</li>\n<li>The list function writes the parameters to stdout. These parameters are\nseparated by the NUL byte separator. The NUL byte separator is used because\nthis character cannot be used in filenames (which can contain spaces or even\nnewlines) and cannot be used in text (the NUL byte terminates the buffer for\na string).</li>\n<li>The -L option must match the amount of arguments that are specified for the\njob. It will split the specified parameters per job.</li>\n<li>The expression "$(readlink -f "$0")" gets the absolute path to the\nshellscript itself. This is passed as the executable to run for xargs.</li>\n<li>xargs calls the script itself with the specified parameters it is being fed.\nThe environment variable $CHILD_MODE is set to indicate to the script itself\nit is run as a child process of the script.</li>\n</ul>\n<p>The child process:</p>\n<ul>\n<li><p>The command-line arguments are passed by the parent using xargs.</p>\n</li>\n<li><p>The environment variable $CHILD_MODE is set to indicate to the script itself\nit is run as a child process of the script.</p>\n</li>\n<li><p>The script itself (ran in child-mode process) only executes the task and\nsignals its status back to xargs and the parent.</p>\n</li>\n<li><p>The exit status of the child program is signaled to xargs. This could be\nhandled, for example to stop on the first failure (in this example it is not).\nFor example if the program is killed, stopped or the exit status is 255 then\nxargs stops running also.</p>\n</li>\n</ul>\n<h1>Description of used xargs options</h1>\n<p>From the OpenBSD man page: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></p>\n<pre><code>xargs - construct argument list(s) and execute utility\n</code></pre>\n<p>Options explained:</p>\n<ul>\n<li>-r: Do not run the command if there are no arguments. Normally the command\nis executed at least once even if there are no arguments.</li>\n<li>-0: Change xargs to expect NUL ('\\0') characters as separators, instead of\nspaces and newlines.</li>\n<li>-P maxprocs: Parallel mode: run at most maxprocs invocations of utility\nat once.</li>\n<li>-L number: Call utility for every number of non-empty lines read. A line\nending in unescaped white space and the next non-empty line are considered\nto form one single line. If EOF is reached and fewer than number lines have\nbeen read then utility will be called with the available lines.</li>\n</ul>\n<h1>xargs options -0 and -P, portability and historic context</h1>\n<p>Some of the options, like -P are as of writing (2023) non-POSIX:\n<a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html">https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html</a>.\nHowever many systems support this useful extension for many years now.</p>\n<p>The specification even mentions implementations which support parallel\noperations:</p>\n<p>"The version of xargs required by this volume of POSIX.1-2017 is required to\nwait for the completion of the invoked command before invoking another command.\nThis was done because historical scripts using xargs assumed sequential\nexecution. Implementations wanting to provide parallel operation of the invoked\nutilities are encouraged to add an option enabling parallel invocation, but\nshould still wait for termination of all of the children before xargs\nterminates normally."</p>\n<p>Some historic context:</p>\n<p>The xargs -0 option was added on 1996-06-11 by Theo de Raadt, about a year\nafter the NetBSD import (over 27 years ago at the time of writing):</p>\n<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>\n<p>On OpenBSD the xargs -P option was added on 2003-12-06 by syncing the FreeBSD\ncode:</p>\n<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>\n<p>Looking at the imported git history log of GNU findutils (which has xargs), the\nvery first commit already had the -0 and -P option:</p>\n<p><a href="https://savannah.gnu.org/git/?group=findutils">git log</a></p>\n<pre><code>commit c030b5ee33bbec3c93cddc3ca9ebec14c24dbe07\nAuthor: Kevin Dalley &lt;kevin@seti.org&gt;\nDate:   Sun Feb 4 20:35:16 1996 +0000\n\n    Initial revision\n</code></pre>\n<h1>xargs: some incompatibilities found</h1>\n<ul>\n<li>Using the -0 option empty fields are handled differently in different\nimplementations.</li>\n<li>The -n and -L option doesn't work correctly in many of the BSD implementations.\nSome count empty fields, some don't.  In early implementations in FreeBSD and\nOpenBSD it only processed the first line.  In OpenBSD it has been improved\naround 2017.</li>\n</ul>\n<p>Depending on what you want to do a workaround could be to use the -0 option\nwith a single field and use the -n flag.  Then in each child program invocation\nsplit the field by a separator.</p>\n<h1>References</h1>\n<ul>\n<li>xargs: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></li>\n<li>printf: <a href="https://man.openbsd.org/printf">https://man.openbsd.org/printf</a></li>\n<li>ksh, wait: <a href="https://man.openbsd.org/ksh#wait">https://man.openbsd.org/ksh#wait</a></li>\n<li>wait(2): <a href="https://man.openbsd.org/wait">https://man.openbsd.org/wait</a></li>\n</ul>	html	https://www.codemadness.org/xargs.html	Hiltjo		
1700438400	Improved Youtube RSS/Atom feed	https://www.codemadness.org/youtube-feed.html	<h1>Improved Youtube RSS/Atom feed</h1>\n\t<p><strong>Last modification on </strong> <time>2023-11-20</time></p>\n\t<p>... improved at least for my preferences ;)</p>\n<p>It scrapes the channel data from Youtube and combines it with the parsed Atom\nfeed from the channel on Youtube.</p>\n<p>The Atom parser is based on sfeed, with some of the code removed because it is\nnot needed by this program.  It scrapes the metadata of the videos from the\nchannel its HTML page and uses my custom JSON parser to convert the\nJavascript/JSON structure.</p>\n<p>This parser is also used by the <a href="json2tsv.html">json2tsv</a> tool. It has few dependencies.</p>\n<h2>Features</h2>\n<ul>\n<li>Add the video duration to the title to quickly see how long the video is.</li>\n<li>Filter away Youtube shorts and upcoming videos / announcements: only videos are shown.</li>\n<li>Supports more output formats: Atom, <a href="https://www.jsonfeed.org/version/1.1/">JSON Feed</a> or\n<a href="sfeed.1.txt">sfeed</a> Tab-Separated-Value format.</li>\n<li>Easy to build and deploy: can be run as a CGI program as a static-linked\nbinary in a chroot.</li>\n<li>Secure: additionally to running in a chroot it can use pledge(2) and unveil(2)\non OpenBSD to restrict system calls and access to the filesystem.</li>\n</ul>\n<h2>How to use</h2>\n<p>There is an option to run directly from the command-line or in CGI-mode.  When\nthe environment variable $REQUEST_URI is set then it is automatically run in\nCGI mode.</p>\n<p>Command-line usage:</p>\n<pre><code>youtube_feed channelid atom\nyoutube_feed channelid gph\nyoutube_feed channelid html\nyoutube_feed channelid json\nyoutube_feed channelid tsv\nyoutube_feed channelid txt\n</code></pre>\n<p>CGI program usage:</p>\n<p>The last basename part of the URL should be the channelid + the output format\nextension. It defaults to TSV if there is no extension.\nThe CGI program can be used with a HTTPd or a Gopher daemon such as geomyidae.</p>\n<p>For example:</p>\n<pre><code>Atom XML:     https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.xml\nHTML:         https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.html\nJSON:         https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.json\nTSV:          https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.tsv\ntwtxt:        https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.txt\nTSV, default: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw\n\nGopher dir:   gopher://codemadness.org/1/feed.cgi/UCrbvoMC0zUvPL8vjswhLOSw.gph\nGopher TSV:   gopher://codemadness.org/0/feed.cgi/UCrbvoMC0zUvPL8vjswhLOSw\n</code></pre>\n<p>An OpenBSD httpd.conf using slowcgi as an example:</p>\n<pre><code>server "codemadness.org" {\n\tlocation "/yt-chan/*" {\n\t\trequest strip 1\n\t\troot "/cgi-bin/yt-chan"\n\t\tfastcgi socket "/run/slowcgi.sock"\n\t}\n}\n</code></pre>\n<h2>Using it with <a href="sfeed.html">sfeed</a></h2>\n<p>sfeedrc example of an existing Youtube RSS/Atom feed:</p>\n<pre><code># list of feeds to fetch:\nfeeds() {\n\t# feed &lt;name&gt; &lt;feedurl&gt; [basesiteurl] [encoding]\n\t# normal Youtube Atom feed.\n\tfeed "yt IM" "https://www.youtube.com/feeds/videos.xml?channel_id=UCrbvoMC0zUvPL8vjswhLOSw"\n}\n</code></pre>\n<p>Use the new Atom feed directly using the CGI-mode and Atom output format:</p>\n<pre><code># list of feeds to fetch:\nfeeds() {\n\t# feed &lt;name&gt; &lt;feedurl&gt; [basesiteurl] [encoding]\n\t# new Youtube Atom feed.\n\tfeed "idiotbox IM" "https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.xml"\n}\n</code></pre>\n<p>... or convert directly using a custom connector program on the local system via the command-line:</p>\n<pre><code># fetch(name, url, feedfile)\nfetch() {\n\tcase "$1" in\n\t"connector example")\n\t\tyoutube_feed "$2";;\n\t*)\n\t\tcurl -L --max-redirs 0 -H "User-Agent:" -f -s -m 15 \\\n\t\t\t"$2" 2&gt;/dev/null;;\n\tesac\n}\n\n# parse and convert input, by default XML to the sfeed(5) TSV format.\n# parse(name, feedurl, basesiteurl)\nparse() {\n\tcase "$1" in\n\t"connector example")\n\t\tcat;;\n\t*)\n\t\tsfeed "$3";;\n\tesac\n}\n\n# list of feeds to fetch:\nfeeds() {\n\t# feed &lt;name&gt; &lt;feedurl&gt; [basesiteurl] [encoding]\n\tfeed "connector example" "UCrbvoMC0zUvPL8vjswhLOSw"\n}\n</code></pre>\n<h2>Screenshot using sfeed_curses</h2>\n<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>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/frontends\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<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>\n<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>\n</ul>\n<p>The program is: youtube/feed</p>\n<h2>Dependencies</h2>\n<ul>\n<li>C compiler.</li>\n<li>LibreSSL + libtls.</li>\n</ul>\n<h2>Build and install</h2>\n<pre><code>$ make\n# make install\n</code></pre>\n<h2>That's all</h2>\n<p>I hope by sharing this it is useful to someone other than me as well.</p>	html	https://www.codemadness.org/youtube-feed.html	Hiltjo		
1700438400	webdump HTML to plain-text converter	https://www.codemadness.org/webdump.html	<h1>webdump HTML to plain-text converter</h1>\n\t<p><strong>Last modification on </strong> <time>2024-07-17</time></p>\n\t<p>webdump is (yet another) HTML to plain-text converter tool.</p>\n<p>It reads HTML in UTF-8 from stdin and writes plain-text to stdout.</p>\n<h2>Goals and scope</h2>\n<p>The main goal of this tool for me is to use it for converting HTML mails to\nplain-text and to convert HTML content in RSS feeds to plain-text.</p>\n<p>The tool will only convert HTML to stdout, similarly to links -dump or lynx\n-dump but simpler and more secure.</p>\n<ul>\n<li>HTML and XHTML will be supported.</li>\n<li>There will be some workarounds and quirks for broken and legacy HTML code.</li>\n<li>It will be usable and secure for reading HTML from mails and RSS/Atom feeds.</li>\n<li>No remote resources which are part of the HTML will be downloaded:\nimages, video, audio, etc. But these may be visible as a link reference.</li>\n<li>Data will be written to stdout. Intended for plain-text or a text terminal.</li>\n<li>No support for Javascript, CSS, frame rendering or form processing.</li>\n<li>No HTTP or network protocol handling: HTML data is read from stdin.</li>\n<li>Listings for references and some options to extract them in a list that is\nusable for scripting. Some references are: link anchors, images, audio, video,\nHTML (i)frames, etc.</li>\n<li>Security: on OpenBSD it uses pledge("stdio", NULL).</li>\n<li>Keep the code relatively small, simple and hackable.</li>\n</ul>\n<h2>Features</h2>\n<ul>\n<li>Support for word-wrapping.</li>\n<li>A mode to enable basic markup: bold, underline, italic and blink ;)</li>\n<li>Indentation of headers, paragraphs, pre and list items.</li>\n<li>Basic support to query elements or hide them.</li>\n<li>Show link references.</li>\n<li>Show link references and resources such as img, video, audio, subtitles.</li>\n<li>Export link references and resources to a TAB-separated format.</li>\n</ul>\n<h2>Usage examples</h2>\n<pre><code>url='https://codemadness.org/sfeed.html'\n\ncurl -s "$url" | webdump -r -b "$url" | less\n\ncurl -s "$url" | webdump -8 -a -i -l -r -b "$url" | less -R\n\ncurl -s "$url" | webdump -s 'main' -8 -a -i -l -r -b "$url" | less -R\n</code></pre>\n<p>Yes, all these option flags look ugly, a shellscript wrapper could be used :)</p>\n<h2>Practical examples</h2>\n<p>To use webdump as a HTML to text filter for example in the mutt mail client,\nchange in ~/.mailcap:</p>\n<pre><code>text/html; webdump -i -l -r &lt; %s; needsterminal; copiousoutput\n</code></pre>\n<p>In mutt you should then add:</p>\n<pre><code>auto_view text/html\n</code></pre>\n<p>Using webdump as a HTML to text filter for sfeed_curses (otherwise the default is lynx):</p>\n<pre><code>SFEED_HTMLCONV="webdump -d -8 -r -i -l -a" sfeed_curses ~/.sfeed/feeds/*\n</code></pre>\n<h1>Query/selector examples</h1>\n<p>The query syntax using the -s option is a bit inspired by CSS (but much more limited).</p>\n<p>To get the title from a HTML page:</p>\n<pre><code>url='https://codemadness.org/sfeed.html'\n\ntitle=$(curl -s "$url" | webdump -s 'title')\nprintf '%s\\n' "$title"\n</code></pre>\n<p>List audio and video-related content from a HTML page, redirect fd 3 to fd 1 (stdout):</p>\n<pre><code>url="https://media.ccc.de/v/051_Recent_features_to_OpenBSD-ntpd_and_bgpd"\ncurl -s "$url" | webdump -x -s 'audio,video' -b "$url" 3&gt;&amp;1 &gt;/dev/null | cut -f 2\n</code></pre>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/webdump\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/webdump/">https://git.codemadness.org/webdump/</a></li>\n<li><a href="gopher://codemadness.org/1/git/webdump">gopher://codemadness.org/1/git/webdump</a></li>\n</ul>\n<h2>Build and install</h2>\n<pre><code>$ make\n# make install\n</code></pre>\n<h2>Dependencies</h2>\n<ul>\n<li>C compiler.</li>\n<li>libc + some BSDisms.</li>\n</ul>\n<h2>Trade-offs</h2>\n<p>All software has trade-offs.</p>\n<p>webdump processes HTML in a single-pass. It does not buffer the full DOM tree.\nAlthough due to the nature of HTML/XML some parts like attributes need to be\nbuffered.</p>\n<p>Rendering tables in webdump is very limited. Twibright Links has really nice\ntable rendering. However implementing a similar feature in the current design of\nwebdump would make the code much more complex. Twibright links\nprocesses a full DOM tree and processes the tables in multiple passes (to\nmeasure the table cells) etc.  Of course tables can be nested also, or HTML tables\nthat are used for creating layouts (these are mostly older webpages).</p>\n<p>These trade-offs and preferences are chosen for now. It may change in the\nfuture.  Fortunately there are the usual good suspects for HTML to plain-text\nconversion, each with their own chosen trade-offs of course:</p>\n<ul>\n<li>twibright links: <a href="http://links.twibright.com/">http://links.twibright.com/</a></li>\n<li>lynx: <a href="https://lynx.invisible-island.net/">https://lynx.invisible-island.net/</a></li>\n<li>w3m: <a href="https://w3m.sourceforge.net/">https://w3m.sourceforge.net/</a></li>\n<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>\n<li>xmlstarlet: <a href="https://xmlstar.sourceforge.net/">https://xmlstar.sourceforge.net/</a></li>\n</ul>	html	https://www.codemadness.org/webdump.html	Hiltjo		
1698192000	Setup your own mail paste service	https://www.codemadness.org/mailservice.html	<h1>Setup your own mail paste service</h1>\n\t<p><strong>Last modification on </strong> <time>2024-02-10</time></p>\n\t<h2>How it works</h2>\n<ul>\n<li>The user sends a mail with an attachment to a certain mail address, for\nexample: paste@somehost.org</li>\n<li>The mail daemon configuration has an mail alias to pipe the raw mail to a\nshellscript.</li>\n<li>This shellscript processes the raw mail contents from stdin.</li>\n</ul>\n<h2>What it does</h2>\n<ul>\n<li>Process a mail with the attachments automatically.</li>\n<li>The script processes the attachments in the mail and stores them.</li>\n<li>It will mail (back) the URL where the file(s) are stored.</li>\n</ul>\n<p>This script is tested on OpenBSD using OpenBSD smtpd and OpenBSD httpd and the\ngopher daemon geomyidae.</p>\n<h2>Install dependencies</h2>\n<p>On OpenBSD:</p>\n<pre><code>pkg_add mblaze\n</code></pre>\n<h2>smtpd mail configuration</h2>\n<p>In your mail aliases (for example /etc/mail/aliases) put:</p>\n<pre><code>paste: |/usr/local/bin/paste-mail\n</code></pre>\n<p>This pipes the mail to the script paste-mail for processing, this script is\ndescribed below. Copy the below contents in /usr/local/bin/paste-mail</p>\n<p>Script:</p>\n<pre><code>#!/bin/sh\n\nd="/home/www/domains/www.codemadness.org/htdocs/mailpaste"\ntmpmsg=$(mktemp)\ntmpmail=$(mktemp)\n\ncleanup() {\n\trm -f "$tmpmail" "$tmpmsg"\n}\n\n# store whole mail from stdin temporarily, on exit remove temporary file.\ntrap "cleanup" EXIT\ncat &gt; "$tmpmail"\n\n# mblaze: don't store mail sequence.\nMAILSEQ=/dev/null\nexport MAILSEQ\n\n# get from address (without display name).\nfrom=$(maddr -a -h 'From' /dev/stdin &lt; "$tmpmail")\n\n# check if allowed or not.\ncase "$from" in\n"hiltjo@codemadness.org")\n\t;;\n*)\n\texit 0;;\nesac\n\n# prevent mail loop.\nif printf '%s' "$from" | grep -q "paste@"; then\n\texit 0\nfi\n\necho "Thank you for using the enterprise paste service." &gt; "$tmpmsg"\necho "" &gt;&gt; "$tmpmsg"\necho "Your file(s) are available at:" &gt;&gt; "$tmpmsg"\necho "" &gt;&gt; "$tmpmsg"\n\n# process each attachment.\nmshow -n -q -t /dev/stdin &lt; "$tmpmail" | sed -nE 's@.*name="(.*)".*@\\1@p' | while read -r name; do\n\ttest "$name" = "" &amp;&amp; continue\n\n\t# extract attachment.\n\ttmpfile=$(mktemp -p "$d" XXXXXXXXXXXX)\n\tmshow -n -O /dev/stdin "$name" &lt; "$tmpmail" &gt; "$tmpfile"\n\n\t# use file extension.\n\text="${name##*/}"\n\tcase "$ext" in\n\t*.tar.*)\n\t\t# special case: support .tar.gz, tar.bz2, etc.\n\t\text="tar.${ext##*.}";;\n\t*.*)\n\t\text="${ext##*.}";;\n\t*)\n\t\text="";;\n\tesac\n\text="${ext%%*.}"\n\n\t# use file extension if it is set.\n\toutputfile="$tmpfile"\n\tif test "$ext" != ""; then\n\t\toutputfile="$tmpfile.$ext"\n\tfi\n\tmv "$tmpfile" "$outputfile"\n\tb=$(basename "$outputfile")\n\n\tchmod 666 "$outputfile"\n\turl="gopher://codemadness.org/9/mailpaste/$b"\n\n\techo "$name:" &gt;&gt; "$tmpmsg"\n\techo "\tText   file: gopher://codemadness.org/0/mailpaste/$b" &gt;&gt; "$tmpmsg"\n\techo "\tImage  file: gopher://codemadness.org/I/mailpaste/$b" &gt;&gt; "$tmpmsg"\n\techo "\tBinary file: gopher://codemadness.org/9/mailpaste/$b" &gt;&gt; "$tmpmsg"\n\techo "" &gt;&gt; "$tmpmsg"\ndone\n\necho "" &gt;&gt; "$tmpmsg"\necho "Sincerely," &gt;&gt; "$tmpmsg"\necho "Your friendly paste_bot" &gt;&gt; "$tmpmsg"\n\n# mail back the user.\nmail -r "$from" -s "Your files" "$from" &lt; "$tmpmsg"\n\ncleanup\n</code></pre>\n<p>The mail daemon processing the mail needs of course to be able to have\npermissions to write to the specified directory. The user who received the mail\nneeds to be able to read it from a location they can access and have\npermissions for it also.</p>\n<h2>Room for improvements</h2>\n<p>This is just an example script. There is room for many improvements.\nFeel free to change it in any way you like.</p>\n<h2>References</h2>\n<ul>\n<li><a href="https://man.openbsd.org/aliases">https://man.openbsd.org/aliases</a></li>\n<li><a href="https://man.openbsd.org/smtpd">https://man.openbsd.org/smtpd</a></li>\n<li><a href="https://man.openbsd.org/httpd">https://man.openbsd.org/httpd</a></li>\n<li><a href="https://github.com/leahneukirchen/mblaze">https://github.com/leahneukirchen/mblaze</a></li>\n</ul>\n<h2>Bye bye</h2>\n<p>I hope this enterprise(tm) mail service is inspirational or something ;)</p>	html	https://www.codemadness.org/mailservice.html	Hiltjo		
1656633600	A simple TODO application	https://www.codemadness.org/todo-application.html	<h1>A simple TODO application</h1>\n\t<p><strong>Last modification on </strong> <time>2022-07-01</time></p>\n\t<p>This article describes a TODO application or workflow.</p>\n<h2>Workflow</h2>\n<p>It works like this:</p>\n<ul>\n<li>Open any text editor.</li>\n<li>Edit the text.</li>\n<li>Save it in a file (probably named "TODO").</li>\n<li>Feel happy about it.</li>\n</ul>\n<h2>The text format</h2>\n<p>The text format I use is this:</p>\n<pre><code>[indendations]&lt;symbol&gt;&lt;SPACE&gt;&lt;item text&gt;&lt;NEWLINE&gt;\n</code></pre>\n<p>Most of the time an item is just one line.\nThis format is just a general guideline to keep the items somewhat structured.</p>\n<h2>Symbols</h2>\n<p>Items are prefixed with a symbol.</p>\n<ul>\n<li>- is an item which is planned to be done at some point.</li>\n<li>x is an item which is done.</li>\n<li>? is an item which I'm not (yet) sure about. It can also be an idea.</li>\n</ul>\n<p>I use an indendation with a TAB before an item to indicate item dependencies.\nThe items can be nested.</p>\n<p>For the prioritization I put the most important items and sections from the top\nto the bottom. These can be reshuffled as you wish of course.</p>\n<p>To delete an item you remove the line. To archive an item you keep the line.</p>\n<h2>Sections</h2>\n<p>A section is a line which has no symbol. This is like a header to group items.</p>\n<h2>Example</h2>\n<pre><code>Checklist for releasing project 0.1:\n- Test project with different compilers and check for warnings.\n- Documentation:\n\t- Proofread and make sure it matches all program behaviour.\n\t- Run mandoc -Tlint on the man pages.\n\t? Copy useful examples from the README file to the man page?\n- Run testsuite and check for failures before release.\n\n\nproject 0.2:\n? Investigate if feature mentioned by some user is worth adding.\n</code></pre>\n<h1>Example: secure remote cloud-encrypted edit session(tm)</h1>\n<pre><code>ssh -t host 'ed TODO'\n</code></pre>\n<h1>Example: multi-user secure remote cloud-encrypted edit session(tm)</h1>\n<pre><code>ssh host\ntmux or tmux a\ned TODO\n</code></pre>\n<h1>Example: version-controlled multi-user secure remote cloud-encrypted edit session(tm)</h1>\n<pre><code>ssh host\ntmux or tmux a\ned TODO\ngit add TODO\ngit commit -m 'TODO: update'\n</code></pre>\n<h2>Pros</h2>\n<ul>\n<li>When you open the TODO file the most important items are at the top.</li>\n<li>The items are easy to read and modify with any text editor.</li>\n<li>It is easy to extend the format and use with other text tools.</li>\n<li>The format is portable: it works on sticky-notes on your CRT monitor too!</li>\n<li>No monthly online subscription needed and full NO-money-back guarantee.</li>\n</ul>\n<h2>Cons</h2>\n<ul>\n<li>Complex lists with interconnected dependencies might not work, maybe.</li>\n<li>It's assumed there is one person maintaining the TODO file. Merging items\nfrom multiple people at the same time in this workflow is not recommended.</li>\n<li>It is too simple: noone will be impressed by it.</li>\n</ul>\n<p>I hope this is inspirational or something,</p>	html	https://www.codemadness.org/todo-application.html	Hiltjo		
1647993600	2FA TOTP without crappy authenticator apps	https://www.codemadness.org/totp.html	<h1>2FA TOTP without crappy authenticator apps</h1>\n\t<p><strong>Last modification on </strong> <time>2022-10-29</time></p>\n\t<p>This describes how to use 2FA without using crappy authenticator "apps" or a\nmobile device.</p>\n<h2>Install</h2>\n<p>On OpenBSD:</p>\n<pre><code>pkg_add oath-toolkit zbar\n</code></pre>\n<p>On Void Linux:</p>\n<pre><code>xbps-install oath-toolkit zbar\n</code></pre>\n<p>There is probably a package for your operating system.</p>\n<ul>\n<li>oath-toolkit is used to generate the digits based on the secret key.</li>\n<li>zbar is used to scan the QR barcode text from the image.</li>\n</ul>\n<h2>Steps</h2>\n<p>Save the QR code image from the authenticator app, website to an image file.\nScan the QR code text from the image:</p>\n<pre><code>zbarimg image.png\n</code></pre>\n<p>An example QR code:</p>\n<p><img src="downloads/2fa/qr.png" alt="QR code example" /></p>\n<p>The output is typically something like:</p>\n<pre><code>QR-Code:otpauth://totp/Example:someuser@codemadness.org?secret=SECRETKEY&amp;issuer=Codemadness\n</code></pre>\n<p>You only need to scan this QR-code for the secret key once.\nMake sure to store the secret key in a private safe place and don't show it to\nanyone else.</p>\n<p>Using the secret key the following command outputs a 6-digit code by default.\nIn this example we also assume the key is base32-encoded.\nThere can be other parameters and options, this is documented in the Yubico URI\nstring format reference below.</p>\n<p>Command:</p>\n<pre><code>oathtool --totp -b SOMEKEY\n</code></pre>\n<ul>\n<li>The --totp option uses the time-variant TOTP mode, by default it uses HMAC SHA1.</li>\n<li>The -b option uses base32 encoding of KEY instead of hex.</li>\n</ul>\n<p>Tip: you can create a script that automatically puts the digits in the\nclipboard, for example:</p>\n<pre><code>oathtool --totp -b SOMEKEY | xclip\n</code></pre>\n<h2>References</h2>\n<ul>\n<li><a href="https://linux.die.net/man/1/zbarimg">zbarimg(1) man page</a></li>\n<li><a href="https://www.nongnu.org/oath-toolkit/man-oathtool.html">oathtool(1) man page</a></li>\n<li><a href="https://datatracker.ietf.org/doc/html/rfc6238">RFC6238 - TOTP: Time-Based One-Time Password Algorithm</a></li>\n<li><a href="https://docs.yubico.com/yesdk/users-manual/application-oath/uri-string-format.html">Yubico.com - otpauth URI string format</a></li>\n</ul>	html	https://www.codemadness.org/totp.html	Hiltjo		
1634947200	Setup an OpenBSD RISCV64 VM in QEMU	https://www.codemadness.org/openbsd-riscv64-vm.html	<h1>Setup an OpenBSD RISCV64 VM in QEMU</h1>\n\t<p><strong>Last modification on </strong> <time>2021-10-26</time></p>\n\t<p>This describes how to setup an OpenBSD RISCV64 VM in QEMU.</p>\n<p>The shellscript below does the following:</p>\n<ul>\n<li>Set up the disk image (raw format).</li>\n<li>Patch the disk image with the OpenBSD miniroot file for the installation.</li>\n<li>Downloads the opensbi and u-boot firmware files for qemu.</li>\n<li>Run the VM with the supported settings.</li>\n</ul>\n<p>The script is tested on the host GNU/Void Linux and OpenBSD-current.</p>\n<p><strong>IMPORTANT!: The signature and checksum for the miniroot, u-boot and opensbi\nfiles are not verified. If the host is OpenBSD make sure to instead install the\npackages (pkg_add u-boot-riscv64 opensbi) and adjust the firmware path for the\nqemu -bios and -kernel options. </strong></p>\n<h2>Shellscript</h2>\n<pre><code>#!/bin/sh\n# mirror list: https://www.openbsd.org/ftp.html\nmirror="https://ftp.bit.nl/pub/OpenBSD/"\nrelease="7.0"\nminirootname="miniroot70.img"\n\nminiroot() {\n\ttest -f "${minirootname}" &amp;&amp; return # download once\n\n\turl="${mirror}/${release}/riscv64/${minirootname}"\n\tcurl -o "${minirootname}" "${url}"\n}\n\ncreaterootdisk() {\n\ttest -f disk.raw &amp;&amp; return # create once\n\tqemu-img create disk.raw 10G # create 10 GB disk\n\tdd conv=notrunc if=${minirootname} of=disk.raw # write miniroot to disk\n}\n\nopensbi() {\n\tf="opensbi.tgz"\n\ttest -f "${f}" &amp;&amp; return # download and extract once.\n\n\turl="${mirror}/${release}/packages/amd64/opensbi-0.9p0.tgz"\n\tcurl -o "${f}" "${url}"\n\n\ttar -xzf "${f}" share/opensbi/generic/fw_jump.bin\n}\n\nuboot() {\n\tf="uboot.tgz"\n\ttest -f "${f}" &amp;&amp; return # download and extract once.\n\n\turl="${mirror}/${release}/packages/amd64/u-boot-riscv64-2021.07p0.tgz"\n\tcurl -o "${f}" "${url}"\n\n\ttar -xzf "${f}" share/u-boot/qemu-riscv64_smode/u-boot.bin\n}\n\nsetup() {\n\tminiroot\n\tcreaterootdisk\n\topensbi\n\tuboot\n}\n\nrun() {\n\tqemu-system-riscv64 \\\n\t\t-machine virt \\\n\t\t-nographic \\\n\t\t-m 2048M \\\n\t\t-smp 2 \\\n\t\t-bios share/opensbi/generic/fw_jump.bin \\\n\t\t-kernel share/u-boot/qemu-riscv64_smode/u-boot.bin \\\n\t\t-drive file=disk.raw,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \\\n\t\t-netdev user,id=net0,ipv6=off -device virtio-net-device,netdev=net0\n}\n\nsetup\nrun\n</code></pre>	html	https://www.codemadness.org/openbsd-riscv64-vm.html	Hiltjo		
1593043200	Sfeed_curses: a curses UI front-end for sfeed	https://www.codemadness.org/sfeed_curses-ui.html	<h1>Sfeed_curses: a curses UI front-end for sfeed</h1>\n\t<p><strong>Last modification on </strong> <time>2022-05-08</time></p>\n\t<p>sfeed_curses is a curses UI front-end for <a href="sfeed.html">sfeed</a>.\nIt is now part of sfeed.</p>\n<p>It shows the TAB-separated feed items in a graphical command-line UI.  The\ninterface has a look inspired by the <a href="http://www.mutt.org/">mutt mail client</a>. It has a sidebar\npanel for the feeds, a panel with a listing of the items and a small statusbar\nfor the selected item/URL. Some functions like searching and scrolling are\nintegrated in the interface itself.</p>\n<h2>Features</h2>\n<ul>\n<li>Relatively few LOC, about 2.5K lines of C.</li>\n<li>Few dependencies: a C compiler and a curses library (typically ncurses).\nIt also requires a terminal (emulator) supporting UTF-8.</li>\n<li>Easy to customize by modifying the small source-code and shellscripts.</li>\n<li>Quite fast.</li>\n<li>Plumb support: open the URL or an enclosure URL directly with any program.</li>\n<li>Pipe support: pipe the selected Tab-Separated Value line to a program for\nscripting purposes. Like viewing the content in any way you like.</li>\n<li>Yank support: copy the URL or an enclosure URL to the clipboard.</li>\n<li>Familiar keybinds: supports both vi-like, emacs-like and arrow keys for\nactions.</li>\n<li>Mouse support: it supports xterm X10 and extended SGR encoding.</li>\n<li>Support two ways of managing read/unread items.\nBy default sfeed_curses marks the feed items of the last day as new/bold.\nAlternatively a simple plain-text list with the read URLs can be used.</li>\n<li>UI layouts: supports vertical, horizontal and monocle (full-screen) layouts.\nUseful for different kind of screen sizes.</li>\n<li>Auto-execute keybind commands at startup to automate setting a preferred\nlayout, toggle showing new items or other actions.</li>\n</ul>\n<p>Like the format programs included in sfeed you can run it by giving the feed\nfiles as arguments like this:</p>\n<pre><code>sfeed_curses ~/.sfeed/feeds/*\n</code></pre>\n<p>... or by reading directly from stdin:</p>\n<pre><code>sfeed_curses &lt; ~/.sfeed/feeds/xkcd\n</code></pre>\n<p>It will show a sidebar if one or more files are specified as parameters. It\nwill not show the sidebar by default when reading from stdin.</p>\n<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>\n<p>On pressing the 'o' or ENTER keybind it will open the link URL of an item with\nthe plumb program.  On pressing the 'a', 'e' or '@' keybind it will open the\nenclosure 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>,\nbut can be modified by setting the environment variable $SFEED_PLUMBER.  The\nplumb program receives the URL as a command-line argument.</p>\n<p>The TAB-Separated-Value line of the current selected item in the feed file can\nbe piped to a program by pressing the 'c', 'p' or '|' keybind. This allows much\nflexibility to make a content formatter or write other custom actions or views.\nThis line is in the exact same format as described in the sfeed(5) man page.</p>\n<p>The pipe program can be changed by setting the environment variable\n$SFEED_PIPER.</p>\n<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>\n<p>The above screenshot shows the included <a href="https://git.codemadness.org/sfeed_curses/file/sfeed_content.html">sfeed_content</a> shellscript which uses\nthe <a href="https://invisible-island.net/lynx/">lynx text-browser</a> to convert HTML to plain-text.  It pipes the formatted\nplain-text to the user $PAGER (or "less").</p>\n<p>Of course the script can be easily changed to use a different browser or\nHTML-to-text converter like:</p>\n<ul>\n<li><a href="https://www.dillo.org/">dillo</a></li>\n<li><a href="http://www.jikos.cz/~mikulas/links/">links</a></li>\n<li><a href="http://w3m.sourceforge.net/">w3m</a></li>\n<li><a href="https://git.codemadness.org/webdump/file/README.html">webdump</a></li>\n</ul>\n<p>It's easy to modify the color-theme by changing the macros in the source-code\nor set a predefined theme at compile-time. The README file contains information\nhow to set a theme.  On the left a <a href="https://templeos.org/">TempleOS</a>-like color-theme on the right a\n<a href="https://newsboat.org/">newsboat</a>-like colorscheme.</p>\n<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>\n<p>It supports a vertical layout, horizontal and monocle (full-screen) layout.\nThis can be useful for different kind of screen sizes.  The keybinds '1', '2'\nand '3' can be used to switch between these layouts.</p>\n<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>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/sfeed\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/sfeed/">https://git.codemadness.org/sfeed/</a></li>\n<li><a href="gopher://codemadness.org/1/git/sfeed">gopher://codemadness.org/1/git/sfeed</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/sfeed/">https://codemadness.org/releases/sfeed/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/sfeed">gopher://codemadness.org/1/releases/sfeed</a></li>\n</ul>\n<h2>Build and install</h2>\n<pre><code>$ make\n# make install\n</code></pre>	html	https://www.codemadness.org/sfeed_curses-ui.html	Hiltjo		
1573344000	hurl: HTTP, HTTPS and Gopher file grabber	https://www.codemadness.org/hurl.html	<h1>hurl: HTTP, HTTPS and Gopher file grabber</h1>\n\t<p><strong>Last modification on </strong> <time>2020-07-20</time></p>\n\t<p>hurl is a relatively simple HTTP, HTTPS and Gopher client/file grabber.</p>\n<h2>Why?</h2>\n<p>Sometimes (or most of the time?) you just want to fetch a file via the HTTP,\nHTTPS or Gopher protocol.</p>\n<p>The focus of this tool is only this.</p>\n<h2>Features</h2>\n<ul>\n<li>Uses OpenBSD pledge(2) and unveil(2). Allow no filesystem access (writes to\nstdout).</li>\n<li>Impose time-out and maximum size limits.</li>\n<li>Use well-defined exitcodes for reliable scripting (curl sucks at this).</li>\n<li>Send as little information as possible (no User-Agent etc by default).</li>\n</ul>\n<h2>Anti-features</h2>\n<ul>\n<li>No HTTP byte range support.</li>\n<li>No HTTP User-Agent.</li>\n<li>No HTTP If-Modified-Since/If-* support.</li>\n<li>No HTTP auth support.</li>\n<li>No HTTP/2+ support.</li>\n<li>No HTTP keep-alive.</li>\n<li>No HTTP chunked-encoding support.</li>\n<li>No HTTP redirect support.</li>\n<li>No (GZIP) compression support.</li>\n<li>No cookie-jar or cookie parsing support.</li>\n<li>No Gopher text handling (".\\r\\n").</li>\n<li>... etc...</li>\n</ul>\n<h2>Dependencies</h2>\n<ul>\n<li>C compiler (C99).</li>\n<li>libc + some BSD functions like err() and strlcat().</li>\n<li>LibreSSL(-portable)</li>\n<li>libtls (part of LibreSSL).</li>\n</ul>\n<h2>Optional dependencies</h2>\n<ul>\n<li>POSIX make(1) (for Makefile).</li>\n<li>mandoc for documentation: <a href="https://mdocml.bsd.lv/">https://mdocml.bsd.lv/</a></li>\n</ul>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/hurl\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/hurl/">https://git.codemadness.org/hurl/</a></li>\n<li><a href="gopher://codemadness.org/1/git/hurl">gopher://codemadness.org/1/git/hurl</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/hurl/">https://codemadness.org/releases/hurl/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/hurl">gopher://codemadness.org/1/releases/hurl</a></li>\n</ul>\n<h2>Build and install</h2>\n<pre><code>$ make\n# make install\n</code></pre>\n<h2>Examples</h2>\n<p>Fetch the Atom feed from this site using a maximum filesize limit of 1MB and\na time-out limit of 15 seconds:</p>\n<pre><code>hurl -m 1048576 -t 15 "https://codemadness.org/atom.xml"\n</code></pre>\n<p>There is an -H option to add custom headers. This way some of the anti-features\nlisted above are supported. For example some CDNs like Cloudflare are known to\nblock empty or certain User-Agents.</p>\n<p>User-Agent:</p>\n<pre><code>hurl -H 'User-Agent: some browser' 'https://codemadness.org/atom.xml'\n</code></pre>\n<p>HTTP Basic Auth (base64-encoded username:password):</p>\n<pre><code>hurl -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\n\t'https://codemadness.org/atom.xml'\n</code></pre>\n<p>GZIP (this assumes the served response Content-Type is gzip):</p>\n<pre><code>hurl -H 'Accept-Encoding: gzip' 'https://somesite/' | gzip -d\n</code></pre>	html	https://www.codemadness.org/hurl.html	Hiltjo		
1570924800	json2tsv: a JSON to TSV converter	https://www.codemadness.org/json2tsv.html	<h1>json2tsv: a JSON to TSV converter</h1>\n\t<p><strong>Last modification on </strong> <time>2021-09-25</time></p>\n\t<p>Convert JSON to TSV or separated output.</p>\n<p>json2tsv reads JSON data from stdin.  It outputs each JSON type to a TAB-\nSeparated Value format per line by default.</p>\n<h2>TAB-Separated Value format</h2>\n<p>The output format per line is:</p>\n<pre><code>nodename&lt;TAB&gt;type&lt;TAB&gt;value&lt;LF&gt;\n</code></pre>\n<p>Control-characters such as a newline, TAB and backslash (\\n, \\t and \\) are\nescaped in the nodename and value fields.  Other control-characters are\nremoved.</p>\n<p>The type field is a single byte and can be:</p>\n<ul>\n<li>a for array</li>\n<li>b for bool</li>\n<li>n for number</li>\n<li>o for object</li>\n<li>s for string</li>\n<li>? for null</li>\n</ul>\n<p>Filtering on the first field "nodename" is easy using awk for example.</p>\n<h2>Features</h2>\n<ul>\n<li>Accepts all <strong>valid</strong> JSON.</li>\n<li>Designed to work well with existing UNIX programs like awk and grep.</li>\n<li>Straightforward and not much lines of code: about 475 lines of C.</li>\n<li>Few dependencies: C compiler (C99), libc.</li>\n<li>No need to learn a new (meta-)language for processing data.</li>\n<li>The parser supports code point decoding and UTF-16 surrogates to UTF-8.</li>\n<li>It does not output control-characters to the terminal for security reasons by\ndefault (but it has a -r option if needed).</li>\n<li>On OpenBSD it supports <a href="https://man.openbsd.org/pledge">pledge(2)</a> for syscall restriction:\npledge("stdio", NULL).</li>\n<li>Supports setting a different field separator and record separator with the -F\nand -R option.</li>\n</ul>\n<h2>Cons</h2>\n<ul>\n<li>For the tool there is additional overhead by processing and filtering data\nfrom stdin after parsing.</li>\n<li>The parser does not do complete validation on numbers.</li>\n<li>The parser accepts some bad input such as invalid UTF-8\n(see <a href="https://tools.ietf.org/html/rfc8259#section-8.1">RFC8259 - 8.1. Character Encoding</a>).\njson2tsv reads from stdin and does not do assumptions about a "closed\necosystem" as described in the RFC.</li>\n<li>The parser accepts some bad JSON input and "extensions"\n(see <a href="https://tools.ietf.org/html/rfc8259#section-9">RFC8259 - 9. Parsers</a>).</li>\n<li>Encoded NUL bytes (\\u0000) in strings are ignored.\n(see <a href="https://tools.ietf.org/html/rfc8259#section-9">RFC8259 - 9. Parsers</a>).\n"An implementation may set limits on the length and character contents of\nstrings."</li>\n<li>The parser is not the fastest possible JSON parser (but also not the\nslowest).  For example: for ease of use, at the cost of performance all\nstrings are decoded, even though they may be unused.</li>\n</ul>\n<h2>Why Yet Another JSON parser?</h2>\n<p>I wanted a tool that makes parsing JSON easier and work well from the shell,\nsimilar to <a href="https://stedolan.github.io/jq/">jq</a>.</p>\n<p>sed and grep often work well enough for matching some value using some regex\npattern, but it is not good enough to parse JSON correctly or to extract all\ninformation: just like parsing HTML/XML using some regex is not good (enough)\nor a good idea :P.</p>\n<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\nsomething simpler.</p>\n<p>While it is more efficient to embed this query language for data aggregation,\nit is also less simple. In my opinion it is simpler to separate this and use\npattern-processing by awk or an other filtering/aggregating program.</p>\n<p>For the parser, there are many JSON parsers out there, like the efficient\n<a href="https://github.com/zserge/jsmn">jsmn parser</a>, however a few parser behaviours I want to have are:</p>\n<ul>\n<li>jsmn buffers data as tokens, which is very efficient, but also a bit\nannoying as an API as it requires another layer of code to interpret the\ntokens.</li>\n<li>jsmn does not handle decoding strings by default. Which is very efficient\nif you don't need parts of the data though.</li>\n<li>jsmn does not keep context of nested structures by default, so may require\nwriting custom utility functions for nested data.</li>\n</ul>\n<p>This is why I went for a parser design that uses a single callback per "node"\ntype and keeps track of the current nested structure in a single array and\nemits that.</p>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/json2tsv\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/json2tsv/">https://git.codemadness.org/json2tsv/</a></li>\n<li><a href="gopher://codemadness.org/1/git/json2tsv">gopher://codemadness.org/1/git/json2tsv</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/json2tsv/">https://codemadness.org/releases/json2tsv/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/json2tsv">gopher://codemadness.org/1/releases/json2tsv</a></li>\n</ul>\n<h2>Build and install</h2>\n<pre><code>$ make\n# make install\n</code></pre>\n<h2>Examples</h2>\n<p>An usage example to parse posts of the JSON API of <a href="https://www.reddit.com/">reddit.com</a> and format them\nto a plain-text list using awk:</p>\n<pre><code>#!/bin/sh\ncurl -s -H 'User-Agent:' 'https://old.reddit.com/.json?raw_json=1&amp;limit=100' | \\\njson2tsv | \\\nawk -F '\\t' '\nfunction show() {\n\tif (length(o["title"]) == 0)\n\t\treturn;\n\tprint n ". " o["title"] " by " o["author"] " in r/" o["subreddit"];\n\tprint o["url"];\n\tprint "";\n}\n$1 == ".data.children[].data" {\n\tshow();\n\tn++;\n\tdelete o;\n}\n$1 ~ /^\\.data\\.children\\[\\]\\.data\\.[a-zA-Z0-9_]*$/ {\n\to[substr($1, 23)] = $3;\n}\nEND {\n\tshow();\n}'\n</code></pre>\n<h2>References</h2>\n<ul>\n<li>Sites:\n<ul>\n<li><a href="http://seriot.ch/parsing_json.php">seriot.ch - Parsing JSON is a Minefield</a></li>\n<li><a href="https://github.com/nst/JSONTestSuite">A comprehensive test suite for RFC 8259 compliant JSON parsers</a></li>\n<li><a href="https://json.org/">json.org</a></li>\n</ul>\n</li>\n<li>Current standard:\n<ul>\n<li><a href="https://tools.ietf.org/html/rfc8259">RFC8259 - The JavaScript Object Notation (JSON) Data Interchange Format</a></li>\n<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>\n</ul>\n</li>\n<li>Historic standards:\n<ul>\n<li><a href="https://tools.ietf.org/html/rfc7159">RFC7159 - The JavaScript Object Notation (JSON) Data Interchange Format (obsolete)</a></li>\n<li><a href="https://tools.ietf.org/html/rfc7158">RFC7158 - The JavaScript Object Notation (JSON) Data Interchange Format (obsolete)</a></li>\n<li><a href="https://tools.ietf.org/html/rfc4627">RFC4627 - The JavaScript Object Notation (JSON) Data Interchange Format (obsolete, original)</a></li>\n</ul>\n</li>\n</ul>	html	https://www.codemadness.org/json2tsv.html	Hiltjo		
1556064000	OpenBSD: setup a local auto-installation server	https://www.codemadness.org/openbsd-autoinstall.html	<h1>OpenBSD: setup a local auto-installation server</h1>\n\t<p><strong>Last modification on </strong> <time>2020-04-30</time></p>\n\t<p>This guide describes how to setup a local mirror and installation/upgrade\nserver that requires little or no input interaction.</p>\n<h2>Setup a local HTTP mirror</h2>\n<p>The HTTP mirror will be used to fetch the base sets and (optional) custom sets.\nIn this guide we will assume <strong>192.168.0.2</strong> is the local installation server\nand mirror, the CPU architecture is amd64 and the OpenBSD release version is\n6.5.  We will store the files in the directory with the structure:</p>\n<pre><code>http://192.168.0.2/pub/OpenBSD/6.5/amd64/\n</code></pre>\n<p>Create the www serve directory and fetch all sets and install files\n(if needed to save space *.iso and install65.fs can be skipped):</p>\n<pre><code>$ cd /var/www/htdocs\n$ mkdir -p pub/OpenBSD/6.5/amd64/\n$ cd pub/OpenBSD/6.5/amd64/\n$ ftp 'ftp://ftp.nluug.nl/pub/OpenBSD/6.5/amd64/*'\n</code></pre>\n<p>Verify signature and check some checksums:</p>\n<pre><code>$ signify -C -p /etc/signify/openbsd-65-base.pub -x SHA256.sig\n</code></pre>\n<p>Setup <a href="https://man.openbsd.org/httpd.8">httpd(8)</a> for simple file serving:</p>\n<pre><code># $FAVORITE_EDITOR /etc/httpd.conf\n</code></pre>\n<p>A minimal example config for <a href="https://man.openbsd.org/httpd.conf.5">httpd.conf(5)</a>:</p>\n<pre><code>server "*" {\n\tlisten on * port 80\n}\n</code></pre>\n<p>The default www root directory is: /var/www/htdocs/</p>\n<p>Enable the httpd daemon to start by default and start it now:</p>\n<pre><code># rcctl enable httpd\n# rcctl start httpd\n</code></pre>\n<h2>Creating an installation response/answer file</h2>\n<p>The installer supports loading responses to the installation/upgrade questions\nfrom a simple text file. We can do a regular installation and copy the answers\nfrom the saved file to make an automated version of it.</p>\n<p>Do a test installation, at the end of the installation or upgrade when asked the\nquestion:</p>\n<pre><code>Exit to (S)hell, (H)alt or (R)eboot?\n</code></pre>\n<p>Type S to go to the shell. Find the response file for an installation and copy\nit to some USB stick or write down the response answers:</p>\n<pre><code>cp /tmp/i/install.resp /mnt/usbstick/\n</code></pre>\n<p>A response file could be for example:</p>\n<pre><code>System hostname = testvm\nWhich network interface do you wish to configure = em0\nIPv4 address for em0 = dhcp\nIPv6 address for em0 = none\nWhich network interface do you wish to configure = done\nPassword for root account = $2b$10$IqI43aXjgD55Q3nLbRakRO/UAG6SAClL9pyk0vIUpHZSAcLx8fWk.\nPassword for user testuser = $2b$10$IqI43aXjgD55Q3nLbRakRO/UAG6SAClL9pyk0vIUpHZSAcLx8fWk.\nStart sshd(8) by default = no\nDo you expect to run the X Window System = no\nSetup a user = testuser\nFull name for user testuser = testuser\nWhat timezone are you in = Europe/Amsterdam\nWhich disk is the root disk = wd0\nUse (W)hole disk MBR, whole disk (G)PT, (O)penBSD area or (E)dit = OpenBSD\nUse (A)uto layout, (E)dit auto layout, or create (C)ustom layout = a\nLocation of sets = http\nHTTP proxy URL = none\nHTTP Server = 192.168.0.2\nServer directory = pub/OpenBSD/6.5/amd64\nUnable to connect using https. Use http instead = yes\nLocation of sets = http\nSet name(s) = done\nLocation of sets = done\nExit to (S)hell, (H)alt or (R)eboot = R\n</code></pre>\n<p>Get custom encrypted password for response file:</p>\n<pre><code>$ printf '%s' 'yourpassword' | encrypt\n</code></pre>\n<h2>Changing the RAMDISK kernel disk image</h2>\n<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\navailable in the /usr/src/ tree as elfrdsetroot, see also the <a href="https://man.openbsd.org/rd.4">rd(4)</a> man page.</p>\n<pre><code>$ mkdir auto\n$ cd auto\n$ cp pubdir/bsd.rd .\n$ rdsetroot -x bsd.rd disk.fs\n# vnconfig vnd0 disk.fs\n# mkdir mount\n# mount /dev/vnd0a mount\n</code></pre>\n<p>Copy the response file (install.resp) to: mount/auto_install.conf\n(installation) <strong>or</strong> mount/auto_upgrade.conf (upgrade), but not both. In this\nguide we will do an auto-installation.</p>\n<p>Unmount, detach and patch RAMDISK:</p>\n<pre><code># umount mount\n# vnconfig -u vnd0\n$ rdsetroot bsd.rd disk.fs\n</code></pre>\n<p>To test copy bsd.rd to the root of some testmachine like /bsd.test.rd then\n(re)boot and type:</p>\n<pre><code>boot /bsd.test.rd\n</code></pre>\n<p>In the future (6.5+) it will be possible to copy to a file named "/bsd.upgrade"\nin the root of a current system and automatically load the kernel:\n<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>\nOf course this is possible with PXE boot or some custom USB/ISO also.\nAs explained in the <a href="https://man.openbsd.org/autoinstall.8">autoinstall(8)</a> man page: create either an\nauto_upgrade.conf <strong>or</strong> an auto_install.conf, but not both.</p>\n<h2>Create bootable miniroot</h2>\n<p>In this example the miniroot will boot the custom kernel, but fetch all the\nsets from the local network.</p>\n<p>We will base our miniroot of the official version: miniroot65.fs.</p>\n<p>We will create a 16MB miniroot to boot from (in this guide it is assumed the\noriginal miniroot is about 4MB and the modified kernel image fits in the new\nallocated space):</p>\n<pre><code>$ dd if=/dev/zero of=new.fs bs=512 count=32768\n</code></pre>\n<p>Copy first part of the original image to the new disk (no truncation):</p>\n<pre><code>$ dd conv=notrunc if=miniroot65.fs of=new.fs\n# vnconfig vnd0 new.fs\n</code></pre>\n<p>Expand disk OpenBSD boundaries:</p>\n<pre><code># disklabel -E vnd0\n&gt; b\nStarting sector: [1024]\nSize ('*' for entire disk): [8576] *\n&gt; r\nTotal free sectors: 1168.\n&gt; c a\nPartition a is currently 8576 sectors in size, and can have a maximum\nsize of 9744 sectors.\nsize: [8576] *\n&gt; w\n&gt; q\n</code></pre>\n<p>or:</p>\n<pre><code># printf 'b\\n\\n*\\nc a\\n*\\nw\\n' | disklabel -E vnd0\n</code></pre>\n<p>Grow filesystem and check it and mark as clean:</p>\n<pre><code># growfs -y /dev/vnd0a\n# fsck -y /dev/vnd0a\n</code></pre>\n<p>Mount filesystem:</p>\n<pre><code># mount /dev/vnd0a mount/\n</code></pre>\n<p>The kernel on the miniroot is GZIP compressed. Compress our modified bsd.rd and\noverwrite the original kernel:</p>\n<pre><code># gzip -c9n bsd.rd &gt; mount/bsd\n</code></pre>\n<p>Or to save space (+- 500KB) by stripping debug symbols, taken from bsd.gz target\n<a href="https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/distrib/amd64/iso/Makefile">in this Makefile</a>.</p>\n<pre><code>$ cp bsd.rd bsd.strip\n$ strip bsd.strip\n$ strip -R .comment -R .SUNW_ctf bsd.strip\n$ gzip -c9n bsd.strip &gt; bsd.gz\n$ cp bsd.gz mount/bsd\n</code></pre>\n<p>Now unmount and detach:</p>\n<pre><code># umount mount/\n# vnconfig -u vnd0\n</code></pre>\n<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>\n<h2>Adding custom sets (optional)</h2>\n<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\ncustomized installation set like siteVERSION.tgz, for example: site65.tgz.  The\nsets can even be specified per host/MAC address like\nsiteVERSION-$(hostname -s).tgz so for example: site65-testvm.tgz</p>\n<p>When the installer checks the base sets of the mirror it looks for a file\nindex.txt.  To add custom sets the site entries have to be added.</p>\n<p>For example:</p>\n<pre><code>-rw-r--r--  1 1001  0    4538975 Oct 11 13:58:26 2018 site65-testvm.tgz\n</code></pre>\n<p>The filesize, permissions etc do not matter and are not checked by the\ninstaller.  Only the filename is matched by a regular expression.</p>\n<h2>Sign custom site* tarball sets (optional)</h2>\n<p>If you have custom sets without creating a signed custom release you will be\nprompted for the messages:</p>\n<pre><code>checksum test failed\n</code></pre>\n<p>and:</p>\n<pre><code>unverified sets: continue without verification\n</code></pre>\n<p>OpenBSD uses the program <a href="https://man.openbsd.org/signify.1">signify(1)</a> to cryptographically sign and\nverify filesets.</p>\n<p>To create a custom public/private keypair (ofcourse make sure to store the\nprivate key privately):</p>\n<pre><code>$ signify -G -n -c "Custom 6.5 install" -p custom-65-base.pub -s custom-65-base.sec\n</code></pre>\n<p>Create new checksum file with filelist of the current directory (except SHA256*\nfiles):</p>\n<pre><code>$ printf '%s\\n' * | grep -v SHA256 | xargs sha256 &gt; SHA256\n</code></pre>\n<p>Sign SHA256 and store as SHA256.sig, embed signature:</p>\n<pre><code>$ signify -S -e -s /privatedir/custom-65-base.sec -m SHA256 -x SHA256.sig\n</code></pre>\n<p>Verify the created signature and data is correct:</p>\n<pre><code>$ signify -C -p /somelocation/custom-65-base.pub -x SHA256.sig\n</code></pre>\n<p>Copy <strong>only</strong> the <strong>public</strong> key to the RAMDISK:</p>\n<pre><code>$ cp custom-65-base.pub mount/etc/signify/custom-65-base.pub\n</code></pre>\n<p>Now we have to patch the install.sub file to check our public key.  If you know\na better way without having to patch this script, please let me know.</p>\n<p>Change the variable PUB_KEY in the shellscript mount/install.sub from:</p>\n<pre><code>PUB_KEY=/etc/signify/openbsd-${VERSION}-base.pub\n</code></pre>\n<p>To:</p>\n<pre><code>PUB_KEY=/etc/signify/custom-${VERSION}-base.pub\n</code></pre>\n<p>And for upgrades from:</p>\n<pre><code>$UPGRADE_BSDRD &amp;&amp;\n\tPUB_KEY=/mnt/etc/signify/openbsd-$((VERSION + 1))-base.pub\n</code></pre>\n<p>To:</p>\n<pre><code>$UPGRADE_BSDRD &amp;&amp;\n\tPUB_KEY=/mnt/etc/signify/custom-$((VERSION + 1))-base.pub\n</code></pre>\n<h2>Ideas</h2>\n<ul>\n<li>Patch <a href="https://man.openbsd.org/rc.firsttime.8">rc.firsttime(8)</a>: and run syspatch, add ports, setup xenodm etc.</li>\n<li>Custom partitioning scheme, see <a href="https://man.openbsd.org/autoinstall.8">autoinstall(8)</a> "URL to autopartitioning\ntemplate for disklabel = url".</li>\n<li>Setup <a href="https://man.openbsd.org/pxeboot.8">pxeboot(8)</a> to boot and install over the network using\n<a href="https://man.openbsd.org/dhcpd.8">dhcpd(8)</a> and\n<a href="https://man.openbsd.org/tftpd.8">tftpd(8)</a> then not even some USB stick is required.</li>\n</ul>\n<h2>References</h2>\n<ul>\n<li>Main OpenBSD installation and upgrade shellscript:\n<a href="https://cvsweb.openbsd.org/src/distrib/miniroot/install.sub">/usr/src/distrib/miniroot/install.sub</a></li>\n</ul>	html	https://www.codemadness.org/openbsd-autoinstall.html	Hiltjo		
1549756800	Idiotbox: Youtube interface	https://www.codemadness.org/idiotbox.html	<h1>Idiotbox: Youtube interface</h1>\n\t<p><strong>Last modification on </strong> <time>2021-12-25</time></p>\n\t<p>Idiotbox is a less resource-heavy Youtube interface.  For viewing videos it is\nrecommended to use it with <a href="https://mpv.io/">mpv</a> or\n<a href="https://mplayerhq.hu/">mplayer</a> with\n<a href="https://youtube-dl.org/">youtube-dl</a> or\n<a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a>.</p>\n<p>For more (up-to-date) information see the <a href="/git/frontends/file/youtube/README.html">README</a> file.</p>\n<h2>Why</h2>\n<p>In my opinion the standard Youtube web interface is:</p>\n<ul>\n<li>Non-intuitive, too much visual crap.</li>\n<li>Too resource-hungry, both in CPU and bandwidth.</li>\n<li>Doesn't work well on simpler (text-based) browsers such as netsurf and links.</li>\n</ul>\n<h2>Features</h2>\n<ul>\n<li>Doesn't use JavaScript.</li>\n<li>Doesn't use (tracking) cookies.</li>\n<li>CSS is optional.</li>\n<li>Multiple interfaces available: HTTP CGI, command-line, Gopher CGI (gph),\nthis is a work-in-progress.</li>\n<li>Doesn't use or require the Google API.</li>\n<li>CGI interface works nice in most browsers, including text-based ones.</li>\n<li>On OpenBSD it runs "sandboxed" and it can be compiled as a static-linked\nbinary with <a href="https://man.openbsd.org/pledge">pledge(2)</a>,\n<a href="https://man.openbsd.org/unveil">unveil(2)</a> in a chroot.</li>\n</ul>\n<h2>Cons</h2>\n<ul>\n<li>Order by upload date is incorrect (same as on Youtube).</li>\n<li>Some Youtube features are not supported.</li>\n<li>Uses scraping so might break at any point.</li>\n</ul>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/frontends\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/frontends/">https://git.codemadness.org/frontends/</a></li>\n<li><a href="gopher://codemadness.org/1/git/frontends">gopher://codemadness.org/1/git/frontends</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/frontends/">https://codemadness.org/releases/frontends/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/frontends">gopher://codemadness.org/1/releases/frontends</a></li>\n</ul>\n<h2>View</h2>\n<p>You can view it here: <a href="https://codemadness.org/idiotbox/">https://codemadness.org/idiotbox/</a></p>\n<p>For example you can search using the query string parameter "q":\n<a href="https://codemadness.org/idiotbox/?q=gunther+tralala">https://codemadness.org/idiotbox/?q=gunther+tralala</a></p>\n<p>The gopher version is here: <a href="gopher://codemadness.org/7/idiotbox.cgi">gopher://codemadness.org/7/idiotbox.cgi</a></p>	html	https://www.codemadness.org/idiotbox.html	Hiltjo		
1534464000	Gopher HTTP proxy	https://www.codemadness.org/gopher-proxy.html	<h1>Gopher HTTP proxy</h1>\n\t<p><strong>Last modification on </strong> <time>2020-08-30</time></p>\n\t<p>For fun I wrote a small HTTP Gopher proxy CGI program in C. It only supports\nthe basic Gopher types and has some restrictions to prevent some abuse.</p>\n<p>For your regular Gopher browsing I recommend the simple Gopher client <a href="https://git.fifth.space/sacc/">sacc</a>.</p>\n<p>For more information about Gopher check out <a href="http://gopherproject.org/">gopherproject.org</a>.</p>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/gopherproxy-c\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/gopherproxy-c/">https://git.codemadness.org/gopherproxy-c/</a></li>\n<li><a href="gopher://codemadness.org/1/git/gopherproxy-c">gopher://codemadness.org/1/git/gopherproxy-c</a></li>\n</ul>\n<h2>View</h2>\n<p>You can view it here:\n<a href="https://codemadness.org/gopherproxy/">https://codemadness.org/gopherproxy/</a></p>\n<p>For example you can also view my gopherhole using the proxy, the query string\nparameter "q" reads the URI:\n<a href="https://codemadness.org/gopherproxy/?q=codemadness.org">https://codemadness.org/gopherproxy/?q=codemadness.org</a></p>	html	https://www.codemadness.org/gopher-proxy.html	Hiltjo		
1520640000	Setup your own file paste service	https://www.codemadness.org/paste-service.html	<h1>Setup your own file paste service</h1>\n\t<p><strong>Last modification on </strong> <time>2018-03-10</time></p>\n\t<h2>Setup SSH authentication</h2>\n<p>Make sure to setup SSH public key authentication so you don't need to enter a\npassword each time and have a more secure authentication.</p>\n<p>For example in the file $HOME/.ssh/config:</p>\n<pre><code>Host codemadness\n\tHostname codemadness.org\n\tPort 22\n\tIdentityFile ~/.ssh/codemadness/id_rsa\n</code></pre>\n<p>Of course also make sure to generate the private and public keys.</p>\n<h2>Shell alias</h2>\n<p>Make an alias or function in your shell config:</p>\n<pre><code>pastesrv() {\n\tssh user@codemadness "cat &gt; /your/www/publicdir/paste/$1"\n\techo "https://codemadness.org/paste/$1"\n}\n</code></pre>\n<p>This function reads any data from stdin and transfers the output securely via\nSSH and writes it to a file at the specified path. This path can be visible via\nHTTP, gopher or an other protocol. Then it writes the absolute URL to stdout,\nthis URL can be copied to the clipboard and pasted anywhere like to an e-mail,\nIRC etc.</p>\n<h2>Usage and examples</h2>\n<p>To use it, here are some examples:</p>\n<p>Create a patch of the last commit in the git repo and store it:</p>\n<pre><code>git format-patch --stdout HEAD^ | pastesrv 'somepatch.diff'\n</code></pre>\n<p>Create a screenshot of your current desktop and paste it:</p>\n<pre><code>xscreenshot | ff2png | pastesrv 'screenshot.png'\n</code></pre>\n<p>There are many other uses of course, use your imagination :)</p>	html	https://www.codemadness.org/paste-service.html	Hiltjo		
1519516800	Setup your own git hosting service	https://www.codemadness.org/setup-git-hosting.html	<h1>Setup your own git hosting service</h1>\n\t<p><strong>Last modification on </strong> <time>2022-08-07</time></p>\n\t<p><strong>This article assumes you use OpenBSD for the service files and OS-specific\nexamples.</strong></p>\n<h2>Why</h2>\n<p>A good reason to host your own git repositories is because of having and\nkeeping control over your own computing infrastructure.</p>\n<p>Some bad examples:</p>\n<ul>\n<li><a href="https://en.wikipedia.org/wiki/SourceForge#Controversies">The SourceForge ads/malware/hijack controversies. Injecting malware into projects</a>.</li>\n<li><a href="https://gitlab.com/gitlab-org/gitaly/issues/2113">As of 2019-10-23 Gitlab added telemetry to their software</a>.</li>\n<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>\n<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>\n<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>\n<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>\n<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>\n<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>\n</ul>\n<p>The same thing can happen with Github, Atlassian Bitbucket or other similar\nservices.  After all: they are just a company with commercial interests.  These\nonline services also have different pricing plans and various (arbitrary)\nrestrictions.  When you host it yourself the restrictions are the resource\nlimits of the system and your connection, therefore it is a much more flexible\nsolution.</p>\n<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\ncan host it yourself, so you will be in control of it.</p>\n<h2>Creating repositories</h2>\n<p>For the hosting it is recommended to use a so-called "bare" repository.  A bare\nrepository means no files are checked out in the folder itself.  To create a\nbare repository use git init with the --bare argument:</p>\n<pre><code>$ git init --bare\n</code></pre>\n<p>I recommend to create a separate user and group for the source-code\nrepositories.  In the examples we will assume the user is called "src".</p>\n<p>Login as the src user and create the files. To create a directory for the\nrepos, in this example /home/src/src:</p>\n<pre><code>$ mkdir -p /home/src/src\n$ cd /home/src/src\n$ git init --bare someproject\n$ $EDITOR someproject/description\n</code></pre>\n<p>Make sure the git-daemon process has access permissions to these repositories.</p>\n<h2>Install git-daemon (optional)</h2>\n<p>Using git-daemon you can clone the repositories publicly using the efficient\ngit:// protocol. An alternative without having to use git-daemon is by using\n(anonymous) SSH, HTTPS or any public shared filesystem.</p>\n<p>When you use a private-only repository I recommend to just use SSH without\ngit-daemon because it is secure.</p>\n<p>Install the git package. The package should contain "git daemon":</p>\n<pre><code># pkg_add git\n</code></pre>\n<p>Enable the daemon:</p>\n<pre><code># rcctl enable gitdaemon\n</code></pre>\n<p>Set the gitdaemon service flags to use the src directory and use all the\navailable repositories in this directory. The command-line flags "--export-all"\nexports all repositories in the base path. Alternatively you can use the\n"git-daemon-export-ok" file (see the git-daemon man page).</p>\n<pre><code># rcctl set gitdaemon flags --export-all --base-path="/home/src/src"\n</code></pre>\n<p>To configure the service to run as the user _gitdaemon:</p>\n<pre><code># rcctl set gitdaemon user _gitdaemon\n</code></pre>\n<p>To run the daemon directly as the user _gitdaemon (without dropping privileges\nfrom root to the user) set the following flags in /etc/rc.d/gitdaemon:</p>\n<pre><code>daemon_flags="--user=_gitdaemon"\n</code></pre>\n<p>Which will also avoid this warning while cloning:</p>\n<pre><code>"can't access /root/.git/config"\n</code></pre>\n<p>Now start the daemon:</p>\n<pre><code># rcctl start gitdaemon\n</code></pre>\n<h2>Cloning and fetching changes</h2>\n<p>To test and clone the repository do:</p>\n<pre><code>$ git clone git://yourdomain/someproject\n</code></pre>\n<p>if you skipped the optional git-daemon installation then just clone via SSH:</p>\n<pre><code>$ git clone ssh://youraccount@yourdomain:/home/src/src/someproject\n</code></pre>\n<p>When cloning via SSH make sure to setup private/public key authentication for\nsecurity and convenience.</p>\n<p>You should also make sure the firewall allows connections to the services like\nthe git daemon, HTTPd or SSH, for example using OpenBSD pf something like this\ncan be set in <a href="https://man.openbsd.org/pf.conf">/etc/pf.conf</a>:</p>\n<pre><code>tcp_services="{ ssh, gopher, http, https, git }"\npass in on egress proto tcp from any to (egress) port $tcp_services\n</code></pre>\n<h2>Pushing changes</h2>\n<p>Add the repository as a remote:</p>\n<pre><code>$ git remote add myremote ssh://youraccount@yourdomain:/home/src/src/someproject\n</code></pre>\n<p>Then push the changes:</p>\n<pre><code>$ git push myremote master:master\n</code></pre>\n<h2>Git history web browsing (optional)</h2>\n<p>Sometimes it's nice to browse the git history log of the repository in a web\nbrowser or some other program without having to look at the local repository.</p>\n<ul>\n<li><a href="stagit.html">Stagit</a> is a static HTML page generator for git.</li>\n<li><a href="stagit-gopher.html">Stagit-gopher</a> is a static page generator for\n<a href="http://gopherproject.org/">gopher</a> and\n<a href="gopher://bitreich.org/1/scm/geomyidae">geomyidae</a>.</li>\n<li>cgit is a CGI-based program which shows HTML views of your repository, see\nalso the page: <a href="openbsd-httpd-and-cgit.html">OpenBSD httpd, slowcgi and cgit</a>.</li>\n</ul>\n<p>It's also possible with these tools to generate an Atom feed and then use a\nRSS/Atom reader to track the git history:</p>\n<ul>\n<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>\n<li>An example url from stagit for the <a href="/git/stagit/atom.xml">commit log</a>.</li>\n<li>An example url from stagit for the <a href="/git/stagit/tags.xml">releases</a>.</li>\n</ul>\n<p>My <a href="sfeed.html">sfeed</a> program can be used as a RSS/Atom reader.</p>\n<h2>Setting up git hooks (optional)</h2>\n<p>Using git hooks you can setup automated triggers, for example when pushing to a\nrepository.  Some useful examples can be:</p>\n<ul>\n<li><a href="/git/stagit/file/example_post-receive.sh.html">For stagit: update the repo files (example post-receive hook).</a></li>\n<li>Send an e-mail with the commit subject and message.</li>\n<li>Log/notify commits and changes to an IRC channel using a fifo: <a href="https://tools.suckless.org/ii/">ii</a>.</li>\n<li>Create a release tarball and checksum file on a tag push/change.</li>\n<li>Checkout files for website content.</li>\n</ul>	html	https://www.codemadness.org/setup-git-hosting.html	Hiltjo		
1512950400	Setup an OpenBSD SPARC64 VM in QEMU	https://www.codemadness.org/openbsd-sparc64-vm.html	<h1>Setup an OpenBSD SPARC64 VM in QEMU</h1>\n\t<p><strong>Last modification on </strong> <time>2020-04-18</time></p>\n\t<p>This describes how to setup an OpenBSD SPARC64 VM in QEMU.</p>\n<h2>Create a disk image</h2>\n<p>To create a 5GB disk image:</p>\n<pre><code>qemu-img create -f qcow2 fs.qcow2 5G\n</code></pre>\n<h2>Install</h2>\n<p>In this guide we'll use the installation ISO to install OpenBSD. Make sure to\ndownload the latest (stable) OpenBSD ISO, for example install62.iso.</p>\n<ul>\n<li>Change -boot c to -boot d to boot from the CD-ROM and do a clean install.</li>\n<li>Change -cdrom install62.iso to the location of your ISO file.</li>\n<li>When the install is done type: halt -p</li>\n<li>Change -boot d back to -boot c.</li>\n</ul>\n<p>Start the VM:</p>\n<pre><code>#!/bin/sh\nLC_ALL=C QEMU_AUDIO_DRV=none \\\nqemu-system-sparc64 \\\n\t-machine sun4u,usb=off \\\n\t-realtime mlock=off \\\n\t-smp 1,sockets=1,cores=1,threads=1 \\\n\t-rtc base=utc \\\n\t-m 1024 \\\n\t-boot c \\\n\t-drive file=fs.qcow2,if=none,id=drive-ide0-0-1,format=qcow2,cache=none \\\n\t-cdrom install62.iso \\\n\t-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-1,id=ide0-0-1 \\\n\t-msg timestamp=on \\\n\t-serial pty -nographic \\\n\t-net nic,model=ne2k_pci -net user\n</code></pre>\n<p>The VM has the following properties:</p>\n<ul>\n<li>No audio.</li>\n<li>No USB.</li>\n<li>No VGA graphics: serial console.</li>\n<li>Netdev is ne0 (Realtek 8029).</li>\n<li>1024MB memory.</li>\n</ul>\n<p>From your host connect to the serial device indicated by QEMU, for example:</p>\n<pre><code>(qemu) 2017-11-19T15:14:20.884312Z qemu-system-sparc64: -serial pty: char device redirected to /dev/ttyp0 (label serial0)\n</code></pre>\n<p>Then you can use the serial terminal emulator <strong>cu</strong> to attach:</p>\n<pre><code>cu -l /dev/ttyp0\n</code></pre>\n<p>Another option could be using the <a href="https://git.suckless.org/st/">simple terminal(st)</a> from suckless.</p>\n<pre><code>st -l /dev/ttyp0\n</code></pre>\n<p>using cu to detach the <a href="https://man.openbsd.org/cu#~^D">cu(1) man page</a> says:</p>\n<pre><code>Typed characters are normally transmitted directly to the remote machine (which\ndoes the echoing as well).  A tilde ('~') appearing as the first character of a\nline is an escape signal; the following are recognized:\n\n    ~^D or ~.  Drop the connection and exit.  Only the connection is\n               the login session is not terminated.\n</code></pre>\n<p>On boot you have to type:</p>\n<pre><code>root device: wd0a\nfor swap use the default (wd0b) Press enter\n</code></pre>\n<h2>Initial settings on first boot (optional)</h2>\n<p>Automatic network configuration using DHCP</p>\n<pre><code>echo "dhcp" &gt; /etc/hostname.ne0\n</code></pre>\n<p>To bring up the interface (will be automatic on the next boot):</p>\n<pre><code>sh /etc/netstart\n</code></pre>\n<p>Add a mirror to /etc/installurl for package installation. Make sure to lookup\nthe most efficient/nearby mirror site on the OpenBSD mirror page.</p>\n<pre><code>echo "https://ftp.hostserver.de/pub/OpenBSD" &gt; /etc/installurl\n</code></pre>	html	https://www.codemadness.org/openbsd-sparc64-vm.html	Hiltjo		
1506211200	Tscrape: a Twitter scraper	https://www.codemadness.org/tscrape.html	<h1>Tscrape: a Twitter scraper</h1>\n\t<p><strong>Last modification on </strong> <time>2020-07-20</time></p>\n\t<p>Tscrape is a Twitter web scraper and archiver.</p>\n<p>Twitter removed the functionality to follow users using a RSS feed without\nauthenticating or using their API. With this program you can format tweets in\nany way you like relatively anonymously.</p>\n<p>For more (up-to-date) information see the <a href="/git/tscrape/file/README.html">README</a> file.</p>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/tscrape\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/tscrape/">https://git.codemadness.org/tscrape/</a></li>\n<li><a href="gopher://codemadness.org/1/git/tscrape">gopher://codemadness.org/1/git/tscrape</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/tscrape/">https://codemadness.org/releases/tscrape/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/tscrape">gopher://codemadness.org/1/releases/tscrape</a></li>\n</ul>\n<h2>Examples</h2>\n<p>Output format examples:</p>\n<ul>\n<li><a href="tscrape/tscrape_html.html">tscrape_html: HTML</a></li>\n<li><a href="tscrape/tscrape_plain.txt">tscrape_plain: Text</a></li>\n</ul>	html	https://www.codemadness.org/tscrape.html	Hiltjo		
1506211200	jsdatatable: a small datatable Javascript	https://www.codemadness.org/datatable.html	<h1>jsdatatable: a small datatable Javascript</h1>\n\t<p><strong>Last modification on </strong> <time>2020-07-20</time></p>\n\t<p>This is a small datatable Javascript with no dependencies.</p>\n<h2>Features</h2>\n<ul>\n<li>Small:\n<ul>\n<li>Filesize: +- 9.1KB.</li>\n<li>Lines: +- 300, not much code, so hopefully easy to understand.</li>\n<li>No dependencies on other libraries like jQuery.</li>\n</ul>\n</li>\n<li>Sorting on columns, multi-column support with shift-click.</li>\n<li>Filtering values: case-insensitively, tokenized (separated by space).</li>\n<li>Able to add custom filtering, parsing and sorting functions.</li>\n<li>Helper function for delayed (150ms) filtering, so filtering feels more\nresponsive for big datasets.</li>\n<li>Permissive ISC license, see LICENSE file.</li>\n<li>"Lazy scroll" mode:\n<ul>\n<li>fixed column headers and renders only visible rows, this allows you to\n"lazily" render millions of rows.</li>\n</ul>\n</li>\n<li>Officially supported browsers are:\n<ul>\n<li>Firefox and Firefox ESR.</li>\n<li>Chrome and most recent webkit-based browsers.</li>\n<li>IE10+.</li>\n</ul>\n</li>\n</ul>\n<h2>Why? and a comparison</h2>\n<p>It was created because all the other datatable scripts suck balls.</p>\n<p>Most Javascripts nowadays have a default dependency on jQuery, Bootstrap or\nother frameworks.</p>\n<p>jQuery adds about 97KB and Bootstrap adds about 100KB to your scripts and CSS\nas a dependency.  This increases the CPU, memory and bandwidth consumption and\nlatency. It also adds complexity to your scripts.</p>\n<p>jQuery was mostly used for backwards-compatibility in the Internet Explorer\ndays, but is most often not needed anymore. It contains functionality to query\nthe DOM using CSS-like selectors, but this is now supported with for example\ndocument.querySelectorAll.  Functionality like a JSON parser is standard\navailable now: JSON.parse().</p>\n<h3>Size comparison</h3>\n<p>All sizes are not "minified" or gzipped.</p>\n<pre><code>Name                             |   Total |      JS |   CSS | Images | jQuery\n---------------------------------+---------+---------+-------+--------+-------\njsdatatable                      |  12.9KB |   9.1KB | 2.5KB |  1.3KB |      -\ndatatables.net (without plugins) | 563.4KB | 449.3KB |  16KB |  0.8KB | 97.3KB\njdatatable                       | 154.6KB |    53KB |   1KB |  3.3KB | 97.3KB\n</code></pre>\n<ul>\n<li><a href="https://datatables.net/">datatables.net</a> (without plugins).</li>\n<li><a href="https://plugins.jquery.com/jdatatable/">jdatatable</a></li>\n</ul>\n<p>Of course jsdatatable has less features (less is more!), but it does 90% of\nwhat's needed.  Because it is so small it is also much simpler to understand and\nextend with required features if needed.</p>\n<p>See also:\n<a href="https://idlewords.com/talks/website_obesity.htm">The website obesity crisis</a></p>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/jscancer\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/jscancer/">https://git.codemadness.org/jscancer/</a></li>\n<li><a href="gopher://codemadness.org/1/git/jscancer">gopher://codemadness.org/1/git/jscancer</a></li>\n</ul>\n<p>It is in the datatable directory.</p>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/jscancer/">https://codemadness.org/releases/jscancer/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/jscancer">gopher://codemadness.org/1/releases/jscancer</a></li>\n</ul>\n<h2>Usage</h2>\n<h3>Examples</h3>\n<p>See example.html for an example. A stylesheet file datatable.css is also\nincluded, it contains the icons as embedded images.</p>\n<p>A table should have the classname "datatable" set, it must contain a &lt;thead&gt;\nfor the column headers (&lt;td&gt; or &lt;th&gt;) and &lt;tbody&gt; element for the data. The\nminimal code needed for a working datatable:</p>\n<pre><code>&lt;html&gt;\n&lt;body&gt;\n&lt;input class="filter-text" /&gt;&lt;!-- optional --&gt;\n&lt;table class="datatable"&gt;\n\t&lt;thead&gt;&lt;!-- columns --&gt;\n\t\t&lt;tr&gt;&lt;td&gt;Click me&lt;/td&gt;&lt;/tr&gt;\n\t&lt;/thead&gt;\n\t&lt;tbody&gt;&lt;!-- data --&gt;\n\t\t&lt;tr&gt;&lt;td&gt;a&lt;/td&gt;&lt;/tr&gt;\n\t\t&lt;tr&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;\n\t&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;script type="text/javascript" src="datatable.js"&gt;&lt;/script&gt;\n&lt;script type="text/javascript"&gt;var datatables = datatable_autoload();&lt;/script&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n</code></pre>\n<h3>Column attributes</h3>\n<p>The following column attributes are supported:</p>\n<ul>\n<li>data-filterable: if "1" or "true" specifies if the column can be filtered,\ndefault: "true".</li>\n<li>data-parse: specifies how to parse the values, default: "string", which is\ndatatable_parse_string(). See PARSING section below.</li>\n<li>data-sort: specifies how to sort the values: default: "default", which is\ndatatable_sort_default(). See SORTING section below.</li>\n<li>data-sortable: if "1" or "true" specifies if the column can be sorted,\ndefault: "true".</li>\n</ul>\n<h3>Parsing</h3>\n<p>By default only parsing for the types: date, float, int and string are\nsupported, but other types can be easily added as a function with the name:\ndatatable_parse_&lt;typename&gt;(). The parse functions parse the data-value\nattribute when set or else the cell content (in order). Because of this\nbehaviour you can set the actual values as the data-value attribute and use the\ncell content for display. This is useful to display and properly sort\nlocale-aware currency, datetimes etc.</p>\n<h3>Filtering</h3>\n<p>Filtering will be done case-insensitively on the cell content and when set also\non the data-value attribute. The filter string is split up as tokens separated\nby space. Each token must match at least once per row to display it.</p>\n<h3>Sorting</h3>\n<p>Sorting is done on the parsed values by default with the function:\ndatatable_sort_default(). To change this you can set a customname string on\nthe data-sort attribute on the column which translates to the function:\ndatatable_sort_&lt;customname&gt;().</p>\n<p>In some applications locale values are used, like for currency, decimal numbers\ndatetimes. Some people also like to use icons or extended HTML elements inside\nthe cell. Because jsdatatable sorts on the parsed value (see section PARSING)\nit is possible to sort on the data-value attribute values and use the cell\ncontent for display.</p>\n<p>For example:</p>\n<ul>\n<li>currency, decimal numbers: use data-value attribute with floating-point\nnumber, set data-parse column to "float".</li>\n<li>date/datetimes: use data-value attribute with UNIX timestamps (type int), set\ndata-parse on column to "int" or set the data-parse attribute on column to\n"date" which is datatable_parse_date(), then make sure to use Zulu times, like:\n"2016-01-01T01:02:03Z" or other time strings that are parsable as the\ndata-value attribute.</li>\n<li>icons: generally use data-value attribute with integer as weight value to\nsort on, set data-parse column to "int".</li>\n</ul>\n<h3>Dynamically update data</h3>\n<p>To update data dynamically see example-ajax.html for an example how to do this.</p>\n<h3>Caveats</h3>\n<ul>\n<li>A date, integer, float or other values must be able to parse properly, when\nthe parse function returns NaN, null or undefined etc. the sorting behaviour is\nalso undefined. It is recommended to always set a zero value for each type.</li>\n<li>&lt;tfoot&gt; is not supported in datatables in "lazy" mode.</li>\n</ul>\n<h2>Demo / example</h2>\n<p><strong>For the below example to work you need to have Javascript enabled.</strong></p>\n<p><a href="datatable-example.html">datatable-example.html</a></p>	html	https://www.codemadness.org/datatable.html	Hiltjo		
1501804800	Stagit-gopher: a static git page generator for gopher	https://www.codemadness.org/stagit-gopher.html	<h1>Stagit-gopher: a static git page generator for gopher</h1>\n\t<p><strong>Last modification on </strong> <time>2021-04-11</time></p>\n\t<p>stagit-gopher is a static page generator for Gopher.  It creates the pages as\nstatic <a href="http://git.r-36.net/geomyidae/">geomyidae</a> .gph files.  stagit-gopher is a modified version from the\nHTML version of stagit.</p>\n<p><a href="/git/stagit-gopher/file/README.html">Read the README for more information about it.</a></p>\n<p>I also run a gopherhole and stagit-gopher, you can see how it looks here:\n<a href="gopher://codemadness.org/1/git/">gopher://codemadness.org/1/git/</a></p>\n<p><a href="https://git.fifth.space/sacc/log.html">sacc</a> is a good Gopher client to view it.</p>\n<h2>Features</h2>\n<ul>\n<li>Log of all commits from HEAD.</li>\n<li>Log and diffstat per commit.</li>\n<li>Show file tree with line numbers.</li>\n<li>Show references: local branches and tags.</li>\n<li>Detect README and LICENSE file from HEAD and link it as a webpage.</li>\n<li>Detect submodules (.gitmodules file) from HEAD and link it as a webpage.</li>\n<li>Atom feed of the commit log (atom.xml).</li>\n<li>Atom feed of the tags/refs (tags.xml).</li>\n<li>Make index page for multiple repositories with stagit-gopher-index.</li>\n<li>After generating the pages (relatively slow) serving the files is very fast,\nsimple and requires little resources (because the content is static), a\ngeomyidae Gopher server is required.</li>\n<li>Security: all pages are static. No CGI or dynamic code is run for the\ninterface.  Using it with a secure Gopher server such as geomyidae it is\nprivilege-dropped and chroot(2)'d.</li>\n<li>Simple to setup: the content generation is clearly separated from serving it.\nThis makes configuration as simple as copying a few directories and scripts.</li>\n<li>Usable with Gopher clients such as lynx and <a href="https://git.fifth.space/sacc/log.html">sacc</a>.</li>\n</ul>\n<h2>Cons</h2>\n<ul>\n<li>Not suitable for large repositories (2000+ commits), because diffstats are\nan expensive operation, the cache (-c flag) is a workaround for this in\nsome cases.</li>\n<li>Not suitable for large repositories with many files, because all files are\nwritten for each execution of stagit. This is because stagit shows the lines\nof textfiles and there is no "cache" for file metadata (this would add more\ncomplexity to the code).</li>\n<li>Not suitable for repositories with many branches, a quite linear history is\nassumed (from HEAD).</li>\n<li>Relatively slow to run the first time (about 3 seconds for sbase,\n1500+ commits), incremental updates are faster.</li>\n<li>Does not support some of the dynamic features cgit has (for HTTP), like:\n<ul>\n<li>Snapshot tarballs per commit.</li>\n<li>File tree per commit.</li>\n<li>History log of branches diverged from HEAD.</li>\n<li>Stats (git shortlog -s).</li>\n</ul>\n</li>\n</ul>\n<p>This is by design, just use git locally.</p>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/stagit-gopher\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/stagit-gopher/">https://git.codemadness.org/stagit-gopher/</a></li>\n<li><a href="gopher://codemadness.org/1/git/stagit-gopher">gopher://codemadness.org/1/git/stagit-gopher</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/stagit-gopher/">https://codemadness.org/releases/stagit-gopher/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/stagit-gopher">gopher://codemadness.org/1/releases/stagit-gopher</a></li>\n</ul>	html	https://www.codemadness.org/stagit-gopher.html	Hiltjo		
1497052800	Saait: a boring HTML page generator	https://www.codemadness.org/saait.html	<h1>Saait: a boring HTML page generator</h1>\n\t<p><strong>Last modification on </strong> <time>2020-07-20</time></p>\n\t<p>Saait is the most boring static HTML page generator.</p>\n<p>Meaning of saai (dutch): boring. Pronunciation: site</p>\n<p><a href="/git/saait/file/README.html">Read the README for more information about it.</a></p>\n<p>I used to use <a href="/git/static-site-scripts/files.html">shellscripts</a> to generate the static pages, but realised I\nwanted a small program that works on each platform consistently.  There are\nmany incompatibilities or unimplemented features in base tools across different\nplatforms: Linux, UNIX, Windows.</p>\n<p>This site is created using saait.</p>\n<h2>Features</h2>\n<ul>\n<li>Single small binary that handles all the things. At run-time no dependency on\nother tools.</li>\n<li>Few lines of code (about 575 lines of C) and no dependencies except: a C\ncompiler and libc.</li>\n<li>Works on most platforms: tested on Linux, *BSD, Windows.</li>\n<li>Simple template syntax.</li>\n<li>Uses HTML output by default, but can easily be modified to generate any\ntextual content, like gopher pages, wiki pages or other kinds of documents.</li>\n<li>Out-of-the-box supports: creating an index page of all pages, Atom feed,\ntwtxt.txt feed, sitemap.xml and urllist.txt.</li>\n</ul>\n<h2>Cons</h2>\n<ul>\n<li>Simple template syntax, but very basic. Requires C knowledge to extend it if\nneeded.</li>\n<li>Only basic (no nested) template blocks supported.</li>\n</ul>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/saait\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/saait/">https://git.codemadness.org/saait/</a></li>\n<li><a href="gopher://codemadness.org/1/git/saait">gopher://codemadness.org/1/git/saait</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/saait/">https://codemadness.org/releases/saait/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/saait">gopher://codemadness.org/1/releases/saait</a></li>\n</ul>\n<h2>Documentation / man page</h2>\n<p>Below is the saait(1) man page, which includes usage examples.</p>\n<pre><code>\nSAAIT(1)                    General Commands Manual                      SAAIT(1)\n\nNAME\n     saait  the most boring static page generator\n\nSYNOPSIS\n     saait [-c configfile] [-o outputdir] [-t templatesdir] pages...\n\nDESCRIPTION\n     saait writes HTML pages to the output directory.\n\n     The arguments pages are page config files, which are processed in the\n     given order.\n\n     The options are as follows:\n\n     -c configfile\n             The global configuration file, the default is "config.cfg". Each\n             page configuration file inherits variables from this file. These\n             variables can be overwritten per page.\n\n     -o outputdir\n             The output directory, the default is "output".\n\n     -t templatesdir\n             The templates directory, the default is "templates".\n\nDIRECTORY AND FILE STRUCTURE\n     A recommended directory structure for pages, although the names can be\n     anything:\n     pages/001-page.cfg\n     pages/001-page.html\n     pages/002-page.cfg\n     pages/002-page.html\n\n     The directory and file structure for templates must be:\n     templates/&lt;templatename&gt;/header.ext\n     templates/&lt;templatename&gt;/item.ext\n     templates/&lt;templatename&gt;/footer.ext\n\n     The following filename prefixes are detected for template blocks and\n     processed in this order:\n\n     "header."\n             Header block.\n\n     "item."\n             Item block.\n\n     "footer."\n             Footer block.\n\n     The files are saved as output/&lt;templatename&gt;, for example\n     templates/atom.xml/* will become: output/atom.xml. If a template block\n     file does not exist then it is treated as if it was empty.\n\n     Template directories starting with a dot (".") are ignored.\n\n     The "page" templatename is special and will be used per page.\n\nCONFIG FILE\n     A config file has a simple key=value configuration syntax, for example:\n\n     # this is a comment line.\n     filename = example.html\n     title = Example page\n     description = This is an example page\n     created = 2009-04-12\n     updated = 2009-04-14\n\n     The following variable names are special with their respective defaults:\n\n     contentfile\n             Path to the input content filename, by default this is the path\n             of the config file with the last extension replaced to ".html".\n\n     filename\n             The filename or relative file path for the output file for this\n             page.  By default the value is the basename of the contentfile.\n             The path of the written output file is the value of filename\n             appended to the outputdir path.\n\n     A line starting with # is a comment and is ignored.\n\n     TABs and spaces before and after a variable name are ignored.  TABs and\n     spaces before a value are ignored.\n\nTEMPLATES\n     A template (block) is text.  Variables are replaced with the values set\n     in the config files.\n\n     The possible operators for variables are:\n\n     $             Escapes a XML string, for example: &lt; to the entity &amp;lt;.\n\n     #             Literal raw string value.\n\n     %             Insert contents of file of the value of the variable.\n\n     For example in a HTML item template:\n\n     &lt;article&gt;\n             &lt;header&gt;\n                     &lt;h1&gt;&lt;a href=""&gt;${title}&lt;/a&gt;&lt;/h1&gt;\n                     &lt;p&gt;\n                             &lt;strong&gt;Last modification on &lt;/strong&gt;\n                             &lt;time datetime="${updated}"&gt;${updated}&lt;/time&gt;\n                     &lt;/p&gt;\n             &lt;/header&gt;\n             %{contentfile}\n     &lt;/article&gt;\n\nEXIT STATUS\n     The saait utility exits 0 on success, and &gt;0 if an error occurs.\n\nEXAMPLES\n     A basic usage example:\n\n     1.   Create a directory for a new site:\n\n          mkdir newsite\n\n     2.   Copy the example pages, templates, global config file and example\n          stylesheets to a directory:\n\n          cp -r pages templates config.cfg style.css print.css newsite/\n\n     3.   Change the current directory to the created directory.\n\n          cd newsite/\n\n     4.   Change the values in the global config.cfg file.\n\n     5.   If you want to modify parts of the header, like the navigation menu\n          items, you can change the following two template files:\n          templates/page/header.html\n          templates/index.html/header.html\n\n     6.   Create any new pages in the pages directory. For each config file\n          there has to be a corresponding HTML file.  By default this HTML\n          file has the path of the config file, but with the last extension\n          (".cfg" in this case) replaced to ".html".\n\n     7.   Create an output directory:\n\n          mkdir -p output\n\n     8.   After any modifications the following commands can be used to\n          generate the output and process the pages in descending order:\n\n          find pages -type f -name '*.cfg' -print0 | sort -zr | xargs -0 saait\n\n     9.   Copy the modified stylesheets to the output directory also:\n\n          cp style.css print.css output/\n\n     10.  Open output/index.html locally in your webbrowser to review the\n          changes.\n\n     11.  To synchronize files, you can securely transfer them via SSH using\n          rsync:\n\n          rsync -av output/ user@somehost:/var/www/htdocs/\n\nTRIVIA\n     The most boring static page generator.\n\n     Meaning of saai (dutch): boring, pronunciation of saait: site\n\nSEE ALSO\n     find(1), sort(1), xargs(1)\n\nAUTHORS\n     Hiltjo Posthuma &lt;hiltjo@codemadness.org&gt;\n</code></pre>	html	https://www.codemadness.org/saait.html	Hiltjo		
1494374400	Stagit: a static git page generator	https://www.codemadness.org/stagit.html	<h1>Stagit: a static git page generator</h1>\n\t<p><strong>Last modification on </strong> <time>2021-04-11</time></p>\n\t<p>stagit is a static page generator for git.</p>\n<p><a href="/git/stagit/file/README.html">Read the README for more information about it.</a></p>\n<p>My git repository uses stagit, you can see how it looks here:\n<a href="https://codemadness.org/git/">https://codemadness.org/git/</a></p>\n<h2>Features</h2>\n<ul>\n<li>Log of all commits from HEAD.</li>\n<li>Log and diffstat per commit.</li>\n<li>Show file tree with linkable line numbers.</li>\n<li>Show references: local branches and tags.</li>\n<li>Detect README and LICENSE file from HEAD and link it as a webpage.</li>\n<li>Detect submodules (.gitmodules file) from HEAD and link it as a webpage.</li>\n<li>Atom feed of the commit log (atom.xml).</li>\n<li>Atom feed of the tags/refs (tags.xml).</li>\n<li>Make index page for multiple repositories with stagit-index.</li>\n<li>After generating the pages (relatively slow) serving the files is very fast,\nsimple and requires little resources (because the content is static), only\na HTTP file server is required.</li>\n<li>Security: all pages are static. No CGI or dynamic code is run for the\ninterface. Using it with a secure httpd such as OpenBSD httpd it is\nprivilege-separated, chroot(2)'d and pledge(2)'d.</li>\n<li>Simple to setup: the content generation is clearly separated from serving\nit. This makes configuration as simple as copying a few directories and\nscripts.</li>\n<li>Usable with text-browsers such as dillo, links, lynx and w3m.</li>\n</ul>\n<h2>Cons</h2>\n<ul>\n<li>Not suitable for large repositories (2000+ commits), because diffstats are\nan expensive operation, the cache (-c flag) or (-l maxlimit) is a workaround\nfor this in some cases.</li>\n<li>Not suitable for large repositories with many files, because all files are\nwritten for each execution of stagit. This is because stagit shows the lines\nof textfiles and there is no "cache" for file metadata (this would add more\ncomplexity to the code).</li>\n<li>Not suitable for repositories with many branches, a quite linear history is\nassumed (from HEAD).</li>\n</ul>\n<p>In these cases it is better to use <a href="https://git.zx2c4.com/cgit/">cgit</a> or\npossibly change stagit to run as a CGI program.</p>\n<ul>\n<li>Relatively slow to run the first time (about 3 seconds for sbase,\n1500+ commits), incremental updates are faster.</li>\n<li>Does not support some of the dynamic features cgit has, like:\n<ul>\n<li>Snapshot tarballs per commit.</li>\n<li>File tree per commit.</li>\n<li>History log of branches diverged from HEAD.</li>\n<li>Stats (git shortlog -s).</li>\n</ul>\n</li>\n</ul>\n<p>This is by design, just use git locally.</p>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/stagit\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/stagit/">https://git.codemadness.org/stagit/</a></li>\n<li><a href="gopher://codemadness.org/1/git/stagit">gopher://codemadness.org/1/git/stagit</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/stagit/">https://codemadness.org/releases/stagit/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/stagit">gopher://codemadness.org/1/releases/stagit</a></li>\n</ul>	html	https://www.codemadness.org/stagit.html	Hiltjo		
1436054400	OpenBSD httpd, slowcgi and cgit	https://www.codemadness.org/openbsd-httpd-and-cgit.html	<h1>OpenBSD httpd, slowcgi and cgit</h1>\n\t<p><strong>Last modification on </strong> <time>2021-04-11</time></p>\n\t<p>This is a guide to get <a href="https://git.zx2c4.com/cgit/">cgit</a> working with\n<a href="https://man.openbsd.org/httpd.8">OpenBSD httpd(8)</a> and\n<a href="https://man.openbsd.org/slowcgi.8">slowcgi(8)</a> in base.  OpenBSD httpd is very simple to setup, but nevertheless\nthis guide might help someone out there.</p>\n<h2>Installation</h2>\n<p>Install the cgit package:</p>\n<pre><code># pkg_add cgit\n</code></pre>\n<p>or build it from ports:</p>\n<pre><code># cd /usr/ports/www/cgit &amp;&amp; make &amp;&amp; make install\n</code></pre>\n<h2>Configuration</h2>\n<h3>httpd</h3>\n<p>An example of <a href="https://man.openbsd.org/httpd.conf.5">httpd.conf(5)</a>:\n<a href="downloads/openbsd-httpd/httpd.conf">httpd.conf</a>.</p>\n<h3>slowcgi</h3>\n<p>By default the slowcgi UNIX domain socket is located at:\n/var/www/run/slowcgi.sock.  For this example we use the defaults.</p>\n<h3>cgit</h3>\n<p>The cgit binary should be located at: /var/www/cgi-bin/cgit.cgi (default).</p>\n<p>cgit uses the $CGIT_CONFIG environment variable to locate its config.  By\ndefault on OpenBSD this is set to /conf/cgitrc (chroot), which is\n/var/www/conf/cgitrc.  An example of the cgitrc file is here: <a href="downloads/openbsd-httpd/cgitrc">cgitrc</a>.</p>\n<p>In this example the cgit cache directory is set to /cgit/cache (chroot), which\nis /var/www/cgit/cache.  Make sure to give this path read and write permissions\nfor cgit (www:daemon).</p>\n<p>In the example the repository path (scan-path) is set to /htdocs/src (chroot),\nwhich is /var/www/htdocs/src.</p>\n<p>The footer file is set to /conf/cgit.footer. Make sure this file exists or you\nwill get warnings:</p>\n<pre><code># &gt;/var/www/conf/cgit.footer\n</code></pre>\n<p>Make sure cgit.css (stylesheet) and cgit.png (logo) are accessible, by default:\n/var/www/cgit/cgit.{css,png} (location can be changed in httpd.conf).</p>\n<p>To support .tar.gz snapshots a static gzip binary is required in the chroot\n/bin directory:</p>\n<pre><code>cd /usr/src/usr.bin/compress\nmake clean &amp;&amp; make LDFLAGS="-static -pie"\ncp obj/compress /var/www/bin/gzip\n</code></pre>\n<h2>Running the services</h2>\n<p>Enable the httpd and slowcgi services to automatically start them at boot:</p>\n<pre><code># rcctl enable httpd slowcgi\n</code></pre>\n<p>Start the services:</p>\n<pre><code># rcctl start httpd slowcgi\n</code></pre>	html	https://www.codemadness.org/openbsd-httpd-and-cgit.html	Hiltjo		
1416700800	twitch: application to watch Twitch streams	https://www.codemadness.org/twitch-interface.html	<h1>twitch: application to watch Twitch streams</h1>\n\t<p><strong>Last modification on </strong> <time>2020-12-14</time></p>\n\t<p><strong>Update: as of 2020-05-06:</strong> I stopped maintaining it.\nTwitch now requires OAUTH and 2-factor authentication. It requires me to expose\npersonal information such as my phone number.</p>\n<p><strong>Update: as of ~2020-01-03:</strong> I rewrote this application from Golang to C.\nThe Twitch Kraken API used by the Golang version was deprecated.  It was\nrewritten to use the Helix API.</p>\n<p>This program/script allows to view streams in your own video player like so the\nbloated Twitch interface is not needed.  It is written in C.</p>\n<h2>Features</h2>\n<ul>\n<li>No Javascript, cookies, CSS optional.</li>\n<li>Works well in all browsers, including text-based ones.</li>\n<li>Has a HTTP CGI and Gopher CGI version.</li>\n<li>Atom feed for VODs.</li>\n</ul>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/frontends\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/frontends/">https://git.codemadness.org/frontends/</a></li>\n<li><a href="gopher://codemadness.org/1/git/frontends">gopher://codemadness.org/1/git/frontends</a></li>\n</ul>	html	https://www.codemadness.org/twitch-interface.html	Hiltjo		
1393718400	Userscript: focus input field	https://www.codemadness.org/userscript-focus-input-field.html	<h1>Userscript: focus input field</h1>\n\t<p><strong>Last modification on </strong> <time>2014-03-02</time></p>\n\t<p>This is an userscript I wrote a while ago which allows to focus the first input\nfield on a page with ctrl+space.  This is useful if a site doesn't specify the\nautofocus attribute for an input field and you don't want to switch to it using\nthe mouse.</p>\n<h2>Download</h2>\n<p><a href="downloads/input_focus.user.js">Download userscript input_focus.user.js</a></p>	html	https://www.codemadness.org/userscript-focus-input-field.html	Hiltjo		
1361404800	Userscript: Youtube circumvent age verification	https://www.codemadness.org/userscript-youtube-circumvent-age-verification.html	<h1>Userscript: Youtube circumvent age verification</h1>\n\t<p><strong>Last modification on </strong> <time>2020-12-27</time></p>\n\t<p>This is an userscript I wrote a while ago which circumvents requiring to login\nwith an account on Youtube if a video requires age verification.</p>\n<p><strong>Note: this is an old script and does not work anymore.</strong></p>\n<h2>Download</h2>\n<p><a href="downloads/youtube_circumvent_sign_in.user.js">Download userscript Youtube_circumvent_sign_in.user.js</a></p>	html	https://www.codemadness.org/userscript-youtube-circumvent-age-verification.html	Hiltjo		
1350777600	Userscript: block stupid fonts	https://www.codemadness.org/userscript-block-stupid-fonts.html	<h1>Userscript: block stupid fonts</h1>\n\t<p><strong>Last modification on </strong> <time>2020-03-10</time></p>\n\t<p>This is an userscript I wrote a while ago which white-lists fonts I like and\nblocks the rest.  The reason I made this is because I don't like the\ninconsistency of custom fonts used on a lot of websites.</p>\n<h2>Download</h2>\n<p><a href="downloads/block_stupid_fonts_v1.2.user.js">Download userscript Block_stupid_fonts_v1.2.user.js</a></p>\n<p>Old version: <a href="downloads/block_stupid_fonts.user.js">Download userscript Block_stupid_fonts.user.js</a></p>	html	https://www.codemadness.org/userscript-block-stupid-fonts.html	Hiltjo		
1301616000	Sfeed: simple RSS and Atom parser	https://www.codemadness.org/sfeed-simple-feed-parser.html	<h1>Sfeed: simple RSS and Atom parser</h1>\n\t<p><strong>Last modification on </strong> <time>2022-11-05</time></p>\n\t<p>Sfeed is a RSS and Atom parser (and some format programs).</p>\n<p>It converts RSS or Atom feeds from XML to a TAB-separated file. There are\nformatting programs included to convert this TAB-separated format to various\nother formats. There are also some programs and scripts included to import and\nexport OPML and to fetch, filter, merge and order feed items.</p>\n<p>For the most (up-to-date) information see the <a href="/git/sfeed/file/README.html">README</a>.</p>\n<h2>Clone</h2>\n<pre><code>git clone git://git.codemadness.org/sfeed\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/sfeed/">https://git.codemadness.org/sfeed/</a></li>\n<li><a href="gopher://codemadness.org/1/git/sfeed">gopher://codemadness.org/1/git/sfeed</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/sfeed/">https://codemadness.org/releases/sfeed/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/sfeed">gopher://codemadness.org/1/releases/sfeed</a></li>\n</ul>\n<h2>Build and install</h2>\n<pre><code>$ make\n# make install\n</code></pre>\n<h2>Screenshot and examples</h2>\n<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>\n<p>The above screenshot uses the sfeed_plain format program with <a href="https://tools.suckless.org/dmenu/">dmenu</a>.  This\nprogram outputs the feed items in a compact way per line as plain-text to\nstdout.  The dmenu program reads these lines from stdin and displays them as a\nX11 list menu. When an item is selected in dmenu it prints this item to stdout.\nA simple written script can then filter for the URL in this output and do some\naction, like opening it in some browser or open a podcast in your music player.</p>\n<p>For example:</p>\n<pre><code>#!/bin/sh\nurl=$(sfeed_plain "$HOME/.sfeed/feeds/"* | dmenu -l 35 -i | \\\n\tsed -n 's@^.* \\([a-zA-Z]*://\\)\\(.*\\)$@\\1\\2@p')\ntest -n "${url}" &amp;&amp; $BROWSER "${url}"\n</code></pre>\n<p>However this is just one way to format and interact with feed items.\nSee also the README for other practical examples.</p>\n<p>Below are some examples of output that are supported by the included format\nprograms:</p>\n<ul>\n<li><a href="downloads/sfeed/plain/feeds.txt">plain text (UTF-8)</a></li>\n<li><a href="downloads/sfeed/atom/feeds.xml">atom</a></li>\n<li>gopher</li>\n<li><a href="downloads/sfeed/html/feeds.html">HTML (CSS)</a></li>\n<li><a href="downloads/sfeed/frames/index.html">HTML frames</a></li>\n<li><a href="jsonfeed_content.json">JSON Feed</a></li>\n<li><a href="downloads/sfeed/mbox/feeds.mbox">mbox</a></li>\n<li><a href="downloads/sfeed/twtxt/twtxt.txt">twtxt</a></li>\n</ul>\n<p>There is also a curses UI front-end, see the page <a href="sfeed_curses.html">sfeed_curses</a>.\nIt is now part of sfeed.</p>\n<h2>Videos</h2>\n<p>Here are some videos of other people showcasing some of the functionalities of\nsfeed, sfeed_plain and sfeed_curses.  To the creators: thanks for making these!</p>\n<ul>\n<li><a href="https://www.youtube.com/watch?v=RnuY32DP9jU">sfeed: RSS/Atom Feeds without the Suck (Youtube)</a><br />  \nby <a href="https://www.youtube.com/channel/UCQQB104oMOos758GTOdx_kQ">noocsharp</a>\n<a href="downloads/sfeed/videos/sfeed_without_the_suck.mp4">(mirror)</a><br />  \nVideo published on March 8 2020.</li>\n<li><a href="https://www.youtube.com/watch?v=ok8k639GoRU">Sfeed - news in the terminal with minimalism (Youtube)</a><br />  \nby <a href="https://www.youtube.com/channel/UCJetJ7nDNLlEzDLXv7KIo0w">Gavin Freeborn</a>\n<a href="downloads/sfeed/videos/sfeed_news_in_terminal.mp4">(mirror)</a><br />  \nVideo published on January 15 2021.</li>\n<li><a href="https://www.youtube.com/watch?v=xMkW4iJzot0">Sfeed - Peak Minimal RSS Feed Reader (Youtube)</a><br />  \nby <a href="https://www.youtube.com/channel/UCld68syR8Wi-GY_n4CaoJGA">Brodie Robertson</a>\n<a href="downloads/sfeed/videos/sfeed_minimalism.mp4">(mirror)</a><br />  \nVideo published on February 23 2021.</li>\n<li><a href="https://www.youtube.com/watch?v=O8x0MAyqvt0">RSS with sfeed, fdm, and mblaze! (Youtube)</a><br />  \nby <a href="https://www.youtube.com/channel/UCz_u0h4usMbnFsIHSVdjUQw">Joseph Choe</a>\n<a href="downloads/sfeed/videos/rss_with_sfeed_fdm_and_mblaze.mp4">(mirror)</a><br />  \nWebsite: <a href="https://josephchoe.com/rss-terminal">https://josephchoe.com/rss-terminal</a><br />  \nVideo published on 4 November 2022.</li>\n</ul>	html	https://www.codemadness.org/sfeed-simple-feed-parser.html	Hiltjo		
1294358400	Vim theme: relaxed	https://www.codemadness.org/vim-theme-relaxed.html	<h1>Vim theme: relaxed</h1>\n\t<p><strong>Last modification on </strong> <time>2011-01-07</time></p>\n\t<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\nquite a while now and over time tweaked to my liking.  It is made for gvim, but\nalso works for 16-colour terminals (with small visual differences).  The\nrelaxed.vim file also has my .Xdefaults file colours listed at the top for\n16+-colour terminals on X11.</p>\n<p>It is inspired by the "desert" theme available at\n<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\ncursive and bold styles and changed some colours I didn't like.</p>\n<h2>Download</h2>\n<p><a href="downloads/themes/vim/relaxed.vim">relaxed.vim</a></p>\n<h2>Screenshot</h2>\n<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>	html	https://www.codemadness.org/vim-theme-relaxed.html	Hiltjo		
1288483200	Seturgent: set urgency hints for X applications	https://www.codemadness.org/seturgent-set-urgency-hints-for-x-applications.html	<h1>Seturgent: set urgency hints for X applications</h1>\n\t<p><strong>Last modification on </strong> <time>2020-07-20</time></p>\n\t<p>Seturgent is a small utility to set an application its urgency hint.  For most\nwindowmanager's and panel applications this will highlight the application and\nwill allow special actions.</p>\n<h2>Clone</h2>\n<pre><code>    git clone git://git.codemadness.org/seturgent\n</code></pre>\n<h2>Browse</h2>\n<p>You can browse the source-code at:</p>\n<ul>\n<li><a href="https://git.codemadness.org/seturgent/">https://git.codemadness.org/seturgent/</a></li>\n<li><a href="gopher://codemadness.org/1/git/seturgent">gopher://codemadness.org/1/git/seturgent</a></li>\n</ul>\n<h2>Download releases</h2>\n<p>Releases are available at:</p>\n<ul>\n<li><a href="https://codemadness.org/releases/seturgent/">https://codemadness.org/releases/seturgent/</a></li>\n<li><a href="gopher://codemadness.org/1/releases/seturgent">gopher://codemadness.org/1/releases/seturgent</a></li>\n</ul>	html	https://www.codemadness.org/seturgent-set-urgency-hints-for-x-applications.html	Hiltjo		
1281571200	DWM-hiltjo: my windowmanager configuration	https://www.codemadness.org/dwm-hiltjo-my-windowmanager-configuration.html	<h1>DWM-hiltjo: my windowmanager configuration</h1>\n\t<p><strong>Last modification on </strong> <time>2020-07-20</time></p>\n\t<p><a href="https://dwm.suckless.org/">DWM</a> is a very minimal windowmanager. It has the most essential features I\nneed, everything else is "do-it-yourself" or extending it with the many\navailable <a href="https://dwm.suckless.org/patches/">patches</a>. The vanilla version is less than 2000 SLOC. This makes it\neasy to understand and modify it.</p>\n<p>I really like my configuration at the moment and want to share my changes. Some\nof the features listed below are patches from suckless.org I applied, but there\nare also some changes I made.</p>\n<p>This configuration is entirely tailored for my preferences of course.</p>\n<h2>Features</h2>\n<ul>\n<li>Titlebar:\n<ul>\n<li>Shows all clients of the selected / active tags.</li>\n<li>Divide application titlebars evenly among available space.</li>\n<li>Colour urgent clients in the taskbar on active tags.</li>\n<li>Left-click focuses clicked client.</li>\n<li>Right-click toggles monocle layout.</li>\n<li>Middle-click kills the clicked client.</li>\n</ul>\n</li>\n<li>Tagbar:\n<ul>\n<li>Only show active tags.</li>\n<li>Colour inactive tags with urgent clients.</li>\n</ul>\n</li>\n<li>Layouts:\n<ul>\n<li>Cycle layouts with Modkey + Space (next) and Modkey + Control + Space\n(previous).</li>\n<li>Fullscreen layout (hides topbar and removes borders).</li>\n</ul>\n</li>\n<li>Other:\n<ul>\n<li>Move tiled clients around with the mouse (drag-move), awesomewm-like.</li>\n<li>Add some keybinds for multimedia keyboards (audio play / pause, mute, www,\nvolume buttons, etc).</li>\n</ul>\n</li>\n<li>... and more ;) ...</li>\n</ul>\n<h2>Clone</h2>\n<pre><code>git clone -b hiltjo git://git.codemadness.org/dwm\n</code></pre>\n<h2>Screenshot</h2>\n<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>	html	https://www.codemadness.org/dwm-hiltjo-my-windowmanager-configuration.html	Hiltjo		
1271808000	Query unused CSS rules on current document state	https://www.codemadness.org/query-unused-css-rules-on-current-document-state.html	<h1>Query unused CSS rules on current document state</h1>\n\t<p><strong>Last modification on </strong> <time>2010-04-21</time></p>\n\t<p>Today I was doing some web development and wanted to see all the rules in a\nstylesheet (CSS) that were not used for the current document. I wrote the\nfollowing Javascript code which you can paste in the Firebug console and run:</p>\n<pre><code>(function() {\n\tfor (var i=0;i&lt;document.styleSheets.length;i++) {\n\t\tvar rules = document.styleSheets[i].cssRules || [];\n\t\tvar sheethref = document.styleSheets[i].href || 'inline';\n\t\tfor (var r=0;r&lt;rules.length;r++)\n\t\t\tif (!document.querySelectorAll(rules[r].selectorText).length)\n\t\t\t\tconsole.log(sheethref + ': "' + rules[r].selectorText + '" not found.');\n\t}\n})();\n</code></pre>\n<p>This will output all the (currently) unused CSS rules per selector, the output can be for example:</p>\n<pre><code>http://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: "fieldset, a img" not found.\nhttp://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: "#headerimg" not found.\nhttp://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: "a:hover" not found.\nhttp://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: "h2 a:hover, h3 a:hover" not found.\nhttp://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: ".postmetadata-center" not found.\nhttp://www.codemadness.nl/blog/wp-content/themes/codemadness/style.css: ".thread-alt" not found.\n</code></pre>\n<p>Just a trick I wanted to share, I hope someone finds this useful :)</p>\n<p>For webkit-based browsers you can use "Developer Tools" and use "Audits" under\n"Web Page Performance" it says "Remove unused CSS rules". For Firefox there is\nalso Google Page Speed: <a href="https://code.google.com/speed/page-speed/">https://code.google.com/speed/page-speed/</a> this adds\nan extra section under Firebug.</p>\n<p>Tested on Chrome and Firefox.</p>	html	https://www.codemadness.org/query-unused-css-rules-on-current-document-state.html	Hiltjo		
1246752000	Driconf: enabling S3 texture compression on Linux	https://www.codemadness.org/driconf-enabling-s3-texture-compression-on-linux.html	<h1>Driconf: enabling S3 texture compression on Linux</h1>\n\t<p><strong>Last modification on </strong> <time>2020-08-21</time></p>\n\t<p><strong>Update: the DXTC patent expired on 2018-03-16, many distros enable this by\ndefault now.</strong></p>\n<p>S3TC (also known as DXTn or DXTC) is a patented lossy texture compression\nalgorithm.  See: <a href="https://en.wikipedia.org/wiki/S3TC">https://en.wikipedia.org/wiki/S3TC</a> for more detailed\ninformation.  Many games use S3TC and if you use Wine to play games you\ndefinitely want to enable it if your graphics card supports it.</p>\n<p>Because this algorithm was <a href="https://dri.freedesktop.org/wiki/S3TC/">patented it is disabled by default on many Linux\ndistributions</a>.</p>\n<p>To enable it you can install the library "libtxc" if your favorite OS has not\ninstalled it already.</p>\n<p>For easy configuration you can install the optional utility DRIconf, which you\ncan find at: <a href="https://dri.freedesktop.org/wiki/DriConf">https://dri.freedesktop.org/wiki/DriConf</a>.  DriConf can safely be\nremoved after configuration.</p>\n<h2>Steps to enable it</h2>\n<p>Install libtxc_dxtn:</p>\n<p>ArchLinux:\n<pre><code># pacman -S libtxc_dxtn\n</code></pre>\n<p>Debian:\n<pre><code># aptitude install libtxc-dxtn-s2tc0\n</code></pre>\n</p>\n</p>\n<p>Install driconf (optional):</p>\n<p>ArchLinux:</p>\n<pre><code># pacman -S driconf\n</code></pre>\n<p>Debian:</p>\n<pre><code># aptitude install driconf\n</code></pre>\n<p>Run driconf and enable S3TC:</p>\n<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>\n<h2>Additional links</h2>\n<ul>\n<li>S3TC: <a href="https://dri.freedesktop.org/wiki/S3TC/">https://dri.freedesktop.org/wiki/S3TC/</a></li>\n<li>DriConf: <a href="https://dri.freedesktop.org/wiki/DriConf">https://dri.freedesktop.org/wiki/DriConf</a></li>\n</ul>	html	https://www.codemadness.org/driconf-enabling-s3-texture-compression-on-linux.html	Hiltjo		
1239580800	Getting the USB-powerline bridge to work on Linux	https://www.codemadness.org/getting-the-usb-powerline-bridge-to-work-on-linux.html	<h1>Getting the USB-powerline bridge to work on Linux</h1>\n\t<p><strong>Last modification on </strong> <time>2019-12-06</time></p>\n\t<p><strong>NOTE: this guide is obsolete, a working driver is now included in the Linux\nkernel tree (<a href="https://lkml.org/lkml/2009/4/18/121">since Linux 2.6.31</a>)</strong></p>\n<h2>Introduction</h2>\n<p>A USB to powerline bridge is a network device that instead of using an ordinary\nEthernet cable (CAT5 for example) or wireless LAN it uses the powerlines as a\nnetwork to communicate with similar devices.  A more comprehensive explanation\nof what it is and how it works you can find here:\n<a href="https://en.wikipedia.org/wiki/IEEE_1901">https://en.wikipedia.org/wiki/IEEE_1901</a>.</p>\n<p>Known products that use the Intellon 51x1 chipset:</p>\n<ul>\n<li>MicroLink dLAN USB</li>\n<li>"Digitus network"</li>\n<li>Intellon USB Ethernet powerline adapter</li>\n<li>Lots of other USB-powerline adapters...</li>\n</ul>\n<p>To check if your device is supported:</p>\n<pre><code>$ lsusb | grep -i 09e1\nBus 001 Device 003: ID 09e1:5121 Intellon Corp.\n</code></pre>\n<p>If the vendor (09e1) and product (5121) ID match then it's probably supported.</p>\n<h2>Installation</h2>\n<p>Get drivers from the official site:\n<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\n<a href="downloads/int51x1/dLAN-linux-package-v4.tar.gz">mirrored here</a>.\nThe drivers from the official site were/are more up-to-date.</p>\n<p>Extract them:</p>\n<pre><code>$ tar -xzvf dLAN-linux-package-v4.tar.gz\n</code></pre>\n<p>Go to the extracted directory and compile them:</p>\n<pre><code>$ ./configure\n$ make\n</code></pre>\n<p>Depending on the errors you got you might need to <a href="downloads/int51x1/int51x1.patch">download</a> and apply\nmy patch:</p>\n<pre><code>$ cd dLAN-linux-package-v4/     (or other path to the source code)\n$ patch &lt; int51x1.patch\n</code></pre>\n<p>Try again:</p>\n<pre><code>$ ./configure\n$ make\n</code></pre>\n<p>If that failed try:</p>\n<pre><code>$ ./configure\n$ KBUILD_NOPEDANTIC=1 make\n</code></pre>\n<p>If that went OK install the drivers (as root):</p>\n<pre><code># make install\n</code></pre>\n<p>Check if the "devolo_usb" module is loaded:</p>\n<pre><code>$ lsmod | grep -i devolo_usb\n</code></pre>\n<p>If it shows up then it's loaded. Now check if the interface is added:</p>\n<pre><code>$ ifconfig -a | grep -i dlanusb\ndlanusb0 Link encap:Ethernet HWaddr 00:12:34:56:78:9A\n</code></pre>\n<h2>Configuration</h2>\n<p>It is assumed you use a static IP, otherwise you can just use your DHCP client\nto get an unused IP address from your DHCP server. Setting up the interface is\ndone like this (change the IP address and netmask accordingly if it's\ndifferent):</p>\n<pre><code># ifconfig dlanusb0 192.168.2.12 netmask 255.255.255.0\n</code></pre>\n<h2>Checking if the network works</h2>\n<p>Try to ping an IP address on your network to test for a working connection:</p>\n<pre><code>$ ping 192.168.2.1\nPING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.\n64 bytes from 192.168.2.1: icmp_seq=1 ttl=30 time=2.49 ms\n64 bytes from 192.168.2.1: icmp_seq=2 ttl=30 time=3.37 ms\n64 bytes from 192.168.2.1: icmp_seq=3 ttl=30 time=2.80 ms\n--- 192.168.2.1 ping statistics ---\n3 packets transmitted, 3 received, 0% packet loss, time 2005ms\nrtt min/avg/max/mdev = 2.497/2.891/3.374/0.368 ms\n</code></pre>\n<p>You can now set up a network connection like you normally do with any Ethernet\ndevice.  The route can be added like this for example:</p>\n<pre><code># route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.2.1 dlanusb0\n</code></pre>\n<p>Change the IP address of your local gateway accordingly. Also make sure your\nnameserver is set in /etc/resolv.conf, something like:</p>\n<pre><code>nameserver 192.168.2.1\n</code></pre>\n<p>Test your internet connection by doing for example:</p>\n<pre><code>$ ping codemadness.org\nPING codemadness.org (64.13.232.151) 56(84) bytes of data.\n64 bytes from acmkoieeei.gs02.gridserver.com (64.13.232.151): icmp_seq=1 ttl=52 time=156 ms\n64 bytes from acmkoieeei.gs02.gridserver.com (64.13.232.151): icmp_seq=2 ttl=52 time=156 ms\n64 bytes from acmkoieeei.gs02.gridserver.com (64.13.232.151): icmp_seq=3 ttl=52 time=155 ms\n--- codemadness.org ping statistics ---\n3 packets transmitted, 3 received, 0% packet loss, time 1999ms\nrtt min/avg/max/mdev = 155.986/156.312/156.731/0.552 ms\n</code></pre>\n<p>If this command failed you probably have not setup your DNS/gateway properly.\nIf it worked then good for you :)</p>\n<h2>References</h2>\n<ul>\n<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>\n<li><a href="downloads/int51x1/dLAN-linux-package-v4.tar.gz">dLAN-linux-package-v4.tar.gz</a></li>\n<li><a href="downloads/int51x1/int51x1.patch">Patch for recent 2.6.x kernels</a></li>\n<li><a href="downloads/int51x1/INT51X1_datasheet.pdf">INT51X1 datasheet</a></li>\n</ul>	html	https://www.codemadness.org/getting-the-usb-powerline-bridge-to-work-on-linux.html	Hiltjo		
1239494400	Gothic 1 game guide	https://www.codemadness.org/gothic-1-guide.html	<h1>Gothic 1 game guide</h1>\n\t<p><strong>Last modification on </strong> <time>2022-08-07</time></p>\n\t<p><strong>Disclaimer:</strong>\nSome (including myself) may find some of these hints/exploits cheating. This\nguide is just for educational and fun purposes. Some of these hints/tips apply\nto Gothic 2 as well. I got the meat exploit from a guide somewhere on the\ninternet I can't recall where, anyway kudos to that person. Some of the\nexploits I discovered myself.</p>\n<h2>Configuration</h2>\n<h3>Widescreen resolution</h3>\n<p>Gothic supports widescreen resolutions with a small tweak, add the following\ntext string as a command-line argument:</p>\n<pre><code>-zRes:1920,1200,32\n</code></pre>\n<p>This also works for Gothic 2. Here 1920 is the width, 1200 the height and 32\nthe bits per pixel, change this to your preferred resolution.</p>\n<h3>Fix crash with Steam version</h3>\n<p>Disable steam overlay. If that doesn't work rename GameOverlayRenderer.dll in\nyour steam folder to _GameOverlayRenderer.dll.  I strongly recommend to buy the\nbetter version from <a href="https://www.gog.com/game/gothic">GOG.com</a>.  The GOG version has no DRM and allows easier\nmodding, it also allows playing in most published languages: German, English,\nPolish, furthermore it has some original artwork and soundtrack included.</p>\n<h3>Upgrade Steam version to stand-alone version and remove Steam DRM (Gothic 1 and 2)</h3>\n<p>You can install the Gothic playerkit and patches to remove the Steam DRM.</p>\n<p><a href="https://www.worldofgothic.de/">WorldOfGothic</a> playerkit patches:</p>\n<ul>\n<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>\n<li>Gothic 1 (DE):    <a href="https://www.worldofgothic.de/dl/download_34.htm">https://www.worldofgothic.de/dl/download_34.htm</a></li>\n<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>\n</ul>\n<h3>Play Gothic in a different language with English subtitles</h3>\n<p>If you're like me and have played the English version many times, but would\nlike to hear the (original) German voice audio or if you would like to play\nwith different audio than you're used to, then you can copy the speech.vdf file\nof your preferred version to your game files. Optionally turn on subtitles.\nI've used this to play the English version of Gothic with the original German\nvoice audio and English subtitles.\nThis works best with the version from GOG as it allows easier modding.</p>\n<h2>Easy money/weapons/armour/other items</h2>\n<h3>Steal from Huno</h3>\n<p>At night attack Huno the smith in the Old Camp and steal all his steel. Then\nmake some weapons and sell them with a merchant.  When you ask Huno about\nblacksmith equipment it will respawn with 5 of each kind of steel. This is also\na fairly good starting weapon (requires 20 strength).  Also his chest located\nnear the sharpening stone and fire contains some steel as well, lock-pick it.\nThe combination is: RRLRLL. The chest contains at least 20 raw steel, forge it\nto get 20 crude swords which you can sell for 50 ore each to a merchant.  This\nwill generate some nice starting money (1000+ ore) :)</p>\n<h3>Steal weapons from the castle in the Old Camp</h3>\n<p>This tip is useful for getting pretty good starting weapons.</p>\n<p>Before entering the castle itself drop your ore (Left control + down for me)\nin front of it. This will ensure when you get caught (and you probably will ;))\nno ore will get stolen by the guards. Now use the "slip past guard" technique\ndescribed below and you should be able to get into Gomez his castle. Run to the\nleft where some weapons are stored. Now make sure you at least steal the best\nweapon (battle sword) and steal as much as you can until you get whacked.  I\nusually stand in the corner since that's where the best weapons are (battle\nsword, judgement sword, etc). You'll now have some nice starting weapon(s) and\nthe good thing is they require very little attributes (about 13 strength).</p>\n<h3>Free scraper armour the New Camp</h3>\n<p>In the New Camp go to the mine and talk to Swiney at the bottom of "The\nHollow". Ask who he is and then ask to join the scrapers.  He will give you a\n"Diggers dress" worth 250 ore. It has the following stats: + 10 against\nweapons. + 5 against fire.  This will also give you free entrance to the bar in\nthe New Camp.</p>\n<h3>Unlimited water bottles in the New Camp</h3>\n<p>In the quest from Lefty you will be assigned to get water bottles from the\nrice lord.  He will give you infinite amounts of water bottles, in batches of\n12.</p>\n<h3>Armour amulet and increase HP potion</h3>\n<p>In the Old Camp in the main castle there are at least 3 chests with valuable\nitems that don't require a key:</p>\n<ul>\n<li>Middle right side (looking from the entrance), 1 chest:\n<ul>\n<li>lock combination: LLLLRLRL</li>\n<li>loot:\n<ul>\n<li>+15 against weapons, +15 against arrows (amulet of stone skin)\n(worth: 1000 ore)</li>\n</ul>\n</li>\n<li>additionally there are 2 locked doors at the right side in this room. In\nthe final room there are 3 floors with lots of chests.</li>\n</ul>\n</li>\n<li>Left side, 1 chest:\n<ul>\n<li>lock combination: RLLLLLRR</li>\n<li>loot:\n<ul>\n<li>+8 mana amulet (worth: 600 ore)</li>\n<li>2 potions (+70 hp)</li>\n<li>dreamcall (weed)</li>\n<li>120 coins (worth: nothing)</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>Right side, 2 chests with:\n<ul>\n<li>lock combination: RLLLRLLR</li>\n<li>loot:\n<ul>\n<li>armour amulets, +15 against weapons (worth: 600 ore)</li>\n<li>maximum life potion, +10 maximum life (worth: 1000 ore)</li>\n<li>speed potion (1 minute duration)</li>\n<li>4 potions (+70 hp)</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<h3>Swamp/Sect Camp harvest twice</h3>\n<p>In the swamp-weed harvest quest you must get swamp-weed for a guru. After this\nquest you can get the harvest again, but you can keep the harvest without\nconsequences.</p>\n<h2>Exploits</h2>\n<h3>Slip past guards</h3>\n<p>This exploit is really simple, just draw your weapon before you're "targeted"\nby the guard and run past them, this bypasses the dialog sequence.  When you're\njust out of their range holster your weapon again, so the people around won't\nget pissed off.</p>\n<p>Works really well on the guards in front of the Old camp's castle, Y'Berrion\ntemplars and New Camp mercenaries near the Water magicians, just to name a few.</p>\n<h3>Meat duplication</h3>\n<p>Go to a pan and focus / target it so it says "frying pan" or similar. Now open\nyour inventory and select the meat. Now cook the meat (for me Left Control +\nArrow up). The inventory should remain open. You'll now have twice as much meat\nas you had before. Do this a few times and you'll have a lot of meat, easy for\ntrading with ore/other items as well. This exploit does not work with the\ncommunity patch applied.</p>\n<h3>Fall from great heights</h3>\n<p>When you fall or jump from where you usually get fall damage you can do the\nfollowing trick: slightly before the ground use left or right strafe.  This\nworks because it resets the falling animation. There are also other ways to\nachieve the same thing cancelling the falling animation, such as attacking with\na weapon in the air.</p>\n<h2>Experience / level up tips</h2>\n<h3>Test of faith (extra exp)</h3>\n<p>You get an additional 750 exp (from Lares) when you forge the letter in the new\ncamp and then give it to Diego. You can still join both camps after this.</p>\n<h3>Fighting skeleton mages and their skeletons</h3>\n<p>An easy way to get more experience is to let the skeleton mages summon as much\nskeletons as they can, instead of rushing to kill the summoner immediately.\nAfter you have defeated all of them: kill the skeleton mage.</p>\n<h3>Permanent str/dex/mana/hp potions/items and teachers</h3>\n<p>When you want to get the maximum power at the end of the game you should save\nup the items that give you a permanent boost. Teachers of strength, dexterity\nand mana won't train over 100 of each skill.  However using potions and quest\nrewards you can increase this over 100.</p>\n<p>You should also look out for the following:</p>\n<ul>\n<li><p>Learn to get extra force into your punch from Horatio (strength +5, this\ncan't be done after level 100 strength). Talking to Jeremiah in the New Camp\nbar unlocks the dialog option to train strength at Horatio.</p>\n</li>\n<li><p>Smoke the strongest non-quest joint (+2 mana).</p>\n</li>\n</ul>\n<h3>Permanent potions in Sleeper temple</h3>\n<p>This one is really obvious, but I would like to point out the mummy's on each\nside where Xardas is located have lots and I mean lots of permanent potions.\nThis will give you a nice boost before the end battle.</p>\n<h3>Permanent potions as reward in quests</h3>\n<p>Always pick the permanent potion as a reward for quests when you can, for\nexample the quest for delivering the message to the High Fire magicians (mana\npotion) or the one for fetching the almanac for the Sect Camp.  Don't forget to\npick up the potions from Riordian the water magician when you're doing the\nfocus stones quest, it contains a strength and dexterity potion (+3).</p>\n<h3>Random/beginner tips</h3>\n<ul>\n<li><p>If you want to talk to a NPC, but some animation of them takes too long (like\neating, drinking, smoking) you can sometimes force them out of it by quickly\nunsheathing/sheathing your weapon.</p>\n</li>\n<li><p>When in the Old Camp: Baal Parvez can take you to the Sect Camp, he can be\nfound near the campfire near Fisk and Dexter.\nMordrag can take you to the New Camp, he can be found near the south gate,\nslightly after the campfire near Baal Parvez.</p>\n<p>When you follow them and when they kill monsters then you also get the\nexperience.</p>\n</li>\n<li><p>The NPC Wolf in the New Camp sells "The Bloodflies" book for 150 ore. When\nyou read this book you learn how to remove bloodflies parts (without having to\nspend learning points). After you read the book and learned its skill then you\ncan sell the book back for 75 ore. This investment quickly pays back: Per\nbloodfly: sting: 25 ore (unsold value), 2x wings (15 ore each unsold value).</p>\n</li>\n<li><p>The templar Gor Na Drak (usually near the old mine and walks around with\nanother templar): talking to him teaches you how to learn to get secretion from\nminecrawlers for free.</p>\n</li>\n<li><p>The spell scroll "Transform into bloodfly" is very useful:\n<ul>\n<li>A bloodfly is very fast.</li>\n<li>Can also fly over water.</li>\n<li>The scroll costs 100 ore. Its the same price as a potion of speed, but it\nhas no duration (just until you transform back).</li>\n<li>You have no fall damage.</li>\n<li>You can climb some steep mountains this way.</li>\n<li>Some monsters won't attack you, but some NPCs will attack you.</li>\n<li>Your attribute stats will temporary change.</li>\n<li>It requires 10 mana to cast (low requirement).</li>\n</ul>\n</p>\n</li>\n<li><p>Almost all mummies that are lootable in the game (Orc temple and The Sleeper\ntemple) have really good loot: permanent and regular potions and amulets and\nrings.</p>\n</li>\n</ul>\n<h3>In conclusion</h3>\n<p>When you use the tips described above Gothic should be a really easy game and\nyou should be able to get at a high(er) level with lots of mana/strength/hp.</p>\n<p>Have fun!</p>	html	https://www.codemadness.org/gothic-1-guide.html	Hiltjo