cryptocode

joined 1 year ago
MODERATOR OF
 

River is a dynamic tiling Wayland compositor written in Zig: https://isaacfreund.com/software/river/

Blog post about the River 0.3.0 and Waylock 1.0.0 update: https://isaacfreund.com/blog/river-0.3-waylock-1.0/

 

From the README:

Tiny and efficient rect packer. The algorithm is very similar to and is heavily inspired by rectpack2D and the blog post it's based on.

 

From the README:

ziglo is a Zig interface to liblo, an implementation of the Open Sound Control protocol. ziglo provides Zig types for liblo primitives and convenience functions for adding and querying message contents leveraging Zig’s comptime.

 

From the README:

Explore using a flex/yacc parser from zig to build a json Ast. The resulting json parser is able to parse complex json files such as twitter.json, build a std.json.Value Ast, and print it using std.json.stringify().

 

From the README:

A slightly cursed library for source-level static instrumentation in Zig.

This repository also includes a simple function-level profiler that outputs to the callgrind format, which is readable by KCacheGrind.

 

From the README:

This library creates bindings for accessing Javascript from within a WASM runtime

Calling Javascript functions from Zig is a pain. WASM has restrictions on the function API surface, and how references to the runtime environment (Javascript) can be stored. So to access Javascript functionality from Zig, you must create: a function in Zig which is friendly to call, a function export, and a function in Javascript which translates into the call you actually want.

This isn't too bad so far, but the Javascript API surface is large, has a lot of variadic functions, and accepts many types. The result is that your programming loop of just wanting to write code slows down writing a large amount of ill fitting boilerplate whenever you must cross the Zig to Javascript boundary.

This package is clearly inspired by Go's solution to this problem: https://pkg.go.dev/syscall/js

 

Work-in-progress Python 3.10 Interpreter written in Zig

 

A time library written in zig, licenced under MIT

 

Musa is a Wayland compositor with external window managers and first-class multiseat support. Musa is slowly approaching daily usability, but there's still a long way to a polished compositor.

Inspired by River

 

From the README:

zcrun

a simple linux container runtime built with zig

Features

  • namespaces:
    • isolate network, pid, mount, and uts namespace
  • cgroups:
    • support cgroups v2
    • limit memory, cpu, or pids (# of procs).
  • internet access inside containers using SNAT

Usage

[!NOTE] make sure that ip forwarding is enabled to be able to access the internet inside containers. run sysctl net.ipv4.ip_forward to check if it is enabled. if not, run sudo sysctl -w net.ipv4.ip_forward=1 to enable it.

[!Important] zcrun must be run as root

$ mkdir rootfs
# export container rootfs dir using docker
$ docker export $(docker create busybox) | tar -C rootfs -xvf -
# run the container using zcrun
# zcrun run <name>  <rootfs> <cmd>
$ zcrun run busybox rootfs   sh

Dependencies:

  • The iptables command.
  • Zig. This branch was tested using version 0.12.0-dev.3191+9cf28d1e9.
 

From the README:

A gap buffer is like a std.ArrayList, except that rather than having one contiguous block of items, there are two, with a moveable “gap” between them. Although moving the gap requires a copy, insertions and deletions at either side of the gap become O(1) operations.

This repository implements managed, unmanaged and optionally aligned versions of GapBuffer(T). The API is directly inspired by std.ArrayList. The main differences are “Before” and “After” versions of operations that operate or affect the gap—“Before” operations will add or remove elements before the gap. There are also convenience functions for translating a “logical” index into an offset, an element, or a pointer from the buffer, allowing the user to be largely agnostic about the location of the gap.

 

Additional cross-platform SIMD support for Zig.

Based loosely on Google Highway

view more: ‹ prev next ›