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