Weekly report 20-37

Weekly report 20-37

Good news

Bad news

  • Termux is getting crippled in the newest versions of Android. I’ve had about enough of ‘security guys’ as well as others systematically removing usability from systems.

  • The new Dacia Sandero model, thus far available as CGI renders, is a bit of a disappointment. While I expect my 2018 Sandero Stepway to last me many more years, it is a let down to discover that there is no longer an affordable car on the market that I would find visually appealing (Audi is still looking decent). I’m getting old and there is a progressively growing number of things that I remember being better in the past.

  • Prague gets more ugly, weird trams. The T3 was fine, the T6A5 was fine, this…​ why?

  • Compulsory face masks, again. I thought it had been made obvious what most people think about them. Is it time for civil disobedience?

sdgtk

Reading an article, I got shortly interested in learning Motif. It didn’t take me long to mostly abandon the idea, as it’s a quirky, LGPL’d thing, though it lead me to think about trying it out on something, and about the easiest project I could do with it was converting the TUI dictionary from my last report, where I said it needed to be rewritten as a GUI application.

As I thought about it some more, I realised it shouldn’t be too much work to use the GTK+ toolkit for this instead, which I already had fairly good knowledge of, mostly from my high school tinkering.

And I was right. It took me about a day to replicate most of the interface and features. The inspector has been very helpful in doing so, the CSS complexity shitshow of version 3 actually surprisingly useful, and the libraries contained most of what I could wish for. I have even found out it is trivial to follow changes in the X11 selection in real-time, and my timer-based GtkClipboard solution formerly used in sdtui wasn’t worth digging up, nor was it necessary to use xcb--I just had to connect to a signal. One function call.

616

But not all turned out effortless. It appears I need to write a custom widget for a little detail that takes up most of the screen: the list of words and their respective entries. What I’m using right now is a hack, and it shows. Selection is acting up all funny, and I don’t know how to avoid wrapping the two-column list of labels in a GtkScrolledWindow--I want it to be clipped at whatever size the top-level window is.

Sadly, even with Pango doing most of the work for such text rendering tasks, I’ll have to delay this project until later. But I still wonder why I had wasted so much time writing the TUI version when this has been so simple in comparison. Hindsight is 20/20, I suppose.

Gitea tuning

Googlebot likes to index a lot of Gitea URLs in the form of https://git.janouch.name/p/ell/src/commit/cd0f978b096b7054c7b661a4877c58833c7b4bc5/ell.vim and a considerable amount of people visits my site via these links, looking at old versions of everything. I’ve finally had enough of this. It appears that the simplest solution is to add a ‘robots tag’ in HTTP headers, which seems about right, and leads to the following nginx configuration snippet:

location / {
    ...

    # Do not let Google index files of a specific commit, only allow branches
    if ($request_uri ~ ^/[^/]*/[^/]*/[^/]*/commit/) {
        add_header X-Robots-Tag noindex;
    }
}

I’m somewhat disappointed by the bot’s unintelligence. Hopefully this change will help make it more focused. Google should add special casing for their choice of canonicals here.

Responsivity

Looking a bit into why the application is loading so incredibly slow, I’ve also enabled gzip compression (first on nginx level, then I learnt I could do it in app.ini). This has helped a lot with those huge CSS and JS files it’s trying to push to clients. It also tried to load Roboto webfonts, which is best resolved by something like:

location /vendor/assets/roboto-fonts {
    return 404;
}

because fancy fonts have much lesser priority than being able to read at all.

I don’t know. Gitea is as unnecessarily complex as cgit is too simplistic. And Sourcehut is written in Python. How much do I want people to be able to interact with my projects? Maybe I should remake cgit in Go, what with go-git progressing quite nicely. Then figure out mailing lists, perhaps similarly to public-inbox.

cgit tuning

While it’s completely useless as you can’t even make the "about" tab the default and I don’t want to add yet another workaround to my nginx configuration, I’ve extended my ridiculous libasciidoc wrapper to support showing README.adoc files in cgit as well!

# Make this also work for cgit which, strangely enough, is willing to render
# /anything/ via the /about route, only passing through image/* unchanged.
if [ -z "$GITEA_PREFIX_SRC" ]; then
    test "${1%.adoc}" != "$1" || exit 1
    cgit_fixups='s/<div class="content">/<div>/'
    export GITEA_PREFIX_SRC=.
fi

# libasciidoc can't be helped in other ways so far, adding support for:
#  - the original 'italics' syntax
#  - double-line headings (part of haven's hswg which invokes libasciidoc)
#  - make links to other documents work, normally an attribute could be used
perl -pe "s|'([-~/\\.\\w]+)'|_\$1_|g;" | hswg 2>/dev/null | \
    perl -pe 's|(href=")([^/]*?\.adoc")|$1$ENV{GITEA_PREFIX_SRC}/$2|;' \
        -e "$cgit_fixups"

The lengths I’m willing to go to for AsciiDoc, while avoiding Python and Ruby…​ I’ve actually created a pull request to add link attribute support on Sunday. If only everything was as easy.

TUI article

I hate working on it but it’s on my TODO list and I don’t feel like dropping it yet. I’ve basically finished the feature table this week, finding a very old termux bug in the process, and extended the section about pictures. I keep learning things.

I’ll stop again once I manage to finish the section about colours, though I might have something to say or demonstrate about widgets, too.

Piracetam, continued

It seems to be losing its interesting effects, including any headaches, and when I stopped supplementing it with -afinils for a few days, I returned to my baseline (anhedonia). Next course of action: see if mutual tolerance can build up. I’m going to keep eating more natural sources of choline, and make further observations.

In any case, there have been no positive changes to my memory abilities whatsoever. Maybe I’m just too low on choline. It’s a bit of a pseudo-science with randomised results, though these experiments cost me close to nothing.