HNHacker News
TopNewBestAskShowJobs

motiejus

1,813 karma · joined February 13, 2012

See https://jakstys.lt for contact info.
submissionscomments
motiejus··on Squashfs binary format
I wrote undocker[1], which converts a docker "container" to a rootfs tarball. I really wish docker container format were documented as well as squashfs here. Surprising, given Docker Inc should have had enough resources to make their most important format well documented. :)

Anyway, undocker requires extracting the archive before using it. Squashfs wouldn't. Perhaps I will write a docker2squash, so we can mount and run these images immediately after download.

[1]: https://git.sr.ht/~motiejus/undocker

motiejus··on How I Built Zig-SQLite
I first tried rust in 2015[1]. It was my first serious attempt at rust.

The language was not small whatsoever at the time. It was not fun.

[1]: https://github.com/motiejus/makelua/tree/rust

motiejus··on SQLite 3 Fiddle
It makes sense to pre-compress the static assets. Then the server can load the compressed ones directly, without requiring to link to the compressor, and of course pay the price of online compression.

I create two extra files for each static file (for some extensions):

    file
    file.gz  <-- with zopfli
    file.br  <-- with brotli
And the web server, depending on the `Accept-Encoding` header, would serve the right file.

The wasm module:

    $ ls -lh fiddle-module.wasm*
    -rw-r--r-- 1 motiejus motiejus 779K May 26 15:25 fiddle-module.wasm
    -rw-r--r-- 1 motiejus motiejus 323K May 26 15:25 fiddle-module.wasm.br
    -rw-r--r-- 1 motiejus motiejus 357K May 26 18:00 fiddle-module.wasm.gz
motiejus··on How Uber Uses Zig
Some services span many many hosts (not sure I can say how many though). Not because they are inefficient; that's because it takes many cpus to do to support our trips/eaters/etc.

Most of the services benefit from speed/efficiency of Go: the more effective the language (runtime) is, the less we pay for hosting it, the cheaper the service to the customers.

Given that, the GC costs are still significant. Depends what you compare against.

motiejus··on How Uber Uses Zig
DNS. Looking.

Edit: not DNS. Starting a restart-in-a-loop for now. Thanks for flagging.

Will not take this down.

motiejus··on How Uber Uses Zig
We are though. Look for "Timeline of 2022 so far" for the current status, and what our production rollout plans for 2022 are.
motiejus··on How Uber Uses Zig
Good suggestion, though the title of my original talk (in the linked video) was even less assuming: "How Zig is used at Uber".

Will not change it now though, as this blog post is the last piece of this talk+announcement effort.

motiejus··on How Uber Uses Zig
Author here.

Took a while to get thumbs-up to publish the talk. Happy to answer questions, if any.

motiejus··on The new and upgraded Framework Laptop
Any photos of how the ethernet expansion card will look like while plugged in? Looks like it's bigger than the expansion slot.

I intend to keep it there permanently, which brings questions about durability, especially when carrying the laptop around.

motiejus··on Lessons learned from the recent job hunt
You said EU? Uber (my team) is hiring in Vilnius, if you are into Eastern Europe. I have been there for 6 years, can recommend.

Feel free to send me your CV (contact details in my profile), I'll comment or put it to our system.

motiejus··on Lenovo ThinkPad P1 Gen3 Review – with Linux
I am. I use it so much that I buy lenovo external keyboards for my workstation.

Much easier to move the cursor "half a screen" while typing without moving hands off the keyboard.

motiejus··on Mach v0.1: Cross-platform Zig graphics
Hi Stephen,

The initial example works for me. Truly impressive packaging you've achieved.

I tried to build for musl, but it still links with glibc; is musl supported, or am I doing it wrong?

  motiejus ~/code/mach/gpu $ zig build   -Dtarget=x86_64-linux-musl
  motiejus ~/code/mach/gpu $ ldd zig-out/bin/gpu-hello-triangle
        linux-vdso.so.1 (0x00007fff573a3000)
        libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f188c836000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f188c6f2000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f188c6d0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f188c50b000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f188c505000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f188c9a7000)
        libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f188c4da000)
        libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f188c4d3000)
        libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f188c2cd000)
        libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f188c2b6000)
        libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007f188c2a9000)
Also, I wasn't able to cross-compile to aarch64, because it does not seem to recognize `-Ddawn-from-source=true`, and I wasn't able to figure out where to put the `Options.from_source = true`:

  motiejus ~/code/mach/gpu $ zig build -Ddawn-from-source=true    -Dtarget=aarch64-linux-musl
  error: gpu-dawn binaries for aarch64-linux.3.16...5.10.81-gnu.2.19 not available.
  error: -> open an issue: https://github.com/hexops/mach/issues
  error: -> build from source (takes 5-15 minutes):
  error:        use -Ddawn-from-source=true or set `Options.from_source = true`

  error: the following build command failed with exit code 1:
  /home/motiejus/code/mach/gpu/zig-cache/o/a1cea9683aaa7b7e7a533b8f6e40e10f/build /home/motiejus/code/zig-linux-x86_64-0.10.0-dev.896+e620b692c/zig /home/motiejus/code/mach/gpu /home/motiejus/code/mach/gpu/zig-cache /home/motiejus/.cache/zig -Ddawn-from-source=true -Dtarget=aarch64-linux-musl
  motiejus ~/code/mach/gpu $
motiejus··on Ask HN: Should I publish my research code?
I highly recommend adding it. It doesn't have to be exposed, but is super useful for anyone who will want to reproduce or build upon your work later.

You can embed this to the PDF, e.g. see section A.1 [1] for how.

[1]: https://raw.githubusercontent.com/motiejus/wm/main/mj-msc-fu...

motiejus··on Ask HN: Why do new browsers use Chromium instead of Firefox as their base?
> 32mb RAM and 8mb Disk Space.

I miss such numbers so much.

motiejus··on Papers with Code
Links to external sites have a tendency to rot.

I've stumbled upon a number of scientific papers from 2000s that include links to sourceforge for code listings. Most of those are dead now.

Github will not be there for ever.

motiejus··on Papers with Code
I implemented Wang–Müller algorithm, described it, and embedded the code to the pdf, along with tooling how to generate the example diagrams of the paper (and the whole paper). Everything is in the pdf[1].

Arxiv.org won't accept a pdf with attachments though, so only a stripped-down version will come there (once/if I get an endorsement, fingers crossed).

I copied this concept from Joe Armstrong, where he suggested to distribute Erlang modules as PDFs with code files (*.erl) as attachments. "Documentation comes first, and the distribution should prioritize humans".

[1]: See Section A.1 of https://github.com/motiejus/wm/blob/main/mj-msc-full.pdf

motiejus··on Zig 0.9.0
Would Bellard's libunicode[1] work?

[1]: https://github.com/bellard/quickjs/blob/master/libunicode.h

motiejus··on Lithuania evacuates its embassy in China
I am Lithuanian; Lithuania<->Taiwan<->PRC conflict is frequently a topic of discussion these days among my peers.

My position, shared by a few others, is that this is the next best thing that happened in Lithuania after leaving USSR: the first being joining NATO and EU in 2004.

Everyone in the world can (and almost everyone do) endorse PRC. "You won't get fired for picking IBM/Oracle/PRC". While very few countries have the guts and the internal political structure that allows opening a Taiwanese representative office. Lithuania shows that it prefers dealing with a country that takes the human rights into account; being the first one "in the party" to do so bring us significant advantages. Both Taiwanese investments and Lithuanian exports to Taiwan are picking up pace.

This will hurt us in the short-term, sure. It already does: packages(/containers) from PRC are delayed or cancelled, invoices are not being paid, we are losing business there. In the long term, if we don't change our mind (not impossible), I think this is for the better.

motiejus··on Migrating from Docker to Podman
ProtectHostname will generate a new hostname for the service process hierarchy.

JoinsNamespaceOf can be used to set up network namespaces (albeit in a clunky way).

It is possible, but multiplexing networked services requires significantly more effort with systemd than with others. I do not have a strong use case yet to invest in tooling for it, but it may come.

motiejus··on Migrating from Docker to Podman
Undocker reads and writes tarballs. So yes.

Running them is a different story. I've never tried systemd user services, so can't tell. Curious myself. :)

motiejus··on Migrating from Docker to Podman
Nope, systemd doesn't have as advanced network namespace capabilities as docker. You'd need to do this via other means.
motiejus··on Migrating from Docker to Podman
I am planning to. :) It's going slowly though.

Have a look at these in systemd.exec[1]: PrivateUsers, DynamicUser, ProtectProc, RootDirectory.

There are more, but these are the main ones.

[1]: https://www.freedesktop.org/software/systemd/man/systemd.exe...

motiejus··on Migrating from Docker to Podman
I actually use systemd, not systemd-nspawn (it's also in the README), because using both does not always play together.

As far as systemd vs dockerd goes, dockerd provides a bit more isolation by default, but `systemd-analyze security` can guide you so far beyond the Docker defaults. And it is always compatible with system daemons, giving consistent configuration between, say, postgresql from package manager and prometheus from docker container+undocker.

motiejus··on Migrating from Docker to Podman
Shameless plug: I wrote undocker[1] to convert docker images to a rootfs tarball, so I can run them with plain systemd.

Goal: no more daemons to run 3rd party containers, systemd is good enough by now: resource limits, isolation, chroot, dynamic users, logging, and more.

Low-level tooling is done, I am now building ecosystem around it: easy installation, convert to deb/rpm, systemd units, etc.

[1]: https://sr.ht/~motiejus/undocker

motiejus··on Just how far can you travel by bus from London in 24 hours?
The booking fee is per booking, not per ticket (at least it was about a decade ago when I last did this route with megabus).

So technically the ticket price can be as close to £1 as you want it to be.

motiejus··on Turn your Android phone into SMS API gateway
I've been using this for a while now. It works so well I forgot about it, until I need it: then sms is in my (desktop) element instance.

This was a totally unexpected +1 when onboarding to matrix for personal use.

motiejus··on Bringing NetBSD to Zig's Continuous Integration
No, and I don't have plans to add it, though a contribution would be welcome.

It's a matter of writing a rule. Best follow Jay Conrod's "awesome bazel", IMO that gives enough in terms of documentation to make it happen.

motiejus··on Bringing NetBSD to Zig's Continuous Integration
Yes, it works for all cgo programs I have tried it with, including a shared library. There were a few workarounds I needed to apply, they are in "known issues" section.
motiejus··on Bringing NetBSD to Zig's Continuous Integration
Zig cross-compiler toolchain is fantastic: weighs ~40MB, includes clang-12, musl, glibc (v2.2-2.33, selectable).

I wrote a bazel toolchain on top of it, will blog about it sometime soon: https://sr.ht/~motiejus/bazel-zig-cc/

This gives me a hermetic C/C++ compiler for my cgo programs.

motiejus··on Syncthing-Fork – A Syncthing Wrapper for Android
I use this on my Android device. Besides showing the stanrdard synrhing ui, I like small extras like the "run conditions", where I can force to run it when I need to, even on battery AND lte.

This fork is an example of "here's a good thing (syncthing) with some features thought out with attention to detail".

I will pay for an iOS client that can sync pictures natively (I can pre-pay).

← PreviousPage 2 of 5Next →