1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
blog/output/feeds/technology.atom.xml

529 lines
40 KiB
XML

11 months ago
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>LEdoian's Blog - technology</title><link href="https://blog.ledoian.cz/" rel="alternate"></link><link href="https://blog.ledoian.cz/feeds/technology.atom.xml" rel="self"></link><id>https://blog.ledoian.cz/</id><updated>2024-04-17T16:40:00+02:00</updated><entry><title>Creating own XKB tweaks</title><link href="https://blog.ledoian.cz/custom-xkb-tweaks.html" rel="alternate"></link><published>2024-04-17T16:40:00+02:00</published><updated>2024-04-17T16:40:00+02:00</updated><author><name>LEdoian</name></author><id>tag:blog.ledoian.cz,2024-04-17:/custom-xkb-tweaks.html</id><summary type="html">&lt;p&gt;Debugging this took me a bit too long, so I want to write about the caveat.&lt;/p&gt;
7 months ago
&lt;p&gt;My problem: My laptop does not have PageUp and PageDown keys, and many other
keyboards I use have similar deficiencies. And I use various environments and
various systems, some of which are shared with …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Debugging this took me a bit too long, so I want to write about the caveat.&lt;/p&gt;
&lt;p&gt;My problem: My laptop does not have PageUp and PageDown keys, and many other
keyboards I use have similar deficiencies. And I use various environments and
various systems, some of which are shared with other people who don't need/want
my tweaks. IOW: I want something generic, but it must be confined to my user
no system-wide daemon, no udev remapping. (I mostly ended up with these
solutions when I searched for a way to remap keys on Wayland.)&lt;/p&gt;
&lt;p&gt;Requirements: xkbcommon implementation of XKB with utilities. It is quite
common these days (duh…), but you could probably just compile this yourself if
you don't have it.&lt;/p&gt;
&lt;div class="section" id="the-tweaking"&gt;
&lt;h2&gt;The tweaking&lt;/h2&gt;
&lt;p&gt;The &lt;a class="reference external" href="https://xkbcommon.org/doc/current/user-configuration.html"&gt;xkbcommon guide&lt;/a&gt; tells us that we
can inspect the files in &lt;a class="footnote-reference" href="#lazy" id="footnote-reference-1"&gt;[1]&lt;/a&gt; &lt;tt class="docutils literal"&gt;/usr/share/X11/xkb&lt;/tt&gt; for the source files
and just write our bits to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;~/.config/xkb/symbols/ledoian&lt;/span&gt;&lt;/tt&gt;. In particular, I
added this snippet to remap keyboard brightness controls to PageUp/Down:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
partial
xkb_symbols &amp;quot;qs&amp;quot; {
key &amp;lt;I238&amp;gt; {[ Prior ]};
key &amp;lt;I237&amp;gt; {[ Next ]};
};
&lt;/pre&gt;
&lt;p&gt;The key identifiers are taken e.g. from &lt;tt class="docutils literal"&gt;xkbcli &lt;span class="pre"&gt;interactive-wayland&lt;/span&gt;&lt;/tt&gt;.
However, this is KcCGST &lt;a class="footnote-reference" href="#kccgst-vs-rmlvo" id="footnote-reference-2"&gt;[2]&lt;/a&gt; description, but layouts are
configured using RMLVO, so I need to define an option and tell what it should
do. The guide wants me to create &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;~/.config/xkb/rules/evdev&lt;/span&gt;&lt;/tt&gt; with:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
! option = symbols
ledoian:qs = +ledoian(qs)
! include %S/evdev
&lt;/pre&gt;
&lt;p&gt;Now I just add &lt;tt class="docutils literal"&gt;ledoian:qs&lt;/tt&gt; &lt;a class="footnote-reference" href="#option-vs-symbol" id="footnote-reference-3"&gt;[3]&lt;/a&gt; to my keyboard configuration
and… it does not work. For this, at all, but if I remap e.g. the L key, that
gets applied. The problem? That included file says that the default keyboard
model always includes &lt;tt class="docutils literal"&gt;inet(evdev)&lt;/tt&gt; symbols. Those symbols set the default
meaning of the keys, but since that got applied later, it overrides my tweak.&lt;/p&gt;
&lt;p&gt;Solution: first include, then add my option.&lt;/p&gt;
&lt;p&gt;How to debug: read stuff that &lt;tt class="docutils literal"&gt;xkbcli &lt;span class="pre"&gt;compile-keymap&lt;/span&gt; &lt;span class="pre"&gt;--verbose&lt;/span&gt;&lt;/tt&gt; tells you
(pass your config as &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--layout&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--variant&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--options&lt;/span&gt;&lt;/tt&gt;, …). At the top
it says what it does:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
xkbcommon: DEBUG: Include path added: /home/ledoian/.config/xkb
xkbcommon: DEBUG: Include path added: /usr/share/X11/xkb
xkbcommon: DEBUG: Compiling from RMLVO: rules 'evdev', model 'pc105', layout 'us', variant '(null)', options '(null)'
xkbcommon: DEBUG: Compiling from KcCGST: keycodes 'evdev+aliases(qwerty)', types 'complete', compat 'complete', symbols 'pc+us+inet(evdev)'
&lt;/pre&gt;
&lt;p&gt;My option would appear before the &lt;tt class="docutils literal"&gt;inet(evdev)&lt;/tt&gt; part.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-note-about-x11"&gt;
&lt;h2&gt;A note about X11&lt;/h2&gt;
&lt;p&gt;X11 uses a separate implementation of XKB (the original one, in fact), which
does _not_ look into the user directory, just the system ones. However, you can
compile the keymap yourself using &lt;tt class="docutils literal"&gt;xkbcli &lt;span class="pre"&gt;compile-keymap&lt;/span&gt; [KEYMAP OPTIONS] &amp;gt;
my_layout.xkb&lt;/tt&gt; and load it into the X server with &lt;tt class="docutils literal"&gt;xkbcomp my_layout.xkb $DISPLAY&lt;/tt&gt;.&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;table class="docutils footnote" frame="void" id="lazy" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;This is not technically accurate, really the paths reference
&lt;tt class="docutils literal"&gt;$XDG_something&lt;/tt&gt; variables. I am lazy and just copied my system, so YMMV
(probably won't, though).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="kccgst-vs-rmlvo" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;There are two levels of describing the keymap: the
lowlevel one is called KcCGST (short for keycodes, compat, geometry,
symbols, types) and is considered to be an implementation detail; the
user-facing one is RMLVO (rules, model, layout, variant, options) and that
is what you use in the configs, with &lt;tt class="docutils literal"&gt;setxkbmap&lt;/tt&gt; &amp;amp;c.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="option-vs-symbol" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-3"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;While both this example and the &lt;a class="reference external" href="https://www.freedesktop.org/wiki/Software/XKeyboardConfig/"&gt;upstream&lt;/a&gt; layouts name
the symbols and options similarly, I think they don't need to be related
you should be able to put whatever you want in your options to the left of
&lt;tt class="docutils literal"&gt;=&lt;/tt&gt;, the right hand side is the name of the symbol file and if a
non-default layout from that file is used, its name is put in the
parentheses.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="technology"></category><category term="lifehack"></category><category term="software"></category><category term="linux"></category></entry><entry><title>Print your stuff on Möbius bands!</title><link href="https://blog.ledoian.cz/mobius-print.html" rel="alternate"></link><published>2024-03-02T18:07:00+01:00</published><updated>2024-03-03T14:59:00+01:00</updated><author><name>LEdoian</name></author><id>tag:blog.ledoian.cz,2024-03-02:/mobius-print.html</id><summary type="html">&lt;p&gt;I found a fun and useful way of printing stuff to ~~both~~all sides of a paper.
9 months ago
I just need to find the right printer!&lt;/p&gt;
&lt;div class="section" id="quick-recap-how-to-conventionally-print-stuff-two-sided"&gt;
&lt;h2&gt;Quick recap: how to conventionally print stuff two-sided&lt;/h2&gt;
&lt;p&gt;A typical way is just sending the page to get printed two-sided (with setting
the correct way …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;I found a fun and useful way of printing stuff to ~~both~~all sides of a paper.
I just need to find the right printer!&lt;/p&gt;
&lt;div class="section" id="quick-recap-how-to-conventionally-print-stuff-two-sided"&gt;
&lt;h2&gt;Quick recap: how to conventionally print stuff two-sided&lt;/h2&gt;
&lt;p&gt;A typical way is just sending the page to get printed two-sided (with setting
the correct way of flipping pages). That is, on the other side of page 1 is
page 2, next sheet contains pages 3,4, then 5 &amp;amp; 6, …&lt;/p&gt;
&lt;p&gt;This is usually trivial to print on duplex printers, a bit hard to simulate on
one-sided printers (but some drivers can do that) and has drawbacks when you
need to look at stuff on other pages at the same time you need to flip the
sheet often, as you only can put half of the pairs of pages next to each other
(even one and the following odd one).&lt;/p&gt;
&lt;div class="figure"&gt;
&lt;object data="https://blog.ledoian.cz/images/mobius-print/twoside.svg" style="width: 66%;" type="image/svg+xml"&gt;&lt;/object&gt;
&lt;p class="caption"&gt;Ordinary two-sided printing. Red arrows show sheet flips between consecutive
pages.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;A slight improvement hack is putting two pages on the same side of the paper
(works well with A-series of papers, I don't know for Letters &amp;amp;co.) you can
put up to four pages of the original document next to each other, if they are
the right ones, but there are still pairs of pages that need turning sheets.
Also only works if the original pages do not have too tiny features on them.
&lt;a class="footnote-reference" href="#illustrations" id="footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Booklets are fun and approachable, but still suffer from the same issues as the
conventional duplex print. They might be a bit hard to print, but programs like
&lt;tt class="docutils literal"&gt;pdfbook&lt;/tt&gt; or &lt;tt class="docutils literal"&gt;paperjam&lt;/tt&gt; make it easy to prepare for the classic duplex
printing. Also, it is maybe hard to tell which page ends up where, as the order
is: last+first, second+penultimate, third-from-end+third, … until the pages
meet in the middle.&lt;/p&gt;
&lt;div class="figure"&gt;
&lt;object data="https://blog.ledoian.cz/images/mobius-print/booklet.svg" style="width: 66%;" type="image/svg+xml"&gt;&lt;/object&gt;
&lt;p class="caption"&gt;The most common booklet order with two pages per side for landscape
orientation. (Note that we show more pages, and thus more sheet-flips; the
number of sheet-flips is in fact the same as for two-sided printing.)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="the-improvement-for-seeing-multiple-consecutive-pages"&gt;
&lt;h2&gt;The improvement for seeing multiple consecutive pages&lt;/h2&gt;
&lt;p&gt;In order to be able to look simultaneously at many consecutive pages of the
original, I think the order of first+first-past-half, second+second-past-half,
… middle+last is much better (or maybe even the best). Since consecutive pages
end up on different sheets (whenever there are at least three pages), if the
original has e.g. figures on different page or long code listing, you can see
it all!&lt;/p&gt;
&lt;div class="figure"&gt;
&lt;object data="https://blog.ledoian.cz/images/mobius-print/mobius.svg" style="width: 66%;" type="image/svg+xml"&gt;&lt;/object&gt;
&lt;p class="caption"&gt;The &amp;quot;Möbius order&amp;quot; of pages.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;And this is really easy to use: You read a page and when you don't need it
anymore, you flip it and put to the end of the page stack &lt;a class="footnote-reference" href="#ordering" id="footnote-reference-2"&gt;[2]&lt;/a&gt;. If you
need to look at several pages, just rotate them in the same order as they go the
first time. &lt;a class="footnote-reference" href="#mistake" id="footnote-reference-3"&gt;[3]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Need to print this? For one-sided printers this is rather easy, too: just print
the first half (the bigger one) on the sheets, then put them back into the tray
and print the rest on them. You might need to experiment which side the sheets
should be put in and whether you need to print the rest in reverse order, but
that is it.&lt;/p&gt;
&lt;p&gt;Got the pages shuffled? Sort them by the first half, as if the print was
one-sided.&lt;/p&gt;
&lt;p&gt;The only annoying thing for me is that there is not much software that could
reorder the pages for two-sided printing, so that you don't need to re-insert
the sheets back in the tray. So I &lt;a class="reference external" href="https://blog.ledoian.cz/images/mobius-print/interleave.patch"&gt;patched&lt;/a&gt; &lt;a class="reference external" href="https://mj.ucw.cz/sw/paperjam/"&gt;paperjam&lt;/a&gt; to enable this. &lt;a class="footnote-reference" href="#multi-mobius" id="footnote-reference-4"&gt;[4]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And the best part? If you would try to glue consecutive pages side-to-side,
you'd end up with a Möbius band! So if you get a Möbius paper, you can just
print this one-sided (duh :-D)&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="honorable-mention-leporello"&gt;
&lt;h2&gt;Honorable mention: leporello&lt;/h2&gt;
&lt;p&gt;Printing leporellos (aka concertina folded) also has many of the same benefits,
since there is only one pair of consecutive pages that need a page flip. The
order is first+last, second+penultimate, … and the original pages can be
shuffled this way with &lt;tt class="docutils literal"&gt;paperjam&lt;/tt&gt; or simply using the other order for the
second side printing, than for the Möbius band. But there is a bit of fun
topology missing here :-)&lt;/p&gt;
&lt;div class="figure"&gt;
&lt;object data="https://blog.ledoian.cz/images/mobius-print/leporello.svg" style="width: 66%;" type="image/svg+xml"&gt;&lt;/object&gt;
&lt;p class="caption"&gt;A leporello order is also quite good, with only one sheet-flip in the entire
document.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="is-this-the-best-order"&gt;
&lt;h2&gt;Is this the best order?&lt;/h2&gt;
&lt;p&gt;Yes, if &amp;quot;best&amp;quot; means &amp;quot;the minimum difference of numbers of pages that get put
on the same sheet is as big as possible&amp;quot;. The proof is left as an exercise for
the reader.&lt;/p&gt;
&lt;!-- Hint: you cannot pair the middle page to anything else to get a better
result. --&gt;
&lt;p&gt;Of course, this holds for a set of pages with no additional assumptions. In
ordinary print, having a sheet-turn between chapters is fine and under similar
guarantees other approaches may yield better results.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="cheat-sheet-paperjam-commands"&gt;
&lt;h2&gt;Cheat sheet: paperjam commands&lt;/h2&gt;
&lt;table border="1" class="docutils"&gt;
&lt;caption&gt;Various commands for ordering pages for duplex printing with paperjam.&lt;/caption&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;Order&lt;/th&gt;
&lt;th class="head"&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;Classic two-sided&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;null&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Two pages per side&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;nup(2)&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Booklet&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;book&lt;/tt&gt; (follow with &lt;tt class="docutils literal"&gt;nup(2)&lt;/tt&gt; for actual booklet print)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Leporello&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;modulo(2) {1 2} modulo(1,half) {1 &lt;span class="pre"&gt;-1}&lt;/span&gt;&lt;/tt&gt; (The first &lt;tt class="docutils literal"&gt;modulo&lt;/tt&gt; just adds blank pages to the end.)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Möbius (with patch)&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;interleave(2)&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Möbius (known page count)&lt;/td&gt;
9 months ago
&lt;td&gt;&lt;tt class="docutils literal"&gt;select &lt;span class="pre"&gt;{1..5&lt;/span&gt; &lt;span class="pre"&gt;10..6}&lt;/span&gt; modulo(1,half) {1 &lt;span class="pre"&gt;-1}&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
9 months ago
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Multiple Möbius bands, odd-even&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;modulo(4) {1 3 2 4}&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Multiple bands, &amp;quot;modulo 3&amp;quot;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;modulo(6) {1 4 2 5 3 6}&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Second half (smaller) of pages in reverse order&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;modulo(1,half) &lt;span class="pre"&gt;{-1}&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Second half (smaller) of pages in normal order&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;modulo(1,half) &lt;span class="pre"&gt;{-1}&lt;/span&gt; modulo(1) &lt;span class="pre"&gt;{-1}&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;First half (bigger) of pages&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;modulo(2) {1 2} modulo(1,half) {1}&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I might create more patches for avoiding the weird &lt;tt class="docutils literal"&gt;modulo&lt;/tt&gt; commands…&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;table class="docutils footnote" frame="void" id="illustrations" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Most of the figures in this article are drawn with a single
page per a side of a sheet. I consider putting more pages on a single side
of paper to be an implementation detail, because it is not always possible
(e.g. with too small font) and sometimes you could put more than two pages
on a single side of paper, which leads to the fact that if you put
everything on one side of the paper, you can see everything at once and save
the other side. Not very useful though… My only exception is the booklet
printing below, because that one seems to be rather common.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="ordering" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;See how this neatly puts the first-past-half page right after
the half of the stack? Awesome!&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="mistake" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-3"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Also, if you flip the page around the wrong edge, you can just
rotate the rest of the stack and end up with the correct orientation.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="multi-mobius" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-4"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;A slight variation for which I can generate the order
with upstream &lt;tt class="docutils literal"&gt;paperjam&lt;/tt&gt; is using this order on small subsets of pages.
For example, if you only want to be able to see any two consecutive pages,
you can do this for just four pages the order is then 1+3, 2+4, 5+7, 6+8,…
Since each sheet either contains two odd or two even pages, the following
page is on different sheet than the previous one. And you can do this
&amp;quot;modulo 3&amp;quot; to see three pages: 1+4, 2+5, 3+6, 7+10, … This &amp;quot;simulates&amp;quot;
multiple smaller Möbius bands, but will be probably harder to use.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="technology"></category><category term="lifehack"></category><category term="print"></category></entry><entry><title>About this blog</title><link href="https://blog.ledoian.cz/about-blog.html" rel="alternate"></link><published>2024-01-10T16:47:00+01:00</published><updated>2024-01-10T16:47:00+01:00</updated><author><name>LEdoian</name></author><id>tag:blog.ledoian.cz,2024-01-10:/about-blog.html</id><summary type="html">&lt;p&gt;This is my blog and this article describes its setup and other details about my
11 months ago
intentions. The actual &lt;a class="reference internal" href="#the-setup"&gt;setup&lt;/a&gt; is probably the most
interesting tech-wise.&lt;/p&gt;
&lt;div class="section" id="what-is-this"&gt;
&lt;h2&gt;What is this?&lt;/h2&gt;
&lt;p&gt;My own space on the internet where I can post whatever and link others to it.
It might end up containing rants …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;This is my blog and this article describes its setup and other details about my
intentions. The actual &lt;a class="reference internal" href="#the-setup"&gt;setup&lt;/a&gt; is probably the most
interesting tech-wise.&lt;/p&gt;
&lt;div class="section" id="what-is-this"&gt;
&lt;h2&gt;What is this?&lt;/h2&gt;
&lt;p&gt;My own space on the internet where I can post whatever and link others to it.
It might end up containing rants, guides, ideas, or maybe nothing at all in the
end. Only the future will tell.&lt;/p&gt;
&lt;p&gt;The blog might even serve as my personal web page/introduction. Maybe. Maybe not…&lt;/p&gt;
&lt;p&gt;The main motivation is to have low-effort way to post random stuff. Which leads
to my requirements for this thing.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="requirements"&gt;
&lt;h2&gt;Requirements&lt;/h2&gt;
&lt;p&gt;(The requirements are a bit too idealistic, so not all of them were satisfied…)&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;low-effort, me-friendly, low-maintenance I don't want to have to learn too
many new technologies to use this. This includes the required technologies:
Python, Markdown/reStructuredText, Jinja2, git, …&lt;/li&gt;
&lt;li&gt;Technical and math content ~~friendly~~ compatible I expect that to appear
here.&lt;/li&gt;
&lt;li&gt;Static site for security, coolness factor and control. Also static on the
front-end, because I don't like JavaScript and/or running untrusted code on
my machine (even when in a sandbox). The SSG should likely be aimed at
creating blogs, not documentation. Also, self-contained, as in not depending
on third-party sites.&lt;/li&gt;
&lt;li&gt;No moving parts in the infrastructure (or as few as possible) if it works
on my machine, it should just get mirrored to the public site with as few
modifications as possible.&lt;/li&gt;
&lt;li&gt;Transparent I should be able to understand it, maybe others could also use
it as a resource or take inspiration. (At one point, this deployment itself
started being interesting, so if I can share the background as well as the
final webpage, it would be cool.)&lt;/li&gt;
&lt;li&gt;Followable I know you internet guys like to ~~stalk~~ follow people :-)&lt;/li&gt;
&lt;li&gt;Aligned with my values: minimalist, simple, extensible/hackable, FLOSS&lt;/li&gt;
&lt;li&gt;If the platform could distinguish translations and do strikethroughs, it would
be nice, but that is not a hard requirement.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are several features of conventional blogs that I consider to be a
non-goals or even anti-goals. Mostly it is about interactivity I don't aim
for having any kind of comments here, or really anything that would require
JavaScript or complex HTML/CSS. And appearance goes past me as well, I instead
try to let the browser decide how to display this page more on that &lt;a class="reference internal" href="#design-considerations"&gt;below&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The workflow I wanted to achieve is something like: Write the content, git it,
build it (locally, no CI/CD), push it, done. Single write, single push, very
simple.&lt;/p&gt;
&lt;p&gt;And I managed to achieve something like that, via learning (too much?) about
git.&lt;/p&gt;
&lt;!-- TODO: fix the worktree bug already! --&gt;
&lt;/div&gt;
&lt;div class="section" id="the-setup"&gt;
&lt;h2&gt;The setup&lt;/h2&gt;
&lt;p&gt;Naturally for a sysadmin/netadmin, the setup consists of 7 ~~ISO/OSI~~ layers:&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;&lt;strong&gt;Physical layer&lt;/strong&gt;: cheap Hetzner VPS. Not physical, but whatever.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network layer&lt;/strong&gt;: Nginx&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Persistence layer&lt;/strong&gt;: &lt;a class="reference external" href="https://gitea.ledoian.cz/LEdoian/blog"&gt;this git repo&lt;/a&gt;. I will elaborate below why can
you see this both rendered here and in the source form in Forgejo.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Content layer&lt;/strong&gt;: Markdown or reStructuredText files.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Business logic layer&lt;/strong&gt;: &lt;a class="reference external" href="https://getpelican.com"&gt;Pelican&lt;/a&gt;. It's rather
popular and written in Python, I didn't look further.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Presentation layer&lt;/strong&gt;: I hacked my own theme, because I didn't like any in
the &lt;a class="reference external" href="https://github.com/getpelican/pelican-themes"&gt;pelican-themes repo&lt;/a&gt;.
I was a bit inspired by the layout of &lt;a class="reference external" href="https://eev.ee/blog"&gt;eevee's blog&lt;/a&gt;, but I wanted a dark theme. And as you can see, I
can't do quality frontend, so it ended up horrible… :-D&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stalking layer&lt;/strong&gt;: Pelican's built-in RSS and Atom feed generators. Not
linked from anywhere at the moment, but &lt;a class="reference external" href="https://gitea.ledoian.cz/LEdoian/blog/src/branch/blog/output/feeds"&gt;the repo will tell you&lt;/a&gt; what
hides under the &lt;tt class="docutils literal"&gt;/feeds/&lt;/tt&gt; path. Or you can utilize the repo (for personal
use the content's license is not decided at the moment)…&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Most of this is straightforward, the fancy part is my repo. The repo contains
both source and rendered content, so that I can point Nginx right at a checkout
and have Git solve both persistence and deployment without additional moving
parts.&lt;/p&gt;
&lt;p&gt;There are two tricks in the configuration of Git repositories: pushing to a
checked out repo is enabled by configuring &lt;tt class="docutils literal"&gt;receive.denyCurrentBranch =
updateInstead&lt;/tt&gt; in the target repository (which is just a normal repo, not a
bare one), and then I just told my source repositories &lt;a class="footnote-reference" href="#multiple-src" id="footnote-reference-1"&gt;[1]&lt;/a&gt; to use
two push targets for the remote (the first line &lt;em&gt;replaces&lt;/em&gt; the original push
address for some reason):&lt;/p&gt;
&lt;pre class="literal-block"&gt;
git remote set-url --add --push blog_remote gitea&amp;#64;gitea.ledoian.cz:LEdoian/blog.git
git remote set-url --add --push blog_remote blog_user&amp;#64;blog.ledoian.cz:blog_dir
&lt;/pre&gt;
&lt;p&gt;The blog user is just a user with SSH access via authorized keys, no special
sauce there. Nginx is then pointed to serve &lt;tt class="docutils literal"&gt;~blog_user/blog_dir/output/&lt;/tt&gt; at
&lt;tt class="docutils literal"&gt;blog.ledoian.cz&lt;/tt&gt;. (The &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;git-remote(1)&lt;/span&gt;&lt;/tt&gt; manpage requires me to have both
repositories in sync, but as long as I configure all my repositories this way,
I should be safe, and I think I could get away with my blog checkout getting
behind accidentally.)&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="my-workflow-and-lots-of-drafts"&gt;
&lt;h2&gt;My workflow and lots of drafts&lt;/h2&gt;
&lt;p&gt;It's Git so it's only natural for me to use various branches and repositories
even for a dumb blog. There are in fact 4 stages an article may go through &lt;a class="footnote-reference" href="#skipping-stages" id="footnote-reference-2"&gt;[2]&lt;/a&gt;:&lt;/p&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;A private draft: lives on a branch &lt;tt class="docutils literal"&gt;priv/something&lt;/tt&gt;, may contain private
infos (like when I would just copy-paste from terminal without redaction)
and this branch will probably never be merged to the main repo. Nothing
about these branches is guaranteed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;A public WIP draft: uses a branch called &lt;tt class="docutils literal"&gt;pub/something&lt;/tt&gt; which is pushed
to Forgejo (and in fact also to the blog itself, but that is just an
implementation detail). The draft is either does not build or is very
incomplete and I expect to add stuff in a way that could break the build, so
I put it on a separate branch. The branch will be probably merged to the
main branch (called &lt;tt class="docutils literal"&gt;blog&lt;/tt&gt;) when it is ready.&lt;/p&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;pub/…&lt;/tt&gt; branches can be created either manually or by cherry-picking
from the respective &lt;tt class="docutils literal"&gt;priv/…&lt;/tt&gt; branch, but that will likely not be
distinguishable. (I am too lazy to keep the references even in the commit
logs.)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;When a draft is almost ready (or the content has simple syntax), it gets
placed on the &lt;tt class="docutils literal"&gt;blog&lt;/tt&gt; branch. The only thing that designates it as a draft
is &lt;tt class="docutils literal"&gt;status: draft&lt;/tt&gt; in the frontmatter, which means that the article will
get rendered and put somewhere on the public blog, but not reachable from
the title page (&amp;quot;unlisted&amp;quot;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Of course, eventually (and hopefully) the article gets published for
everyone to see. At that point, it is complete (or at least that is what I
thought when marking it as published). Possibly it might be updated in the
future, but no such update is anticipated at the moment of publishing. &lt;a class="footnote-reference" href="#update-this" id="footnote-reference-3"&gt;[3]&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I use Git to synchronize my private branches among machines, so there are
actually two &amp;quot;server-side&amp;quot; repositories (private and public one) and thus two
remotes. &lt;a class="footnote-reference" href="#private-branches-wish" id="footnote-reference-4"&gt;[4]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As for the actual workflow, for the main branch it usually consists of: writing
content, committing it, building the web, checking it locally, committing the
built blog and pushing it. Sometimes I do the commits together, but I always
separate the rendering/building commits from the content-creating ones, so that
I can handle those differently if needed (i.e. there is no point in
cherry-picking the built content, I can generate it). &lt;a class="footnote-reference" href="#git-purists" id="footnote-reference-5"&gt;[5]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For other branches I use some applicable subset of the steps above, probably.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="design-considerations"&gt;
&lt;h2&gt;Design considerations&lt;/h2&gt;
&lt;p&gt;The appearance of the blog is maybe not nice. That is for two reasons: I don't
have the right idea about how to make it much better and I want to have a
rather simple CSS for the web. The latter wish is because I tend to tweak
appearance of sites I visit using my own styles, so I would like you to be able
to do the same.&lt;/p&gt;
&lt;p&gt;And for the former reason, if you have any ideas / improvements (including user
styles), hit me at &lt;a class="reference external" href="mailto:blog&amp;#64;pokemon.ledoian.cz"&gt;blog&amp;#64;pokemon.ledoian.cz&lt;/a&gt; :-)&lt;/p&gt;
&lt;p&gt;My overall idea is a dark-by-default &lt;a class="footnote-reference" href="#light-theme" id="footnote-reference-6"&gt;[6]&lt;/a&gt; minimalist page with a single menu on the
right containig all the relevant links. The page should not dictate too much
but rather let the user agent decide the rendering (&lt;a class="reference external" href="https://html.spec.whatwg.org/multipage/rendering.html#rendering"&gt;it does anyway…&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;I want my blog to render similarly in Gecko-, WebKit- and Blink-based browsers
(e.g. Firefox, Badwolf, Qutebrowser). Others should be usable.
Browser-/engine-specific styles are not welcome let's keep it simple. And no
JavaScript…&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="work-in-progress-todos"&gt;
&lt;h2&gt;Work in progress / TODOs&lt;/h2&gt;
&lt;p&gt;This thing is at the moment very barebones, which is sufficient for the main
purpose. However, I would like to have some features here, one day, hopefully:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Dates in the article headers (and maybe more improvements of the theme, see
above)&lt;/li&gt;
&lt;li&gt;Stable category and tag names and a page with a description of them. As of
now I haven't really invented a system of sorting my content, which leads to
a mess… Please don't rely on categories having any particular name / URL for
now.&lt;/li&gt;
&lt;li&gt;Link the RSS feeds from somewhere&lt;/li&gt;
&lt;li&gt;Personal info with links to my other profiles&lt;/li&gt;
&lt;li&gt;Some linking to the Fediverse and using it for comments (since there will be
no comments here)&lt;/li&gt;
&lt;li&gt;Sensible translations, maybe (if I/someone ever get to write the same content
again in a different language…)&lt;/li&gt;
&lt;li&gt;Improve the list of talks I've given (create some kind of sensible table maybe?)&lt;/li&gt;
&lt;li&gt;Decide on a licence for the content (If you want to utilize something here
before I do that, please ask me, I think we can find a way :-))&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you are so upset with this blog (or maybe bored) that you want to improve
it, send me patches / ideas. I don't expect anyone to do that, though :-D (And
I do not promise you that I will use the patch, even if it matches all my
opinions above. I also have some gut feelings about what I like…)&lt;/p&gt;
&lt;p&gt;Also, tell me if you hate something else about my page. I want to at least know
whom I upset :-D (but I will probably also think about your gripes and whether
I can and should try to avoid them…)&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;table class="docutils footnote" frame="void" id="multiple-src" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;I also use multiple machines on which I can write stuff.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="skipping-stages" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;p class="first"&gt;I am lazy and chaotic (good), so the stages are optional
and non-linear, and sometimes involve paper. This article is a prime
example: parts of it were on two different private branches, but at the end
I wrote it from scratch directly on the main branch. And the requirements
were written on a paper originally.&lt;/p&gt;
&lt;p class="last"&gt;Nevertheless, the general idea still holds and may inspire others, so it
makes sense to keep this part in the article. (Also, this footnote might not
make sense before reading the definition of the stages, but I didn't find a
better place to put it…)&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="update-this" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-3"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Well, given this article contains some future plans, I
actually anticipate update of this one, but maybe not in the near future. So
the outline is not really correct, but I make the rules :-) (There
were some build breaks on the main branch, too :-D)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="private-branches-wish" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-4"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;I would love if my Forgejo could have &amp;quot;private
branches&amp;quot;, but I understand that the overhead for doing this is not nice,
since it would need to be able to decide for any object, whether it is
public or not (you can do &lt;tt class="docutils literal"&gt;git fetch &amp;lt;remote&amp;gt; &lt;span class="pre"&gt;&amp;lt;object-hash&amp;gt;&lt;/span&gt;&lt;/tt&gt;) and somehow
keep track even with rebases, merges, force-pushes, many branches, … Having
a separate private repository is not a big problem in comparison.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="git-purists" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-5"&gt;[5]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Git purists might want to tell me that committing build
artifacts is not good practice. I know and I explicitly don't care in case
of this repo, because here I prioritise my own comfort of being able to
check everything locally and then be reasonably sure the deployed version
will also work, all this with only a single push somewhere. Of course, one
could argue that with that there is no reason to create two commits, but it
does not really bother me to run something like &lt;tt class="docutils literal"&gt;git commit &lt;span class="pre"&gt;-m&amp;quot;render&amp;quot;&lt;/span&gt;
output/&lt;/tt&gt; when I am sure it works, and this keeps readable diffs separate
from the non-readable ones (i.e. the changes in generated HTML).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="light-theme" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-6"&gt;[6]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Having the page be dark-by-default is my preference, but I
respect that others may prefer light sites. However, I have not yet
determined what colors should be used (probably still cyan / blue / maybe
purple-ish, but I don't know what shade) nor understood how to use
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;&amp;#64;media(prefers-color-scheme)&lt;/span&gt;&lt;/tt&gt; in a maintainable and simple way (in the
context of my theme). So naturally, this is postponed to the future…&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="technology"></category><category term="meta"></category><category term="infrastructure"></category></entry></feed>