Benki β†’ All Posts

β‡  previous page next page β‡’

A JavaScript rich text editor that stores blocks (paragraphs, images, etc.) in a structured way. Each block is an entry in a JSON list. Paragraphs contain HTML inline.It seems a bit strange to me to mix JSON with HTML given that HTML itself is a mark-up language for semi-structured data.

Embedding it in XML as a dialect would have felt more natural to me. Such an arrangement would have been especially useful when the desired output format is not HTML, but, say, TeX or Markdown.

Matthias #

How do I create smaller initramfs images on Ubuntu?

If you are running Ubuntu, your initramfs images may be quite large. On my system, for instance, each initramfs took up about 100 MiB of space. Because I did not pay enough attention when setting up the computer I ended up with a very small boot partition, which prompted me to look for a way to make the initramfs images generated by update-initramfs smaller.

Caution: Any of the below may make your system unbootable. Please only copy the steps if you understand what they do.

Step 1. Fewer kernel modules.

Create a file called, say, /etc/initramfs-tools/conf.d/zzz-custom (the exact name of the file does not matter much) and fill it with the following:

MODULES=dep

This causes mkinitramfs to guess the set of kernel modules required to boot your system based on what is currently loaded and what hardware is present instead of indiscriminately including whatever could be useful to make a computer boot.

This saved me about 50 MiB, reducing the size of the initramfs from 100 MiB to 50 MiB.

Step 2. No GPU.

Assuming you do not need to interact with the initramfs (to debug boot problems or to type in a disk encryption password, say), you can disable the scripts that deal with setting up a graphics frame buffer. Doing so gets rid of GPU firmware, which at least for the amdgpu driver is a pretty sizable amount of data.

Adding the following to /etc/initramfs-tools/conf.d/zzz-custom may or may not be good enough:

FRAMEBUFFER=n

In my case it was not good enough. Since I boot from ZFS, the /usr/share/initramfs-tools/conf-hooks.d/zfs hook was active, forcing FRAMEBUFFER to y regardless of what /etc/initramfs-tools/conf.d says.

But of course you can add your own configuration hook to /usr/share/initramfs-tools/conf-hooks.d. You just have to ensure it runs after the zfs one by giving it a lexicographically higher name. So create a file called /usr/share/initramfs-tools/conf-hooks.d/zzz-custom and fill it with the same content as above:

FRAMEBUFFER=n

As long as you do not need a disk encryption passphrase prompt in the initramfs, this should not break anything. If you do, it is probably a bad idea.

This saved me another 30 MiB, reducing the size of the initramfs from 50 MiB to 20 MiB.

A PC boot loader with support for ZFS boot environments.

One benefit over GRUB is that being Linux-based, it supports all ZFS pool features. (With GRUB you generally have to maintain a separate boot pool with a restricted feature set or else be very careful about which features you enable on your pool.)

A continuous profiler. Run it next to your production servers and visualize the data later.

Neo-reaction is mostly racist and chauvinist, but it is intellectually interesting because it raises a few good questions (not the least of which being how to deal with neo-reactionaries winning elections).

Lets you simulate the detonation of a nuclear war head in a location of your choice and estimate how bad it would be.

Try to make a guess before running the simulation and see how well it lines up with the result.

Matthias #

How do I access binary data using Vert.x-redis or Quarkus Redis Client?

Vert.x-redis provides the RedisAPI class to access most Redis functionality. The methods provided by RedisAPI only take Strings as arguments, which it encodes in UTF-8. With Quarkus you get to choose between RedisClient and ReactiveRedisClient, both of which mirror RedisAPI, again only containing String-based methods.

So how do you store binary strings?

With Vert.x-redis, use the send method on the Redis class, which is the lower-level interface underlying RedisAPI. Similarly, with Quarkus, instead of injecting a RedisClient or ReactiveRedisClient, inject the lower-level MutinyRedis:

@Inject
MutinyRedis mutinyRedis;

Uni<Void> set(String key, byte[] data) {
    return mutinyRedis
        .send(
            Request.cmd(Command.SET)
                .arg(key)
                .arg(data))
        .replaceWithVoid();
}

Uni<byte[]> get(String key) {
    return mutinyRedis
        .send(
            Request.cmd(Command.GET)
                .arg(key))
        .ifNotNull()
        .transform(Response::toBytes);
}

Racial justice, social justice, environmental justiceβ€”all good causes seem to be justice nowadays. Everything is a struggle between the condemned and the enforcers. Either you are an oppressor or you are one of the oppressed.

Is this a healthy way of looking at the world?

β‡  previous page next page β‡’