Benki โ†’ All Posts

โ‡  previous page next page โ‡ข

An alternative framework to build Haskell projects with Nix.

  • Can convert Cabal projects into Nix expressions automatically.
  • Can cross-compile Haskell programs for other architectures.
  • Can build statically linked binaries with musl libc.

Some actual (rather than imagined) challenges that Rust developers currently face, written up by a fan of the language.

Den Eindruck habe ich leider auch. Allerdings trifft die Aussage nicht nur auf Die LINKE zu, sondern auf das ganze linke Milieu, wie es in den politischen Institutionen bis hin zu den Universitรคten vertreten ist.

Eine echte Vertretung des Proletariats muรŸ man heutzutage รผber das gesamte politische Spektrum mit der Lupe suchen.

Matthias #

This website now has a search bar.

Since I am using PostgreSQL, which has a basic form of full text indexing built in, it was pretty easy to implement. You can find the implementation on Gerrit.

One interesting question was how to integrate a clause using the full-text search operator @@ into a Criteria query. I experimented a bit and found that if you define an IMMUTABLE function and use it in a query, PostgreSQL has no trouble inlining and optimizing it, so it’s a great way to call into PostgreSQL-specific functionality from within a Criteria query. For instance, it will make perfectly fine use of indices where possible:

mulkcms=# EXPLAIN
            SELECT cached_description_html 
              FROM benki.bookmark_texts
             WHERE post_matches_websearch(search_terms, 'en', 'test');

                        QUERY PLAN
---------------------------------------------------------------
 Bitmap Heap Scan on bookmark_texts
   Recheck Cond: (search_terms @@ '''test'''::tsquery)
   ->  Bitmap Index Scan on bookmark_texts_search_terms_idx
         Index Cond: (search_terms @@ '''test'''::tsquery)

Just as you expect from a high-quality database system.

A perf_events-based memory profiler for GNU/Linux. Works on AMD64 and ARM (among others) and is claimed to be very fast (hopefully much less overhead than Valgrind).

Related (another TEDx talk by the same person): Why renewables canโ€™t save the planet

Main points:

  • Nature sets a limit on how much you can do with wind turbines and solar panels (not to mention hydroelectric plants), as you do not have infinite land to build on.
  • The risks stemming from the possibility of nuclear power disasters are generally overstated. Far fewer people (and I mean several orders of magnitude fewer) have died from nuclear catastrophes than from air pollution; and even wind-energy-related accidents have killed more people per unit of energy up to this point.
  • While nuclear plants aren’t completely safe, renewable energy sources aren’t necessarily so either โ€“ starting from the hazards posed by wind turbines and continuing to the batteries needed to store highly fluctuating renewable energy.
  • The more land you need, the more of a problem it is for the environment. Wind turbines in particular are killing hundreds of thousands of birds and millions of bats every year. Solar plants need so much space that wildlife has to be cleared out, killing desert tortoises and other native creatures.
  • Similarly, while the waste from nuclear plants is really bad, the waste from used solar panels is pretty bad, too (lead and other heavy metals come to mind) and takes up more volume to boot.
Matthias #

How to run Docker in a Kubernetes pod powered by a Kata container:

  1. Make sure that you are running containerd >= 1.3.
  2. Configure containerd as described at Kata Containers as a Runtime Class in the Kata Containers documentation.
  3. Add privileged_without_host_devices = true to the [plugins.cri.containerd.runtimes.kata] section of containerd’s config.toml file. This ensures that privileged Kata containers can only access the guest VM managed by the Kata containers runtime and not also the host system.
  4. Create a Kubernetes pod running an ubuntu:20.04 container with securityContext: {privileged: true} set and runtimeClassName: kata. You may wish to double-check that host devices are really inaccessible (for example by checking whether the host’s root disk is visible in /dev) before you proceed.
  5. Enter the Kubernetes pod, install Docker by running apt update; apt install -y --no-install-recommends docker.io, and type dockerd --storage-driver=vfs. Docker should now be running.

If you are migrating an existing kubeadm-managed, Docker-based cluster to Containerd, see my post on how to migrate kubeadm to Containerd.

Matthias #

I have reconfigured the server running this web site. The Kubernetes cluster can now run pods in Kata containers.

My hope is that I can use the isolation that it provides to run docker-compose inside a pod, as I use certain software that ships with a docker-compose file, which up to now I have always had to laboriously translate into a set of native Kubernetes deployments each time a new version would come out.

We’ll see if it’s as easy as I am hoping.

Apparently, linear types are landing in GHC 9. Iโ€™m sure theyโ€™re useful for resource management. I wonder what else they might do that makes a difference in practice.

Takeaways:

  • Use collection types judiciously. They have overhead.
  • Look out for empty collections. They are pure overhead. Sometimes, null can be a good alternative.
  • Collection types have default sizes that are all over the place. Sometimes it can be worth specifying the capacity at instance creation time.
  • Objects come with overhead. Use primitives where you can.

Iโ€™m suddenly experiencing a craving for inline types and generics specialization

The specification of the .editorconfig file, which you can put into your source code repository to configure a wide range of text editors and IDEs with consistent style settings.

โ‡  previous page next page โ‡ข