Skip to content

January 2023#

Tuesday, 31#

Helix#

The softwrap / virtual text PR got merged today in the Helix project. Waiting on the persistent undo PR, then might give Helix a shot again (currently using Neovim).

Nix#

There are built-in functions in Nix and a standard library in Nixpkgs which make writing Nix code slightly easier.

NixOS#

Aight, done with the NixOS manual (phew!). This and the NixOS Wiki have been the best resources so far. Home Manager is next.

Monday, 30#

Neovim#

Here’s an example of setting up a Nix LSP server:

-- <...>
require("lspconfig").nil_ls.setup({
  capabilities = capabilities,
  on_attach = on_attach,
  settings = {
    ["nil"] = {
      formatting = {
        command = { "alejandra" },
      },
    },
  },
})
-- <...>

Nix#

You can install Nil (an LSP server) and Alejandra (a formatter) from source:

cargo install --git https://github.com/oxalica/nil nil
cargo install --git https://github.com/kamadorueda/alejandra

NixOS#

To enable SPICE integration for Linux QEMU guest system, add

services.spice-vdagentd.enable = true;

to your configuration.nix. This will install the spice-vdagent package as a dependency.

To get a list of installed packages, run

nix-store -qR /run/current-system

Sunday, 29#

libxev#

libxev is a cross-platform event loop written in Zig. An example on how to make a Zig library open to the C world.

The author would like to create a generalized event loop comparable to libuv. Ironically, I created the Zig bindings for the libuv library recently.

NixOS#

Looking into NixOS today (again). This might take a while…

I guess I will carry on with the NixOS manual (which propagates Nix channels), but I can already see Nix Flakes being recommended instead.

zig-gir-ffi#

The announced changes are live. Except for casting, that will be in a separate commit.

Saturday, 28#

FFmpeg#

Read “FFmpeg - The Ultimate Guide” today. It turned out to be pretty superficial material. They link to the wiki and the documentation, though, which I find as much better resources, so I guess the article is fine as a sort of introduction.

ffmpeg-static#

Build ffplay, too.

Just an FYI: I have lots of examples for building libraries statically in this repository.

GitHub Actions#

Here’s an example of checking for the event name:

if: github.event_name == 'workflow_dispatch'

mkdocs-section-index#

Ironically, got site builds breaking with the new version of mkdocs-material. Filed an issue.

Podman#

If you get any kind of “No space left on device” error while operating on a volume inside a container, try to delete the dangling volumes:

podman volume rm $(podman volume ls -f "dangling=true" -q)

Similarly, you can clean up dangling images:

podman rmi -f $(podman images -f "dangling=true" -q)

Tenacity#

Just wanted to check out the progress on Tenacity. Ended up in their Flatpak repo again, and I’m surprised I’ve never noticed that they build an OCI image to distribute the bundle, and they imitate a Flatpak repo using GitHub Pages. Pretty neat stuff, I might borrow the idea in the future.

zig-gir-ffi#

Documentation strings are done for methods and functions. Handling the array type seems to be a problem.

I still have the “Don’t Write Comments” video on my mind. I didn’t agree with it first, but for this project I’m leaning more towards restraining the amount of comments and documentation strings. The “Why, not what” advice is a good one, too.

Friday, 27#

Python-Markdown#

The SmartyPants extension converts ASCII dashes, quotes and ellipses to their HTML entity equivalents. Very handy.

Slav Art#

Just an FYI: you can download lossless music from Qobuz, Deezer, and Tidal for free using the Slav Art’s bot. Here’s an invite to their Revolt server called Divolt. Here’s an invite to their Discord server, which is used as a backup. You can also download music from Spotify, SoundCloud, YouTube Music, and JioSaavn, but in a lossy format.

Soulseek#

You can check out my music collection by searching for paveloom in a Soulseek client. I would recommend the Nicotine+ client.

Stoicism#

Pretty good quote from today’s Daily Stoic email:

Believe me, it is the sign of a great man, and one who is above human error, not to allow his time to be frittered away.

Seneca the Younger, “On the Shortness of Life”, 49 AD

Zig#

Makes sense to use std.mem.allocSentinel if you need a sentinel-terminated slice from an array allocation.

zig-gir-ffi#

Just a reminder: if you’re dealing with parsing XML using XPath, make sure you register the namespaces first. Here’s an example from the Perl bindings for libxml2. They also have pretty good examples for the XPath expressions.

Aight, the generation of callables is almost ready. Left to do:

  • Documentation strings;
  • Some types are not handled yet;
  • A dependency on the object of the same name;
  • Casting;
  • Perhaps, something else.

Also, I can see the design shaping: from and toString methods for all types. Gotta make it like that for the object generation source file, too.

Thursday, 26#

So it begins…

Neovim#

If you don’t want your windows resized after closing one, set

vim.opt.equalalways = false

in your config. I just did it because closing Neo-tree would resize everything.

Python-Markdown#

You can create or change an anchor by adding {#my-anchor} after a section or a link. Same as when using Zola, if I remember correctly. I use custom anchors for the sections on this page.

Zig#

Might want to consider using std.mem.sliceTo in the future instead of std.mem.span where applicable.

Also, it’s okay to not have a null terminator on a slice if you know the length anyway.

zig-gir-ffi#

Created a simple CLI. Had an almost ready commit from yesterday. Lazy to do more today.

g_irepository_get_default() causes “still reachable” memory leaks even though the program has exited after showing the help. That’s weird.

Next thing is object methods. Gonna move fields to a different function first, though. Also, probably should delete some cases from the main switch statement.