Skip to main content

GitHub Signatures in Gitea

A small lifehack for the Gitea owners. As you may know, GitHub signs commits done with its web interface with its GPG key. These commits may end up on your Gitea server. It looks rather unconvincing:
Image/PhotoCommit listImage/PhotoCommit page
Luckily it is fixable by a simple lifehack:
  • Register user ‘github’
  • Login with it and optionally set up a profile
  • Add the web flow GPG key:
  • Add to the account emails
  • Mind the security and disable sign-in for this account
The signatures will look much better:
Image/PhotoCommit listImage/PhotoCommit page

RPM5 lost all distros

With OpenMandriva Lx 4 now in beta it seems that RPM5 lost all its main users.CAOS, Ark and Unity are discontinued, Wind River and OpenMandriva switched to RPMv4

Interestingly, it’s also the end of urpmi with both Mageia and OpenMandriva switching to dnf.

It seems rpm world entered a semi-unified state with dnf and zypper, both libsolv based and partly interoperable

Dark Theme for the Blog

Just finalized the dark theme for the blog. The idea is simple, use prefers-color-scheme media query and wrap dark style elements with it:

@media (prefers-color-scheme: dark) {
a {
color: #4be

The browser then will respect the OS dark mode or have its own night mode and show your website in dark:

Image/PhotoLight mode Image/PhotoDark mode
That’s simple and cool!

One of the problems currently is testing. It is possible but rarely comfortable. None of the browsers has mode setting in their dev tools.
  • Firefox only reads theme status from the operating system. There are some switcher extensions but they don’t work properly.
  • Chrome can be run with --force-dark-mode CLI param.
  • Opera here is the best. Choosing light/dark themes in browser will also change the prefers-color-scheme rendering in the fly.

On Common Misuse of the File Formats

A small rant about text file format holy wars. I believe that most of the file formats that participate in these holy wars are rather good and the most of the frustration comes from their misuse.
  • XML is a DOCUMENT language
  • JSON is a SERIALIZATION language
  • TOML and YAML are CONFIGURATION languages. TOML vs YAML holy war is out of scope of this post
XML is an awesome format for extensible documents. Like, you cannot do (X)HTML or SVG with JSON, also it’s namespacing features allow you to embed one type of document into another. However it’s a terrible serialization format, that’s why... show more

Fix AsciiDoc Display in Gitea

After installing my own Gitea I looked for the support for the markups I use.Gitea has support for external markup renderers and the official doc lists configs for both reStructuredText and AsciiDoc:

ENABLED = true
FILE_EXTENSIONS = .adoc,.asciidoc
RENDER_COMMAND = "asciidoctor --out-file=- -"
; Input is not a standard input but a file

ENABLED = true

RST works perfectly but AsciiDoc has two visible problems:
Image/PhotoGlitch on the top... show more

PHP 7.4: Splat Inconsistency

PHP 7.4 has this great new feature: splat operator now works in array expressions.

var_export([1,2,3, ...[4,5,6]]); // [1,2,3,4,5,6]

including when it is in the middle

var_export([1,2,3, ...[4,5,6], 7,8,9]); // [1,2,3,4,5,6,7,8,9]

Let’s have some variadic function


function sum(...$values)
return array_sum($values);


// PHP 5.6 - 7.4
echo sum(1,2,3, ...[4,5,6], 7,8,9); // PHP Fatal error: Cannot use positional argument after argument unpacking

of course there is a well-known workaround

echo sum(1,2,3, ...[4,5,6], ...[7,8,9]); // 45

and now also this

// PHP 7.4+
echo sum(...[1,2,3, ...[4,5,6], 7,8,9]); // 45

but why wasn’t the original behavior fixed as well?

Composer Yaml

My new library to allow composer to read config from YAML file. There is some demand in comments for composer config but the developers are not interestedand most 3rd party attempts to solve it are limited to yaml2json converters.

I tried a slightly different approach. There is a command in the composer itself that changes the way the config is read: composer global. During its execution it changes current working directory, resets composer state, and forces the composer to read config from another directory.

What I tried to do: I put yaml2json converter in place of global‘s directory changing code, and it seems it worked. Of course, some things got broken like any command that tries to change composer.json will no longer have any effect, however many people don’t use them and it may be an acceptable tradeoff for using yml-based config.

You can find the project on my new dev website:

Bitbucket to Remove Mercurial Support

So Mercurial lost its biggest hosting platform. Sad to see it because I always thought that it has much more usable CLIand much better branching system for corporate development than git.
After much consideration, we’ve decided to remove Mercurial support from Bitbucket Cloud and its API. Mercurial features and repositories will be officially removed from Bitbucket and its API on June 1, 2020.

PHP access private methods and fields

These two simple functions can come in handy as helpers for something like PsySH.PHP >= 7.0 is required.


Don’t use them in actual production code! That would be awful

Call private method of an object:

function call_private_method($object, string $method, ...$args)
return (function ($method, ...$args) {
return call_user_func_array([$this, $method], $args);
})->call($object, $method, ...$args);

Get private field of an object:

function get_private_field($object, string $field)
return (function ($field) {
return $this->$field;
})->call($object, $field);


class A
private $secret = 'SECRET234';

private function doStuff($whatever)
return $whatever . '!';

$a = new A;

get_private_field($a, 'secret'); // SECRET234

call_private_method($a, 'doStuff', 'whatever'); // whatever!

UPD: “Why not make a library out of it”, I thought. So it’s now a library:

Embracing CommonMark as the One True Markdown

As you may know, CommonMark is a project aiming to create unified and unambiguous Markdown syntax specification. So, I’m in. I want to spread the word and even use it in my own blog.

The trouble number one is that Jekyll uses kramdown by default. So we find a gem and the gem is jekyll-commonmark. Oh hell, we lost syntax highlighting :(

The trouble number two is that CommonMark standard lacks support for server side syntax highlighting. That’s bad, I don’t want any JavaScript on my static pages. Let’s try to wrap it somehow and enable syntax highligting.

The strong side of Ruby CommonMark implementation, CommonMarker is its ability to parse a document to the abstract syntax tree, so let’s use it to extract our blocks and highlight them with... show more

What Is Dead May Never Die

Let’s have some fun with theDrowned God andUnix signals.

This is a simple program that catches SIGINT and SIGTERM

#include <stdio.h> // for printf() && perror()
#include <stdlib.h> // for exit()
#include <signal.h> // for all the signal fun
#include <unistd.h> // for sleep()

* catch signals
void catch(int sig)
static int counter = 0;

// prevent exit by SIGINT and SIGTERM 3 times and then exit program
if (sig == SIGINT || sig == SIGTERM) {
if (counter < 3) {
printf("What is dea... show more
This entry was edited (10 months ago)

Farewell to Jekyll
Just ported the blog to Pelican and removed add Jekyll files. Currently it seems the most logical choice for me

First, I started to use reST much more extensively than Markdown and I want a blog generator that supports it better

Second is my new interest in Python

Third, Pelican seems to have much more features that I like compared to Jekyll and other static generators that I tested, especially Python ones (however Nikola also seems a good alternative but I had to stop at something)

journald-native and journald-logger transferred to the Foreman
Yesterday I moved two of my ruby gems, journald-native and journald-logger, to theforemanGitHub namepace. Developing them further is out of my current professional interest and hopefullythe Foreman project will be a good home for them.

It’s hard to say farewell however to the most popular library I created so far :D (8 GitHub stars, 57000 downloads)

Private Composer Repo with Gitlab and Satis
You can easily create your own composer repository using Satis and Gitlab. I will use global but it should be most useful for private corporate Gitlab installations. You will need CI and Pages

Our repo should contain only 2 files: satis.json and .gitlab-ci.yml

... show more

PhpStorm Advanced Metadata Exporter
As a Silex user I liked Pimple Container Dumper that worked with Silex Idea Plugin to enable code completion for Pimple DI in PhpStorm. But now with Silex EOL’d I have to move to Slim.

I’ve found no such projects so I had to write my own. Here it is: sandfoxme/phpstorm-metadata-export. It currently supports exporting data from Pimple and has 3 integration middlewares: for Slim, for Silex and for Psr-15 compatible frameworks.

P.S. Code completion support for ArrayAccess containers seem to be currently broken in PhpStorm (WI-33309, WI-35503). So I don’t currently recommend replacing Silex Idea Plugin with this library unless you use Pimple in Psr-11 compliant way (like Slim does by default)