avatar_url stringlengths 47 116 ⌀ | name stringlengths 1 46 | full_name stringlengths 7 60 | created_at stringdate 2016-04-01 08:17:56 2025-05-20 11:38:17 | description stringlengths 0 387 ⌀ | default_branch stringclasses 44
values | open_issues int64 0 4.93k | stargazers_count int64 0 78.2k | forks_count int64 0 3.09k | watchers_count int64 0 78.2k | tags_url stringlengths 0 94 | license stringclasses 27
values | topics listlengths 1 20 | size int64 0 4.82M | fork bool 2
classes | updated_at stringdate 2018-11-13 14:41:18 2025-05-22 08:23:54 | has_build_zig bool 2
classes | has_build_zig_zon bool 2
classes | zig_minimum_version stringclasses 50
values | repo_from stringclasses 3
values | dependencies listlengths 0 38 | readme_content stringlengths 0 437k | dependents listlengths 0 21 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
https://avatars.githubusercontent.com/u/565124?v=4 | w4-8x8-fill-patterns | peterhellberg/w4-8x8-fill-patterns | 2024-07-06T21:16:50Z | https://assets.c7.se/games/w4-8x8-fill-patterns/ | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/peterhellberg/w4-8x8-fill-patterns/tags | CC0-1.0 | [
"fantasy-console",
"wasm4",
"zig"
] | 42 | false | 2025-03-04T13:38:53Z | true | true | unknown | github | [
{
"commit": "refs",
"name": "w4",
"tar_url": "https://github.com/peterhellberg/w4/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/peterhellberg/w4"
}
] | w4-8x8-fill-patterns :bucket:
A <code>.wasm</code> cart for use in <a>WASM-4</a> written
in <a>Zig</a> :zap:
<a>https://assets.c7.se/games/w4-8x8-fill-patterns</a>
<blockquote>
[!Note]
Based on patterns found at <a>8x8.me</a>
</blockquote>
Usage
| Key | |
|---------------------:|----------------------------------------|
| <strong>Z</strong> | Next palette
| <strong>X</strong> | Invert colors
| <strong>Up/Down</strong> | Switch “gallery”
| <strong>Left/Right</strong> | Switch “pattern” in current “gallery”
| <strong>Held Left Mouse</strong> | Show zoomed in “pattern”
| <strong>Held Right Mouse</strong> | Clear background
Development
File watcher can be started by calling:
<code>sh
zig build spy</code>
Running the cart in WASM-4:
<code>sh
zig build run</code>
Deploy:
<code>make deploy</code>
Tools
<code>bitsy-to-w4-sprites</code>
A small Go program that converts the <code>*.bitsy.txt</code> files from <a>8x8.me</a>
into Zig :zap: files compatible with <a>w4</a>.
```sh
ACE_DENT_8X8="/home/peter/Code/GitHub/ace-dent/8x8.me"
OUT_DIR="/home/peter/Code/w4/w4-8x8-fill-patterns/src/patterns"
mkdir -p $OUT_DIR
cat $ACE_DENT_8X8/01-Dither/Dither.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Dither.zig
cat $ACE_DENT_8X8/02-Dots/Dots.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Dots.zig
cat $ACE_DENT_8X8/03-Dashes/Dashes.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Dashes.zig
cat $ACE_DENT_8X8/04-Lines/Lines.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Lines.zig
cat $ACE_DENT_8X8/05-Waves/Waves.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Waves.zig
cat $ACE_DENT_8X8/06-Grid/Grid.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Grid.zig
cat $ACE_DENT_8X8/07-Checked/Checked.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Checked.zig
cat $ACE_DENT_8X8/08-Rectilinear/Rectilinear.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Rectilinear.zig
cat $ACE_DENT_8X8/09-Radial/Radial.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Radial.zig
cat $ACE_DENT_8X8/10-Round/Round.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Round.zig
cat $ACE_DENT_8X8/11-Woven/Woven.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Woven.zig
cat $ACE_DENT_8X8/12-Architecture/Architecture.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Architecture.zig
cat $ACE_DENT_8X8/13-Nature/Nature.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Nature.zig
cat $ACE_DENT_8X8/14-Symbols/Symbols.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Symbols.zig
cat $ACE_DENT_8X8/15-Other/Other.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Other.zig
``` | [] |
https://avatars.githubusercontent.com/u/9393486?v=4 | tarn | tomcur/tarn | 2024-05-01T10:23:14Z | [mirror] River layout generators | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/tomcur/tarn/tags | GPL-3.0 | [
"riverwm",
"wayland",
"wayland-compositor",
"zig"
] | 92 | false | 2024-12-29T10:52:55Z | true | true | 0.13.0 | github | [
{
"commit": "bd8afd256fb6beed7d72e3580b00f33dea7155a1.tar.gz",
"name": "zig-wayland",
"tar_url": "https://codeberg.org/ifreund/zig-wayland/archive/bd8afd256fb6beed7d72e3580b00f33dea7155a1.tar.gz.tar.gz",
"type": "remote",
"url": "https://codeberg.org/ifreund/zig-wayland"
}
] | Tarn
Tarn is a collection of <a>River</a> layout
generators (currently N=1).
Included layouts
<ul>
<li>tarn-dwindle: a dwindling layout with horizontal and vertical dwindle ratios
specifiably separately</li>
</ul>
Usage
Tarn provides separate binaries for each layout.
<code>bash
$ tarn-dwindle -h</code>
tarn-dwindle
You can send layout commands to update the Dwindle layout ratios, for example:
<code>bash
riverctl map normal Super+Control H send-layout-cmd tarn-dwindle "horizontal-ratio -0.05"
riverctl map normal Super+Control J send-layout-cmd tarn-dwindle "vertical-ratio +0.05"
riverctl map normal Super+Control K send-layout-cmd tarn-dwindle "vertical-ratio -0.05"
riverctl map normal Super+Control L send-layout-cmd tarn-dwindle "horizontal-ratio +0.05"</code>
Installing
Using Nix
<code>bash
$ nix build git+https://codeberg.org/tomcur/tarn.git</code>
You can use the provided flake to install Tarn in a flake-based NixOS configuration. For example:
<code>nix
{
description = "Your system config";
inputs = {
# ..
tarn = {
url = "git+https://codeberg.org/tomcur/tarn.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, tarn, ... }: {
nixosConfigurations = {
yourSystem =
let
system = "x86_64-linux";
modules = [
{
nixpkgs.overlays = [
(self: super: {
tarn = tarn.packages.${system}.default;
})
]
}
];
in
nixpkgs.lib.nixosSystem {
inherit system modules;
};
};
};
}</code> | [] |
https://avatars.githubusercontent.com/u/71920313?v=4 | runit.zig | MidstallSoftware/runit.zig | 2024-02-11T22:48:23Z | Runit packaged in Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/MidstallSoftware/runit.zig/tags | BSD-3-Clause | [
"runit",
"zig"
] | 8 | false | 2024-02-12T00:42:53Z | true | true | unknown | github | [
{
"commit": null,
"name": "runit",
"tar_url": null,
"type": "remote",
"url": "http://smarden.org/runit/runit-2.1.2.tar.gz"
}
] | runit.zig
Runit packaged in Zig | [] |
https://avatars.githubusercontent.com/u/130914459?v=4 | lvm3 | smercer10/lvm3 | 2024-07-20T07:31:51Z | Lightweight LC-3 virtual machine. | main | 0 | 0 | 1 | 0 | https://api.github.com/repos/smercer10/lvm3/tags | MIT | [
"lc3",
"linux",
"vm",
"zig"
] | 59 | false | 2024-07-30T16:14:35Z | true | false | unknown | github | [] | LVM-3
LVM-3 is a virtual machine (VM) that implements the <a>LC-3 architecture</a> and can be used to run LC-3 programs on modern computers. The VM currently only supports Linux, but it can be easily ported to other operating systems with minor API changes.
<a></a>
<a></a>
Usage
<code>bash
lvm3 <path to program file></code>
The VM expects files that have been written in LC-3 assembly and preassembled into machine code.
Two examples have been provided in the <code>programs</code> directory (credit to <a>Ryan Pendleton</a> and <a>Justin Meiners</a>).
Build Locally
Prerequisites
<ul>
<li>Linux</li>
<li>Zig nightly build</li>
</ul>
Commands
<ul>
<li>Build the executable:</li>
</ul>
<code>bash
zig build</code>
<ul>
<li>Build and run the executable:</li>
</ul>
<code>bash
zig build run -- <path to program file></code>
<ul>
<li>Run the tests:</li>
</ul>
<code>bash
zig build test</code> | [] |
https://avatars.githubusercontent.com/u/156404?v=4 | learnopengl-sokol-zig | Angluca/learnopengl-sokol-zig | 2024-03-02T06:16:33Z | Examples from learnopengl.com, implemented using sokol-zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Angluca/learnopengl-sokol-zig/tags | - | [
"sokol",
"zig"
] | 7 | false | 2024-03-02T06:44:05Z | true | true | 0.12.0 | github | [
{
"commit": "e77e89a2067fafa3505fb3056b0ce9bfa3b52943.tar.gz",
"name": "sokol",
"tar_url": "https://github.com/floooh/sokol-zig/archive/e77e89a2067fafa3505fb3056b0ce9bfa3b52943.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/floooh/sokol-zig"
}
] | learnopengl-sokol-zig
<strong>Unofficial</strong> cross platform examples for <a>learnopengl.com</a> and <a>learnopengl-sokol-c</a>
<a>Live Demos</a>
How to Build
```zsh
download sokol-shdc and set sokol_tools_bin_dir
<blockquote>
git clone https://github.com/floooh/sokol-tools-bin.git
git clone https://github.com/Angluca/learnopengl-sokol-zig.git
cd learnopengl-sokol-zig
zig build shaders
zig build
</blockquote>
or
<blockquote>
zig build quad
...
```
</blockquote> | [] |
https://avatars.githubusercontent.com/u/39483951?v=4 | miso | FranciscoLlobet/miso | 2024-05-09T12:52:56Z | MISO v2 | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/FranciscoLlobet/miso/tags | MIT | [
"freertos",
"iot",
"mqtt",
"zig"
] | 18,789 | false | 2025-05-03T13:24:10Z | true | true | 0.11.0 | github | [
{
"commit": null,
"name": "board",
"tar_url": null,
"type": "relative",
"url": "c"
},
{
"commit": null,
"name": "fatfs",
"tar_url": null,
"type": "relative",
"url": "c/FatFs"
},
{
"commit": null,
"name": "simplelink",
"tar_url": null,
"type": "relative... | miso | [] |
https://avatars.githubusercontent.com/u/6332937?v=4 | zigMemMapper | SuSonicTH/zigMemMapper | 2024-08-06T23:01:08Z | Cross platform memory mapped files | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/SuSonicTH/zigMemMapper/tags | MIT | [
"cross-platform",
"library",
"memorymappedfile",
"mmap",
"mmapped",
"windows",
"zig"
] | 22 | false | 2024-12-24T21:46:26Z | true | true | 0.13.0 | github | [] | zig MemMapper
a cross platform (windows and posix) zig library for memory mapped files.
It's a very thin wraper around the operating system functions to map a file into the virtual address space. | [] |
https://avatars.githubusercontent.com/u/1356248?v=4 | zargunaught | srjilarious/zargunaught | 2024-04-20T14:17:40Z | Zig argument parsing library, based on my C++ argunaught library | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/srjilarious/zargunaught/tags | MIT | [
"zig",
"zig-package"
] | 507 | false | 2025-03-12T22:10:21Z | true | true | 0.14.0 | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/11298551?v=4 | ember | eyzi/ember | 2024-04-05T08:12:15Z | media byte reader | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/eyzi/ember/tags | MPL-2.0 | [
"image",
"media",
"sound",
"zig"
] | 124 | false | 2024-04-07T05:44:47Z | true | true | unknown | github | [] | Ember
Media Byte Reader
Usage
<ol>
<li>
Add to build.zig.zon:
<code>.{
.dependencies = .{
.ember = .{
.url = "https://github.com/eyzi/ember/archive/2b83332d5bc5ab259d3064c25e6b90eded9f3dad.tar.gz",
.hash = "12202221a4415efd2186a651add316c5247d2ecc6dbac55e43a30658c833075dabe1",
},
},
}</code>
</li>
<li>
Add module to your exe in build.zig
<code>const ember_dep = b.dependency("ember", .{
.target = target,
.optimize = optimize,
});
exe.addModule("ember", ember_dep.module("ember"));</code>
</li>
<li>
Import in code
<code>const ember = @import("ember");</code>
</li>
</ol>
Image
<code>const image: ember.types.EmberImage = try ember.load_image(.BMP, "assets/images/icon.bmp", allocator);
defer image.deallocate(allocator);</code>
<code>ember.types.EmberImage</code> has the following structure:
<code>{
meta: {
file: [:0]const u8, // filepath
bytes: []u8, // raw file content
},
format: EmberImageFormat,
width: u32,
height: u32,
pixels: []{
red: u8,
green: u8,
blue: u8,
alpha: u8,
},
}</code>
Sound
<code>const sound: ember.types.EmberSound = try ember.load_sound(.WAV, "assets/sounds/completion.wav", allocator);
defer sound.deallocate(allocator);</code>
<code>ember.types.EmberSound</code> has the following structure:
<code>{
meta: {
file: [:0]const u8, // filepath
bytes: []u8, // raw file content
},
format: EmberSoundFormat,
n_channels: u16,
sample_rate: u32,
bit_depth: u16,
data_size: usize,
samples: []u8,
}</code>
3d
<code>const model: ember.types.Ember3d = try ember.load_3d(.OBJ, "assets/models/cube.obj", allocator);
defer model.deallocate(allocator);</code>
<code>ember.types.Ember3d</code> has the following structure:
<code>{
meta: {
file: [:0]const u8, // filepath
bytes: []u8, // raw file content
},
format: Ember3dFormat,
vertices: []@Vector(3, f32),
uvs: []@Vector(2, f32),
normals: []@Vector(3, f32),
indices: []@Vector(3, u32),
}</code>
Raw Bytes
<code>const bytes: []u8 = try ember.load(filepath, allocator);
defer allocator.free(bytes);</code> | [] |
https://avatars.githubusercontent.com/u/2828351?v=4 | dizzy | bcrist/dizzy | 2024-03-26T01:04:14Z | Zig Comptime Dependency Injection | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/bcrist/dizzy/tags | MIT | [
"dependency-injection",
"zig",
"zig-library",
"zig-package",
"ziglang"
] | 11 | false | 2025-02-14T02:38:15Z | true | true | 0.14.0-dev.3217+5b9b5e45c | github | [] | Dizzy
Function Parameter Dependency Injection for Zig
See test.zig for example usage. | [
"https://github.com/bcrist/shittip",
"https://github.com/neurocyte/flow"
] |
https://avatars.githubusercontent.com/u/2828351?v=4 | zkittle | bcrist/zkittle | 2024-05-10T23:40:05Z | A little Zig template engine | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/bcrist/zkittle/tags | MIT | [
"file-format",
"template",
"template-engine",
"templates",
"vscode-extension",
"zig",
"zig-library",
"zig-package",
"ziglang"
] | 192 | false | 2025-02-14T02:34:30Z | true | true | 0.14.0-dev.3217+5b9b5e45c | github | [
{
"commit": "e39301c1d36b3a2aa98a8c7c8e5fa2eaddfd1000",
"name": "console_helper",
"tar_url": "https://github.com/bcrist/zig-consolehelper/archive/e39301c1d36b3a2aa98a8c7c8e5fa2eaddfd1000.tar.gz",
"type": "remote",
"url": "https://github.com/bcrist/zig-consolehelper"
},
{
"commit": "5bb61... | Zkittle
A basic templating language for Zig programs.
The name is pronounced like "skittle," not "zee kittle".
Syntax
<code>A template always starts with "literal" text.
i.e. text that will just be included in the final document verbatim.
You can add data to your templates by surrounding a \\command block// with double slashes.
Whitespace inside command blocks is ignored, and it's legal to have an empty \\// command block.
\\ $ If a command block contains a $, then //
everything else in that command block is considered a comment.
\\$ If there is no // to close a block on the same line, it ends at the end of the line.
\\$ The final newline character is not included in the output document in this case.
\\$ Since comments end at the end of their containing command block, they are also at most one line.
Templates are evaluated using a "data context", which is usually a struct value.
The \\identifiers// in the command block reference fields of the data struct.
You can reference nested data structures the same way you would in Zig: \\ parent_field.child_field //
Individual elements of "collections" (arrays and slices) are accessed with '.': \\ some_array.0 //
Optionals are treated as a collection of size 0 or 1.
The length of a collection can be printed with: \\ some_array.# //
Accessing an out-of-bounds element is allowed; it becomes a void value (printing it is a no-op).
Tagged union fields can be accessed the same way as structs, but only the active field will resolve
to actual data; inactive fields will resolve to void.
Values of type void are considered a special 'nil' value. This includes accessing a struct field
that doesn't exist, an enum or union tag that isn't active (or doesn't exist), or a collection index
that's out of bounds, as well as data explicitly declared to have a type of `void` or
`@TypeOf(undefined)`. All values have a \\value.@exists// pseudo-field which converts the value to
a bool, where nil becomes false, and anything else becomes true.
The special \\*// syntax represents the whole data context (similar to the "this" or "self" pointer in
some programming languages). It can be useful when the current data context is not a struct, union,
or collection.
Identifiers that aren't qualified by '^' can reference a field in the current context, or the first
parent context that has a non-nil value for the field. This is useful because sometimes a template
is designed to be imported, but you don't know if it will be inside a "within" block. You can
explicitly search only the current context by using \\*.field// instead of \\field//.
You can "push" a new data context with the ':' operator (a.k.a "within").
This can be useful if you want to access multiple fields of a deeply nested struct.
For example, instead of:
First Name: \\phonebook.z.ziggleman.0.first//
Last Name: \\phonebook.z.ziggleman.0.last//
Phone Number: \\phonebook.z.ziggleman.0.phone//
we could instead write:
\\ phonebook.z.ziggleman.0:
First Name: \\first//
Last Name: \\last//
Phone Number: \\phone//
\\ ~
Note that the sequence does not end at the end of the command block, so that it can include
literal text easily. Instead, the ~ character ends the region.
When the data selected by a "within" block is a collection, the sequence will be evaluated once
for each item in the collection. You can print the current index with the \\@index// syntax. When
not inside a "within" region, nothing will be output. You can access the entire collection
instead of an individual item with \\ ^* //. You can access the "outer" data context with \\ ^^* //.
(note this also works when the within block isn't a collection)
If you have nested "within" blocks, the '^' prefixes can be chained as needed.
The conditional '?' operator only evaluates its subsequent region when its data value is "truthy,"
but it does not push a new data context:
\\ should_render_section? // whatever \\ ~
Boolean false, the number zero, and empty collections (including void-like values) are considered
falsey; all other values are truthy.
Both ':' and '?' regions may contain a ';' before the '~' to create an "otherwise" region.
This region will only be evaluated if the first region is not evaluated. e.g.
\\ has_full_name ? full_name ; first_name last_name ~ //
\\x / y// is mostly equivalent to \\x? x ; y ~// except that the former can be used as an
expression, while the latter always just prints x or y. Similarly \\x | y// is corresponds to
\\x.@exists? x ; y ~// in the same way.
Application-specific extensions can be added by adding functions to the data context. These
functions will be passed the writer, escape functions, and the root data context, as well as
a list of any parameters from the template. Calling a function from a template looks like
this: \\ :my_func param1 param2 param3 // Note that ":" is used for both function calls and
"within" blocks. In order to be treated as a function call, it must be followed immediately
by a non-whitespace character.
By default all strings will be printed with an HTML escape function.
This can be overridden or disabled in code when generating other types of documents.
You can also disable it for a specific expression with \\ @raw some_value //.
An alternative escaping function can be used for specific expressions with \\ @url some_value //.
By default, this will escape using percent encoding; suitable for embedding arbitrary data in URLs.
Within command blocks, you can use string literals, wrapped in double quotes, anywhere an
expression is expected. Note that no escape sequences are supported; the string literal simply
ends as soon as the next double quote is seen, so string literals can never contain a double
quote. Often string literals are functionally equivalent to closing the command block and
opening another immediately after:
\\ "Hellorld!" //Hellorld!\\
\\ $ but string literals also let you do things like:
\\ @raw "<table>" $ prevent escaping of HTML tags
\\ :func "asdf" $ pass literals to a function
String literals can also be used to access fields with names that aren't valid zkittle identifiers.
This only works when used after the "." or `^` operators:
\\ something."has weird fields"."and even recursive ones"
\\ *."I am in the current context"
\\ ^^"I'm in the parent context"
The \\ @include "path/to/template" // syntax can be used to pull the entire content of another
template into the current one.
Note that this happens at compile time, not at runtime (the template source is provided to the
template parser by a callback).
The \\ @resource "whatever" // syntax works similarly to @include, but instead of interpreting
the data returned by the callback as template source,
it treats it as a raw literal to be printed.
Sometimes you may want to render only a part of a template in some cases. To facilitate this,
you can define a \\ #fragment_name // to refer to part of the template, ending with the \\~//
operator. This doesn't affect how the overall template is rendered, but allows you to access
the sub-template by name from code. See https://htmx.org/essays/template-fragments/ for more
information about how this technique might be useful.
</code> | [
"https://github.com/bcrist/shittip"
] |
https://avatars.githubusercontent.com/u/160516989?v=4 | lumi | Lumi-Engine/lumi | 2024-02-19T16:06:29Z | The main Lumi engine repo | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Lumi-Engine/lumi/tags | BSD-3-Clause | [
"gamedev",
"gamedev-framework",
"gamedev-library",
"gamedevelopment",
"zig",
"zig-lang",
"zig-language",
"zig-lib",
"zig-library",
"zig-package",
"zig-programming-language",
"ziglang"
] | 68 | false | 2024-02-19T16:09:57Z | true | true | unknown | github | [
{
"commit": "63da35e57c3695a787b927e69e4140eb74ffc234",
"name": "mach_glfw",
"tar_url": "https://github.com/hexops/mach-glfw/archive/63da35e57c3695a787b927e69e4140eb74ffc234.tar.gz",
"type": "remote",
"url": "https://github.com/hexops/mach-glfw"
}
] |
Lumi Engine is a 2D game engine which aims to provide a performant, flexible and easy game development environment. | [] |
https://avatars.githubusercontent.com/u/145858033?v=4 | Zig-binding-GLFW-OpemGL-tutorial | weige258/Zig-binding-GLFW-OpemGL-tutorial | 2024-08-02T06:11:21Z | A Zig tutorial teach you how to binding GLFW and OpenGL Zig语言绑定GLFW和OpenGL教程 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/weige258/Zig-binding-GLFW-OpemGL-tutorial/tags | - | [
"binding-zig",
"glfw",
"glfw-bindings",
"glfw-opengl-library",
"glfw3",
"opengl",
"zig",
"ziglang"
] | 2,490 | false | 2024-08-02T13:01:45Z | true | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/57729459?v=4 | zig-cpp-build | simonthorell/zig-cpp-build | 2024-05-29T14:57:23Z | Simple demo of how do use zig's build tool to cross-compile C/C++ code to several architectures in a short script. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/simonthorell/zig-cpp-build/tags | - | [
"c",
"cpp",
"zig"
] | 5 | false | 2024-09-10T17:06:17Z | false | false | unknown | github | [] | Zig C/C++ Build Dev Template | [] |
https://avatars.githubusercontent.com/u/22800416?v=4 | ziggtk | mrwormhole/ziggtk | 2024-06-22T18:33:01Z | GTK samples in Zig | main | 2 | 0 | 0 | 0 | https://api.github.com/repos/mrwormhole/ziggtk/tags | - | [
"gtk3",
"gtk4",
"samples",
"zig"
] | 18,380 | true | 2024-12-25T01:59:52Z | true | false | unknown | github | [] | ZIG GTK
<blockquote>
<span class="bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300">IMPORTANT</span>
Works with zig version 0.13.0 and may not work in older versions.
</blockquote>
Main branch
Sample "hello world" GTK4 applications in <a>zig</a>. Based on the examples at <a>GTK4 Getting Started</a>
There are three applications:
<ol>
<li>manual: uses the in-code method of defining the UI</li>
<li>builder: uses the 'window.ui' file to define the UI.</li>
<li>embedded: uses the 'window.ui' file to define the UI, but embeds the text into the application at compile time,</li>
</ol>
GTK3 branch
Same examples as above but with <a>GTK3</a>
Build
Ensure gtk4 is installed as system dependency.
<code>zig build
</code>
Run
<code>zig build manual
zig build builder
zig build embedded
</code> | [] |
https://avatars.githubusercontent.com/u/36203422?v=4 | learning-zig | alaminkouser/learning-zig | 2024-04-24T17:38:46Z | A repo to take note for learning zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/alaminkouser/learning-zig/tags | MIT | [
"zig",
"zig-lang",
"zig-language"
] | 6 | false | 2024-04-24T18:35:13Z | false | false | unknown | github | [] | learning-zig
I am a web developer. I mostly work with html, css, and js. I used to write C programs about 6 years ago. It is always interesting for me to learn a new language. Recently, I decided to learn a new programming language alongside my law studies and part-time programming. I was struggling to choose the right programming language.
I am not seeking a language with high demand in the market. I just want to learn something which is fast. That is why I have chosen to learn Zig.
This repo will be used as my notebook for learning the Zig language. There are not enough Zig learning resources online. I do not know if this will even help anyone or not, but I will just write my thoughts and what I struggled with in the Zig language. | [] |
https://avatars.githubusercontent.com/u/88917554?v=4 | zos | mkashirin/zos | 2024-06-03T22:26:30Z | Elementary OS kernel snippet written in the Zig programming language that can be run on x86 microarchitecture with QEMU. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/mkashirin/zos/tags | - | [
"kernel",
"os",
"systemsprogramming",
"x86",
"zig"
] | 15 | false | 2025-03-24T20:30:34Z | true | true | unknown | github | [] | ZOS
ZOS is an elementary OS kernel snippet written in the Zig programming language
that can be run on x86 microarchitecture with QEMU. | [] |
https://avatars.githubusercontent.com/u/77886027?v=4 | game-dev | patrickm663/game-dev | 2024-02-11T11:09:48Z | A monorepo for small game dev projects. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/patrickm663/game-dev/tags | MIT | [
"gamedev",
"zig",
"zig-lang"
] | 2,206 | false | 2024-02-15T14:25:54Z | false | false | unknown | github | [] | game-dev
A monorepo for small game dev projects.
Game development is an excellent way to learn programming and how I first started. I want to use game development as a means to grow my programming capabilities, solve interesting problems, and widen my skillset.
Goals
<ol>
<li>Networking is something I've never fully explored, so I'm hoping to build multiplayer capabilities into some of these games to cement the fundamentals.</li>
<li>I've been wanting to build something with graphics, preferably from first-principles where possible. I've done a bit with frameworks like Lua's LOVE2D and Julia's GameZero.jl, but never SDL or Raylib.</li>
<li>I've heard of devs building small parsers for their text-based games, that could be cool to implement and learn more about.</li>
<li>AI/ML-wise, I haven't really looked at reinforcement learning and did some min-max tic-tac-toe stuff a while back, so it will be interesting to see different ways to write AIs.</li>
<li>As a means to make games web-based, WASM would be cool to compile to and explore more.</li>
</ol>
Usage
Enter the sub-directories for more info and specific instructions.
Languages
Currently, whichever I am learning at the time! It will likely be a combination of Julia, Lua, D, and Zig (see Zig-Zag-Zoe for my first real "project" using the language).
License
Everything here is MIT licensed. In the future, specific artwork and such for graphical games may have specific CC-based licenses. | [] |
https://avatars.githubusercontent.com/u/163546630?v=4 | hello-world | zon-dev/hello-world | 2024-04-06T13:38:42Z | Build the most basic zig package. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/zon-dev/hello-world/tags | MIT | [
"zig",
"ziglang"
] | 11 | true | 2024-04-06T14:35:13Z | true | true | unknown | github | [] | Zig Module for hello_world.
Synopsis
```zig
const std = @import("std");
const hello = @import("hello_world");
test "Hello, World!" {
try std.testing.expectEqualStrings("Hello, World!", hello.hello_world());
}
```
Usage
Use <code>zig fetch</code> to add this library to build.zig.zon
<code>$zig fetch --save https://github.com/zon-dev/hello-world/archive/refs/tags/0.0.1.tar.gz</code>
And add this to you build.zig.zon
<code>// This is an example of how to add a dependency on another target.
const hello_world = b.dependency("hello_world", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("hello_world", hello_world.module("hello_world"));</code>
You can then import the library into your code and use it like below.
```
const std = @import("std");
const hello_world = @import("hello_world");
pub fn main() !void {
std.debug.print("{?s}\n", .{hello_world.hello_world()});
}
``` | [] |
https://avatars.githubusercontent.com/u/170934839?v=4 | hololang | Ang3lERR404/hololang | 2024-06-07T21:37:17Z | A new semi-toy programming language written in zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Ang3lERR404/hololang/tags | GPL-3.0 | [
"programming-language",
"programming-language-development",
"zig"
] | 24 | false | 2024-06-17T23:11:37Z | false | false | unknown | github | [] | This project is a semi-toy/non-toy programming language written in <a>Zig</a>
the purpose of this semi-serious programming language is... undefined\
it is more so a learning project to try and make both, an interpreter and a compiler.
Building from Source
To build this form source, all you'd need to do is:
<code>batch
git clone https://www.github.com/Ang3lERR404/hololang
cd ./hololang
zig build-exe main.zig</code>
Contributing
Since this is a learning project and a semi-serious project, I'd appreciate collabs, pointers..
Or anything you may think is helpful, and when it comes to actually using the language\
issues will also be open.
this project compiles with version <strong>0.13.0</strong> and will be upgraded with every new stable version released of the zig programming language. | [] |
https://avatars.githubusercontent.com/u/12129065?v=4 | wasm_parser | shailpatels/wasm_parser | 2024-06-05T00:24:16Z | Webassembly parser in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/shailpatels/wasm_parser/tags | MIT | [
"wasm",
"wasm2wat",
"webassembly",
"zig"
] | 17 | false | 2024-09-08T19:00:12Z | true | true | 0.13.0 | github | [] | wasm_parser
A work in progress web assembly parser
Building
Install <a>zig</a>, version >= 0.14.0-dev.1403+28383d4d9
Then run
<code>zig build</code> | [] |
https://avatars.githubusercontent.com/u/38223894?v=4 | echo-server-zig | lpg2709/echo-server-zig | 2024-03-28T15:56:54Z | Simple TCP echo server write in Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/lpg2709/echo-server-zig/tags | MIT | [
"echo-server",
"example",
"tcp-server",
"zig",
"zig-language",
"ziglang"
] | 7 | false | 2025-03-07T11:06:45Z | true | false | unknown | github | [] | echo-server-zig
Simple TCP echo server write in <a>Zig 0.14.0</a>
<strong>Note:</strong>
<code>Because Zig is not yet finalized, there are a lot of changes in the standard
library, for this reason I locked this example in version 0.14.0 of the language</code>
You can see changes between versions by comparing branches.
<blockquote>
Each new version of Zig is separated by branches.
</blockquote>
Usage
To build and run:
<code>sh
zig build run</code>
Test the code:
<code>sh
zig test src/main.zig</code>
<blockquote>
<a>Zig 0.14.0</a> required!
</blockquote>
Compare versions
You can see what change on evrey zig version using github compare tool:
<ul>
<li><a>https://github.com/lpg2709/echo-server-zig/compare</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/52572989?v=4 | zig-time | Protonull/zig-time | 2024-05-13T23:27:57Z | zig-time but with Zig packaging | master | 0 | 0 | 1 | 0 | https://api.github.com/repos/Protonull/zig-time/tags | MIT | [
"zig",
"zig-library",
"zig-package"
] | 87 | true | 2025-01-18T09:42:16Z | true | true | 0.12.0 | github | [
{
"commit": "3dcc531937b58d787e183c25bad535c91bab1f7d",
"name": "zig_extras",
"tar_url": "https://github.com/nektro/zig-extras/archive/3dcc531937b58d787e183c25bad535c91bab1f7d.tar.gz",
"type": "remote",
"url": "https://github.com/nektro/zig-extras"
}
] | zig-time
This is a fork of <a>zig-time</a> that's uses Zig's native packaging instead of
<a>zigmod</a>.
Usage
Add this repository to your <code>build.zig.zon</code>, eg:
<code>zon
// build.zig.zon
.{
.name = "awesome-project",
.version = "0.1.0",
.minimum_zig_version = "0.12.0",
.paths = .{ "" },
.dependencies = .{
.zig_time = .{
.url = "git+https://github.com/Protonull/zig-time#<COMMIT HASH>",
.hash = "<HASH>" // Comment this out Zig will automatically tell you what has to use.
},
},
}</code>
After that, add the dependency to your build script, eg:
```zig
// build.zig
const std = @import("std");
pub fn build(
b: *std.Build
) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
<code>const exe = b.addExecutable(.{
.name = "awesome-project",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
// zig-time dependency goes here
exe.root_module.addImport("zig-time", b.dependency("zig_time", .{}).module("time"));
b.installArtifact(exe);
</code>
}
```
You may notice there's <code>zig-time</code>, <code>zig_time</code>, and <code>time</code>.
<ul>
<li><code>zig-time</code> is what you'd use as the import, like so: <code>const time = @import("zig-time")</code></li>
<li><code>zig_time</code> is the key to match in <code>build.zig.zon</code>, which doesn't like dashes.</li>
<li><code>time</code> is the name of the exported module from zig-time, the library itself.</li>
</ul> | [
"https://github.com/deatil/zig-say"
] |
https://avatars.githubusercontent.com/u/61843100?v=4 | Ziglings-solutions | WestDragonIroh/Ziglings-solutions | 2024-03-14T14:56:39Z | My ziglings solution | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/WestDragonIroh/Ziglings-solutions/tags | MIT | [
"zig"
] | 254 | false | 2024-07-05T18:02:12Z | true | false | unknown | github | [] | Ziglings
⚠️ Ziglings has moved from GitHub to Codeberg!
You are looking at the current Ziglings repo if you are viewing
this at https://codeberg.org/ziglings/exercises/
You can also use the handy URL https://ziglings.org to get here!
Welcome to Ziglings! This project contains a series of tiny
broken programs (and one nasty surprise). By fixing them, you'll
learn how to read and write <a>Zig</a> code.
Those broken programs need your help! (You'll also save the
planet from evil aliens and help some friendly elephants stick
together, which is very sweet of you.)
This project was directly inspired by the brilliant and fun
<a>rustlings</a>
project for the <a>Rust</a> language.
Indirect inspiration comes from <a>Ruby Koans</a>
and the Little LISPer/Little Schemer series of books.
Intended Audience
This will probably be difficult if you've <em>never</em> programmed
before. But no specific programming experience is required. And
in particular, you are <em>not</em> expected to have any prior
experience with "systems programming" or a "systems" level
language such as C.
Each exercise is self-contained and self-explained. However,
you're encouraged to also check out these Zig language resources
for more detail:
<ul>
<li>https://ziglang.org/learn/</li>
<li>https://ziglearn.org/</li>
<li>https://ziglang.org/documentation/master/</li>
<li><a>Zig in Depth! (video series)</a></li>
</ul>
Also, the <a>Zig community</a>
is incredibly friendly and helpful!
Getting Started
Install a <a>development build</a> of
the Zig compiler. (See the "master" section of the downloads
page.)
Verify the installation and build number of <code>zig</code> like so:
<code>$ zig version
0.12.0-dev.xxxx+xxxxxxxxx</code>
Clone this repository with Git:
<code>$ git clone https://ziglings.org
$ cd ziglings.org</code>
Then run <code>zig build</code> and follow the instructions to begin!
<code>$ zig build</code>
Note: The output of Ziglings is the unaltered output from the Zig
compiler. Part of the purpose of Ziglings is to acclimate you to
reading these.
A Note About Versions
<strong>Hint:</strong> To check out Ziglings for a stable release of Zig, you can use
the appropriate tag.
The Zig language is under very active development. In order to be
current, Ziglings tracks <strong>development</strong> builds of the Zig
compiler rather than versioned <strong>release</strong> builds. The last
stable release was <code>0.11.0</code>, but Ziglings needs a dev build with
pre-release version "0.12.0" and a build number at least as high
as that shown in the example version check above.
It is likely that you'll download a build which is <em>greater</em> than
the minimum.
Once you have a build of the Zig compiler that works with
Ziglings, they'll continue to work together. But keep in mind
that if you update one, you may need to also update the other.
Version Changes
Version-0.12.0-dev.2043
* <em>2024-01-05</em> zig 0.12.0-dev.2043 - rename of <code>std.Build.FileSource</code> to <code>std.Build.LazyPath</code> - see<a>#16353</a>
* <em>2023-10-24</em> zig 0.12.0-dev.1243 - changes in <code>std.ChildProcess</code>: renamed exec to run - see<a>#5853</a>
* <em>2023-06-26</em> zig 0.11.0-dev.4246 - changes in compile step (now it can be null)
* <em>2023-06-26</em> zig 0.11.0-dev.3853 - removal of destination type from all cast builtins
* <em>2023-06-20</em> zig 0.11.0-dev.3747 - <code>@enumToInt</code> is now <code>@intFromEnum</code> and <code>@intToFloat</code> is now <code>@floatFromInt</code>
* <em>2023-05-25</em> zig 0.11.0-dev.3295 - <code>std.debug.TTY</code> is now <code>std.io.tty</code>
* <em>2023-04-30</em> zig 0.11.0-dev.2704 - use of the new <code>std.Build.ExecutableOptions.link_libc</code> field
* <em>2023-04-12</em> zig 0.11.0-dev.2560 - changes in <code>std.Build</code> - remove run() and install()
* <em>2023-04-07</em> zig 0.11.0-dev.2401 - fixes of the new build system - see <a>#212</a>
* <em>2023-02-21</em> zig 0.11.0-dev.2157 - changes in <code>build system</code> - new: parallel processing of the build steps
* <em>2023-02-21</em> zig 0.11.0-dev.1711 - changes in <code>for loops</code> - new: Multi-Object For-Loops + Struct-of-Arrays
* <em>2023-02-12</em> zig 0.11.0-dev.1638 - changes in <code>std.Build</code> cache_root now returns a directory struct
* <em>2023-02-04</em> zig 0.11.0-dev.1568 - changes in <code>std.Build</code> (combine <code>std.build</code> and <code>std.build.Builder</code> into <code>std.Build</code>)
* <em>2023-01-14</em> zig 0.11.0-dev.1302 - changes in <code>@addWithOverflow</code> (now returns a tuple) and <code>@typeInfo</code>; temporary disabled async functionality
* <em>2022-09-09</em> zig 0.10.0-dev.3978 - change in <code>NativeTargetInfo.detect</code> in build
* <em>2022-09-06</em> zig 0.10.0-dev.3880 - Ex 074 correctly fails again: comptime array len
* <em>2022-08-29</em> zig 0.10.0-dev.3685 - <code>@typeName()</code> output change, stage1 req. for async
* <em>2022-07-31</em> zig 0.10.0-dev.3385 - std lib string <code>fmt()</code> option changes
* <em>2022-03-19</em> zig 0.10.0-dev.1427 - method for getting sentinel of type changed
* <em>2021-12-20</em> zig 0.9.0-dev.2025 - <code>c_void</code> is now <code>anyopaque</code>
* <em>2021-06-14</em> zig 0.9.0-dev.137 - std.build.Id <code>.Custom</code> is now <code>.custom</code>
* <em>2021-04-21</em> zig 0.8.0-dev.1983 - std.fmt.format() <code>any</code> format string required
* <em>2021-02-12</em> zig 0.8.0-dev.1065 - std.fmt.format() <code>s</code> (string) format string required
Advanced Usage
It can be handy to check just a single exercise:
<code>zig build -Dn=19</code>
You can also run without checking for correctness:
<code>zig build -Dn=19 test</code>
Or skip the build system entirely and interact directly with the
compiler if you're into that sort of thing:
<code>zig run exercises/001_hello.zig</code>
Calling all wizards: To prepare an executable for debugging,
install it to zig-cache/bin with:
<code>zig build -Dn=19 install</code>
To get a list of all possible options, run:
```
zig build -Dn=19 -l
install Install 019_functions2.zig to prefix path
uninstall Uninstall 019_functions2.zig from prefix path
test Run 019_functions2.zig without checking output
...
```
What's Covered
The primary goal for Ziglings is to cover the core Zig language.
It would be nice to cover the Standard Library as well, but this
is currently challenging because the stdlib is evolving even
faster than the core language (and that's saying something!).
Not only would stdlib coverage change very rapidly, some
exercises might even cease to be relevant entirely.
Having said that, there are some stdlib features that are
probably here to stay or are so important to understand that they
are worth the extra effort to keep current.
Conspicuously absent from Ziglings are a lot of string
manipulation exercises. This is because Zig itself largely avoids
dealing with strings. Hopefully there will be an obvious way to
address this in the future. The Ziglings crew loves strings!
Zig Core Language
<ul>
<li>[x] Hello world (main needs to be public)</li>
<li>[x] Importing standard library</li>
<li>[x] Assignment</li>
<li>[x] Arrays</li>
<li>[x] Strings</li>
<li>[x] If</li>
<li>[x] While</li>
<li>[x] For</li>
<li>[x] Functions</li>
<li>[x] Errors (error/try/catch/if-else-err)</li>
<li>[x] Defer (and errdefer)</li>
<li>[x] Switch</li>
<li>[x] Unreachable</li>
<li>[x] Enums</li>
<li>[x] Structs</li>
<li>[x] Pointers</li>
<li>[x] Optionals</li>
<li>[x] Struct methods</li>
<li>[x] Slices</li>
<li>[x] Many-item pointers</li>
<li>[x] Unions</li>
<li>[x] Numeric types (integers, floats)</li>
<li>[x] Labelled blocks and loops</li>
<li>[x] Loops as expressions</li>
<li>[x] Builtins</li>
<li>[x] Inline loops</li>
<li>[x] Comptime</li>
<li>[x] Sentinel termination</li>
<li>[x] Quoted identifiers @""</li>
<li>[x] Anonymous structs/tuples/lists</li>
<li>[ ] Async <--- ironically awaiting upstream Zig updates</li>
<li>[X] Interfaces</li>
<li>[X] Bit manipulation</li>
<li>[X] Working with C</li>
<li>[ ] Interfaces part 2</li>
</ul>
Zig Standard Library
<ul>
<li>[X] String formatting</li>
<li>[X] Testing</li>
<li>[X] Tokenization</li>
</ul>
Contributing
Contributions are very welcome! I'm writing this to teach myself
and to create the learning resource I wished for. There will be
tons of room for improvement:
<ul>
<li>Wording of explanations</li>
<li>Idiomatic usage of Zig</li>
<li>Additional exercises</li>
</ul>
Please see <a>CONTRIBUTING</a>
in this repo for the full details. | [] |
https://avatars.githubusercontent.com/u/15135669?v=4 | tcx-extract | alhankeser/tcx-extract | 2024-03-06T06:38:57Z | Speed-optimized data extractor for .tcx (Garmin) files. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/alhankeser/tcx-extract/tags | MIT | [
"data-extraction",
"garmin",
"python",
"tcx",
"zig",
"ziglang"
] | 1,826 | false | 2024-03-11T20:57:30Z | false | false | unknown | github | [] | TCX Extractor
A speed-optimized data extractor for .tcx (Garmin) files.
Table of Contents
<ul>
<li><a>Installation</a></li>
<li><a>Usage</a></li>
<li><a>Support</a></li>
</ul>
Installation
Can be installed using:
<code>bash
pip install tcx-extract</code>
Then run this once to build the Zig executable:
<code>python
import tcx_extract as tcx
tcx.build_zig()</code>
Usage
```python
import tcx_extract as tcx
watts = tcx.extract(filepath="example.tcx", tag_name="ns3:Watts")
print(watts)
Output:
['402', '380', '304'...]
<code>``
- By default, an item for every</code><code>will be included in the resulting Python list.
-</code>filepath<code>path to the .tcx file to extract from.
-</code>tag_name` tag to get value from.
- Nested or multiple tags are not currently supported.
Support
Please <a>create an issue</a> if you're having an issue or have questions. | [] |
https://avatars.githubusercontent.com/u/64859?v=4 | cmsketch.zig | nesv/cmsketch.zig | 2024-03-09T07:27:53Z | Count-min sketch data structures, in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/nesv/cmsketch.zig/tags | MPL-2.0 | [
"count-min-sketch",
"zig"
] | 11 | false | 2024-03-09T07:49:36Z | true | true | unknown | github | [] | cmsketch.zig
An implementation of the <a>count-min sketch</a> data structures.
Estimator
An <code>Estimator</code> can be used to count the occurrences of different keys:
```zig
const testing = @import("std").testing;
test {
var est = Estimator.init();
try testing.expect(est.increment("foo", 1) == 1);
try testing.expect(est.incrementBy("bar", 17) == 17);
try testing.expect(est.get("foo") == 1);
try testing.expect(est.get("bar") == 17);
}
```
Rate
A <code>Rate</code> can be used to count the estimated occurrences of keys within a given
time interval.
```zig
const testing = @import("std").testing;
test {
// Initialize a new Rate, with the given time interval in milliseconds.
// Here, we are using a 1h interval.
var rate = Rate.init(3600000);
// You can observe the number of events for a given key.
try testing.expect(rate.observe("foo", 70) == 70);
try testing.expect(rate.observe("foo", 70) == 140);
// ...after an hour, the time window for the observed events will
// have elapsed, and the number of observations would be reset.
try testing.expect(rate.get("foo") == 0);
}
```
Shout-outs
The code in this package was ported from/inspired by <a>ryanfowler/limits</a>. | [] |
https://avatars.githubusercontent.com/u/17238289?v=4 | zig-turret | xLPMG/zig-turret | 2024-03-18T19:40:01Z | 2D turret defense game | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/xLPMG/zig-turret/tags | - | [
"2d-game",
"defense-game",
"game-development",
"raylib",
"raylib-zig",
"shooter",
"shooter-game",
"shooter-mini-game",
"turret",
"zig",
"ziglang"
] | 10,938 | false | 2024-04-29T16:24:44Z | true | true | unknown | github | [
{
"commit": "5.0.tar.gz",
"name": "raylib",
"tar_url": "https://github.com/raysan5/raylib/archive/5.0.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/raysan5/raylib"
}
] | zig-turret
... is a 2D turret defense game I made in order to learn <code>zig</code>. For the graphics and audio I used raylib.
The goal is to shoot all enemies that come flying towards you. Once they manage to come close,
they will explode and inflict damage. You must try to survive as long as possible by killing them first.
Each kill will reward you with cash which you can use to become stronger by upgrading your skills.
Controls
| Key(s) | Function |
| ------ | ------------- |
| <code>A</code> | rotates your turret counter-clockwise |
| <code>D</code> | rotates your turret clockwise |
| <code>SPACE</code> | shoots projectiles. You may keep it pressed for continuous shooting |
| <code>1</code> to <code>5</code> | can be used to upgrade skills. The GUI will show you which key corresponds to which stat |
| <code>H</code> | toggle scope: a red line will appear that predicts the path of your bullet. Use it if you need to practice hitting enemies |
| <code>J</code> | toggles color mode |
| <code>K</code> | toggles auto-fire |
Demo
https://github.com/xLPMG/zig-turret/assets/17238289/4bafb6d2-18b7-4640-b2e4-f9c16c931da2
Make sure to check out the sound effects as well!
Stats
You may have noticed the stats system. Each time you kill an enemy, you will receive cash.
If you have enough for an upgrade, the GUI will provide you with the option to upgrade a specific stat
of your turret by pressing the respective key.
Deployment
If you wish to build the binaries yourself, install zig and then run the build script using <code>zig build run</code> from within the top folder. | [] |
https://avatars.githubusercontent.com/u/15676482?v=4 | zargs | siniarskimar/zargs | 2024-05-30T10:44:35Z | zig command line argument parser | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/siniarskimar/zargs/tags | MIT | [
"cmd",
"zig"
] | 13 | false | 2024-06-02T08:55:02Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/2251232?v=4 | zeika | Chukobyte/zeika | 2024-04-29T11:42:09Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Chukobyte/zeika/tags | - | [
"gamedev",
"zig"
] | 10,047 | false | 2024-06-14T02:37:03Z | true | true | 0.13.0 | github | [] | Zeika
A zig wrapper around the <a>seika</a> game framework and its dependencies. | [
"https://github.com/Chukobyte/zig-game"
] |
https://avatars.githubusercontent.com/u/55508637?v=4 | zchess | apesteguia/zchess | 2024-05-20T12:07:21Z | Chess game written in Zig. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/apesteguia/zchess/tags | - | [
"chess",
"zig"
] | 14 | false | 2024-06-02T22:27:29Z | true | true | unknown | github | [
{
"commit": "devel.tar.gz",
"name": "raylib-zig",
"tar_url": "https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/Not-Nik/raylib-zig"
}
] | 404 | [] |
https://avatars.githubusercontent.com/u/9247261?v=4 | weird-js | UstymUkhman/weird-js | 2024-08-01T06:26:59Z | "JavaScript Is Weird (EXTREME EDITION)" algorithm written in Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/UstymUkhman/weird-js/tags | MIT | [
"javascript",
"wasm",
"weird",
"zig"
] | 44 | false | 2024-08-01T06:42:55Z | true | true | unknown | github | [] | Weird JS
<a>JavaScript Is Weird (EXTREME EDITION)</a> algorithm written in Zig (for learning purposes) and exposed on the web via WASM.
Download
<code>bash
git clone https://github.com/UstymUkhman/weird-js.git
cd weird-js</code>
Develop
```bash
CMD:
./build.sh
This script optionally accepts 2 arguments,
JS code to compile and an output file name:
./build.sh "console.log('Hi!')" out
Run:
node ./zig-out/out.js
Web:
bun i
bun dev
```
Build
<code>bash
bun run build
bun run preview</code> | [] |
https://avatars.githubusercontent.com/u/134087466?v=4 | Z6502 | C0ttonplant/Z6502 | 2024-03-10T21:47:09Z | A 6502 emulator written in zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/C0ttonplant/Z6502/tags | GPL-3.0 | [
"assembly",
"emulator",
"zig"
] | 157 | false | 2025-05-06T18:00:25Z | true | false | unknown | github | [] |
A 6502 emulator written in zig.
<ul>
<li>immediatly builds, no setup required</li>
<li>supports most illegal opCodes</li>
<li>does not support unstable opCodes</li>
<li>decimal mode working</li>
<li>works with zig version 0.13.0 and 0.14.0</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/11803493?v=4 | glizp | elton2048/glizp | 2024-08-07T07:00:38Z | Lisp interpreter in zig; Learning purpose mainly | main | 5 | 0 | 0 | 0 | https://api.github.com/repos/elton2048/glizp/tags | - | [
"learning",
"lisp",
"zig"
] | 164 | false | 2025-05-20T11:04:10Z | true | true | unknown | github | [
{
"commit": "0fda1215eb5f7bbdf6d910f93fd5cc69980b8438.tar.gz",
"name": "logz",
"tar_url": "https://github.com/karlseguin/log.zig/archive/0fda1215eb5f7bbdf6d910f93fd5cc69980b8438.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/karlseguin/log.zig"
},
{
"commit": null,
"nam... | Lisp Interpreter in zig
Build script
<code>sh
zig build</code>
Note
Zig requires manual memory management, some memory are required to be freed for better main program and test cases, noticeably the following items
- ArrayList (by <code>arrayList.deinit()</code>)
- Slice from ArrayList (Could be <code>allocator.free(SLICE)</code>, by then the array list is not required to be freed. If it is not wrapped in allocator some manual way shall be used.)
Patch note
The <a>regex library</a> used requires patch in order to support non-capturing group for tokenization process. Please refer to https://github.com/elton2048/zig-regex/tree/feat-complex-group-support
Another fix for allowing repeat tokens shows as follow:
In <code>src/regex.zig</code>
<code>pub fn isByteClass(re: *const Expr) bool {
switch (re.*) {
.Literal,
.ByteClass,
.AnyCharNotNL,
// TODO: Don't keep capture here, but allow on repeat operators.
.Capture,
+ .Repeat,
=> return true,
else => return false,
}
}</code> | [] |
https://avatars.githubusercontent.com/u/85673341?v=4 | zmath | coderloff/zmath | 2024-06-19T17:15:36Z | A very simple math library for Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/coderloff/zmath/tags | MIT | [
"math",
"math-library",
"zig"
] | 8 | false | 2024-06-22T14:07:25Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/30747832?v=4 | mach_demo | AClon314/mach_demo | 2024-06-23T08:26:35Z | mach v0.3: triangle... | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/AClon314/mach_demo/tags | - | [
"mach",
"zig"
] | 4 | false | 2024-06-23T08:27:20Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/317609?v=4 | zig-p11 | geek0x23/zig-p11 | 2024-04-16T02:30:51Z | A playground for me to learn Zig by wrapping PKCS#11 | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/geek0x23/zig-p11/tags | MIT | [
"cryptography",
"module",
"pkcs11",
"zig"
] | 166 | false | 2024-06-14T01:52:41Z | true | true | unknown | github | [
{
"commit": "master",
"name": "pkcs11",
"tar_url": "https://github.com/p11-glue/p11-kit/releases/download/0.25.3/p11-kit-0.25.3.tar.xz/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/p11-glue/p11-kit/releases/download/0.25.3/p11-kit-0.25.3.tar.xz"
}
] | zig-p11
This project is a Zig module for PKCS#11. PKCS#11 is wrapped with a thin layer that brings the interface closer to idiomatic Zig.
For now this exists for me to play around and learn zig while doing something more productive than just a simple "Hello, World!" application. Maybe someday this library will be usable, but probably not.
Testing
When testing, the project will attempt load <a>p11-kit</a> from <code>/lib64/p11-kit-proxy.so</code>. This is because Zig's <code>std.DynLib.open</code> doesn't support searching system paths.
I've shipped a script (<code>run-tests.sh</code>) which supports running tests against <a>NSS</a> and <a>SoftHSM</a>. This script will take over <code>~/.config/pkcs11</code> and <code>~/.config/softhsm2</code> and store specific configuration files there. | [] |
https://avatars.githubusercontent.com/u/69104965?v=4 | Adventures-Raylib | doccaico/Adventures-Raylib | 2024-07-31T13:42:49Z | Adventures with Raylib in Zig (Ziglang) | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/doccaico/Adventures-Raylib/tags | - | [
"raylib",
"zig",
"ziglang"
] | 16 | false | 2025-01-28T15:58:21Z | true | true | unknown | github | [
{
"commit": "refs",
"name": "raylib",
"tar_url": "https://github.com/raysan5/raylib/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/raysan5/raylib"
}
] | Adventures with Raylib in Zig (Ziglang)
Demo
<ul>
<li><a>Mugen Eyes</a></li>
<li><a>Atsu Grains</a></li>
<li><a>Sim Sim</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/70961231?v=4 | cyzig | smekuria1/cyzig | 2024-06-14T02:42:30Z | A small, fast and dynamicly typed scripting language written in Zig. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/smekuria1/cyzig/tags | - | [
"interpreter",
"monkey-programming-language",
"zig"
] | 226 | false | 2024-11-16T21:30:20Z | true | true | unknown | github | [] | Cyzig
A small, fast and dynamically typed scripting language written in Zig. Inspired by WAIIG by Thorsten Ball
Features
<ul>
<li>Functions</li>
<li>Higher-order functions</li>
<li>Closures</li>
<li>Integers and Arithmetic</li>
<li>Booleans</li>
<li>Builtins</li>
<li>len</li>
<li>rest</li>
<li>push</li>
<li>Dynamic Arrays</li>
</ul>
Installation
Build Cyzig with Zig(I hope to track master but currently works with 0.14.0-dev.1511+54b668f8a)
<code>bash
zig build</code>
Running Cyzig
Run REPL
<code>bash
cyzig</code>
Interpret File
<code>bash
cyzig [fileName]</code> | [] |
https://avatars.githubusercontent.com/u/3594035?v=4 | zig-devshell | tsunaminoai/zig-devshell | 2024-04-04T18:26:47Z | Zig Devshell | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/tsunaminoai/zig-devshell/tags | MIT | [
"flake",
"nix",
"zig"
] | 6 | false | 2025-01-23T02:42:59Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/63153493?v=4 | zcloc | muthhukumar/zcloc | 2024-07-09T03:58:21Z | Count lines of code using zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/muthhukumar/zcloc/tags | - | [
"zig",
"ziglang"
] | 10 | false | 2024-07-12T16:04:56Z | true | true | unknown | github | [] | zig build && mv ./zig-out/bin/zcloc | [] |
https://avatars.githubusercontent.com/u/28928944?v=4 | zyup | knightpp/zyup | 2024-05-15T13:31:21Z | zig yarn upgrade | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/knightpp/zyup/tags | MIT | [
"npm",
"yarn",
"zig"
] | 12 | false | 2024-07-20T09:35:40Z | true | true | unknown | github | [] | zyup - Zig Yarn UPgrade
Why
I started learning Zig and wanted to code something in it. It was fun.
What does it do
yarn by default won't touch <code>package.json</code> file when upgrading dependencies, it will only change
yarn.lock file. But <code>yarn upgrade dep-name@^</code> changes <code>package.json</code>. One downside, you cannot
upgrade all deps like that, so here helps zyup.
How to use
<code>shell
$ zig build
$ ./zig-out/bin/zyup 'path to package.json'</code>
License
MIT | [] |
https://avatars.githubusercontent.com/u/1533514?v=4 | case.zig | ubermanu/case.zig | 2024-06-18T20:55:48Z | Convert ASCII string to a different case | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/ubermanu/case.zig/tags | MIT | [
"case",
"zig"
] | 14 | false | 2025-03-15T21:52:58Z | true | true | 0.14.0 | github | [] | case.zig
A set of functions to change the case of a string.
Install
<code>sh
zig fetch --save git+https://github.com/ubermanu/case.zig</code>
<code>zig
const case_mod = b.dependency("case", .{});
exe.addImport("case", case_mod.module("case"));</code>
Usage
```zig
const case = @import("case");
test {
const allocator = std.testing.allocator;
<code>const str = try case.toPascalCase(allocator, "Some string");
defer allocator.free(str);
try std.testing.expectEqualStrings("SomeString", str);
</code>
}
``` | [] |
https://avatars.githubusercontent.com/u/2828351?v=4 | shittip | bcrist/shittip | 2024-03-30T23:44:17Z | Another shitty HTTP server | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/bcrist/shittip/tags | MIT | [
"http",
"http-server",
"server",
"zig",
"zig-library",
"zig-package",
"ziglang"
] | 167 | false | 2025-02-14T02:43:54Z | true | true | 0.14.0-dev.1694+3b465ebec | github | [
{
"commit": "058f6331d499e81df7b58858e7307543d5484404",
"name": "Temp_Allocator",
"tar_url": "https://github.com/bcrist/zig-tempallocator/archive/058f6331d499e81df7b58858e7307543d5484404.tar.gz",
"type": "remote",
"url": "https://github.com/bcrist/zig-tempallocator"
},
{
"commit": "3fcba... | SHITTIP
A shitty HTTP server | [] |
https://avatars.githubusercontent.com/u/116330012?v=4 | DirectXShaderCompiler-zig | sinnwrig/DirectXShaderCompiler-zig | 2024-07-10T00:05:38Z | Fork of Microsoft/DirectXShaderCompiler built with Zig and including Zig / MinGW compatability patches from hexops/DirectXShaderCompiler | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/sinnwrig/DirectXShaderCompiler-zig/tags | NOASSERTION | [
"compiler",
"cpp",
"directx",
"directx-11",
"directx-12",
"shaders",
"zig",
"ziglang"
] | 68,826 | true | 2024-10-23T06:23:58Z | true | true | unknown | github | [
{
"commit": null,
"name": "SPIRV-Tools",
"tar_url": null,
"type": "relative",
"url": "external/SPIRV-Tools"
}
] | DirectX Shader Compiler built with Zig
Overview
This repository is a fork of Microsoft's <a>DirectXShaderCompiler</a> modified to allow cross-platform and static building powered by Zig's build system. Zig enables <em>DXC</em> to be built in a much more straightforward way, by combining several cross-platform compiler toolchains into one buildsystem powered by a single build language.
Much to all of the work needed to do this was made possible by the <a>Mach Engine</a> and their own fork of <a>DXC</a> and <a>DXC Built with Zig</a>, which fixes several annoying quirks that make <em>DXC</em> difficult to compile as a static or dynamic library for Windows, Linux, and MacOS. In fact, this repository still relies on several external libraries that have been modified to work with Zig, provided by Stephen Gutekanst (the creator of mach-dxcompiler) and the folks at Hexops.
Differences from microsoft/DirectXShaderCompiler
As a result of the wonderful work by the people behind <em>mach-dxcompiler</em>, DXC can now be built for multiple platforms using Zig as its build-system (See Stephen Gutekanst's <a>'Building the DirectX shader compiler better than Microsoft?'</a> for details on what they do different). Some of the biggest differences are a removal of the dependency on <em>dxil.dll</em>, a proprietry code-signing blob, and changes to make <em>DXC</em> correctly work as a static library.
Differences between <em>mach-dxcompiler</em> and <em>DirectXShaderCompiler</em>:
- Add support for building a statically linked dxcompiler library and dxc executables.
- Removal of dependency on proprietary dxil.dll code-signing blob (see: <a>Mach Siegbert Vogt DXCSA</a>)
- Additional support for macOS and aarch64 Linux binaries.
- Addition of C API as an alternative to the traditional COM API.
Differences from hexops/dxc and mach-dxcompiler
Unfortunately, the Hexops fork of DXC does not attempt to keep up-to-date with source DXC and is primarily designed to serve the purpose of a DXIL bytecode generator for the Mach Engine and not as a standalone library. As such, it lacks features such as SPIR-V bytecode generation, which are essential for developers seeking to cross-compile HLSL for several platforms.
Mach also does not integrate the zig buildsystem directly with <em>DXC</em> source and keeps their buildsystem one level above. This project will instead attempt to integrate directly into <em>DXC</em> and maintain relatively up-to-date with upstream <em>DXC</em> as long as there are no issues. It will provide the option to build with SPIR-V bytecode generation, and modify the C API to adopt the general DXC naming conventions.
Differences between <em>DirectXShaderCompiler-zig</em> and <em>mach-dxcompiler</em>:
- Direct integration of build.zig file into <em>DXC</em> source repository.
- Options to enable SPIR-V bytecode generation.
- Attempts to keep up-to-date with upstream DXC and SPIRV-Tools (at the potential detriment to stability).
- Renamed the C API and internal functions to follow a more general <em>DXC/C</em> naming convention.
- Removed MSVC builds due to the lack of support these libraries have for non-windows platforms. PRs welcome which re-add suppor, but I am uninterested and currently unable to add support for them from Linux.
- Moved SPIRV-Tools external dependency from <a>hexops/spirv-tools</a> to <a>SPIRV-Tools-zig</a>.
- Addition of <code>-Dregenerate_headers</code> flag, which rebuilds python generated and tablegen'ned headers used by LLVM, Clang, and DXC into <em>generated-include</em>. | [] |
https://avatars.githubusercontent.com/u/48695102?v=4 | elevator-chime | z-silver/elevator-chime | 2024-02-16T07:54:32Z | Zig implementation of the Chime VM | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/z-silver/elevator-chime/tags | Unlicense | [
"forth",
"vm",
"zig"
] | 74 | false | 2025-04-24T03:09:25Z | true | true | 0.14.0 | github | [] | Elevator Chime
<blockquote>
Keeping it vertical,
forever elevator.
Riding the escalator
to the something that is greater.
</blockquote>
-- Nujabes & Cyne - Feather
Elevator Chime is a Zig reimplementation of <a>Chime</a>.
<code>zig build test</code> executes the triangle numbers and short multiplication example programs.
<code>zig build chaff</code> reads a chaff assembly file from stdin, compiles it and writes the result to stdout.
<code>zig build run -- <compiled-file></code> loads and executes a compiled program.
A plain <code>zig build</code> produces two executables: <code>elevator-chime</code>, which is the program called by <code>zig build run</code>, and <code>chaff</code>, which is called by <code>zig build chaff</code>.
Written against Zig version <code>0.14.0</code>. | [] |
https://avatars.githubusercontent.com/u/6756180?v=4 | zig-sdl-pixi-sample | kassane/zig-sdl-pixi-sample | 2024-06-29T16:51:24Z | Zig toolchain using Pixi package management (sample) | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/kassane/zig-sdl-pixi-sample/tags | BSL-1.0 | [
"conda",
"conda-environment",
"package-management",
"pixi",
"zig"
] | 8 | false | 2024-06-30T14:04:32Z | true | true | 0.13.0 | github | [
{
"commit": "d3ce72923ada60041a6a4a92628408b0908ce4e0",
"name": "SDL2",
"tar_url": "https://github.com/allyourcodebase/SDL/archive/d3ce72923ada60041a6a4a92628408b0908ce4e0.tar.gz",
"type": "remote",
"url": "https://github.com/allyourcodebase/SDL"
}
] | zig-pixi
Zig toolchain using <a>Pixi package management</a> (sample)
Requires
<ul>
<li><a>Zig</a> v0.13.0 or master</li>
<li><a>Pixi</a> v0.24 or master</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/97989036?v=4 | zwc | iambnlvn/zwc | 2024-06-15T19:37:49Z | wc unix command implemented in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/iambnlvn/zwc/tags | - | [
"unix",
"unix-command",
"zig",
"ziglang"
] | 7 | false | 2024-06-15T21:24:19Z | true | true | unknown | github | [] | Project Name
<strong>ZWC</strong>
Description
ZWC is a zig implementation of the <code>wc</code> command. It counts the number of lines, words, and characters in a file.
Installation
To install this project, follow these steps:
<ol>
<li>Clone the repository.
<strong>2.1 Manually via:</strong></li>
</ol>
<code>sh
git clone https://github.com/iambnlvn/zwc</code>
<strong>2.2 Using gh cli:</strong>
<code>sh
gh repo clone iambnlvn/zwc</code>
<ol>
<li>Build the project with <code>zig build</code>.</li>
<li>Run the project with <code>./zig-out/bin/zwc</code>.</li>
</ol>
Usage
To use <code>zwc</code>,
<code>sh
./zig-out/bin/zwc <file></code>
<code>zwc</code> supports standard input, so you can also use it like this:
<code>sh
echo "Say hi to your mom" | ./zig-out/bin/zwc</code>
`
zwc supports the following flags:
<ul>
<li><code>-l</code>: Print the number of lines in the file.</li>
<li><code>-w</code>: Print the number of words in the file.</li>
<li><code>-c</code>: Print the number of characters in the file.</li>
<li><code>-m</code>: is the default flag, and it prints the number of lines, words, and characters in the file.</li>
</ul>
| [] |
https://avatars.githubusercontent.com/u/6332937?v=4 | csvcut | SuSonicTH/csvcut | 2024-05-06T11:22:21Z | a cut like tool to process csv files | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/SuSonicTH/csvcut/tags | MIT | [
"command-line",
"csv",
"csv-file",
"cut",
"zig"
] | 172 | false | 2025-02-08T15:05:28Z | true | true | unknown | github | [
{
"commit": "ea75db20ac41a68f72ebf605e4cb10e5af719cd1.tar.gz",
"name": "CsvLine",
"tar_url": "https://github.com/SuSonicTH/zigCsvLine/archive/ea75db20ac41a68f72ebf605e4cb10e5af719cd1.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/SuSonicTH/zigCsvLine"
},
{
"commit": "89d092... | csvcut
As a learning exercise to get to know zig I build a small command line tool that works like the <em>cut</em> utility but uses the header to identify columns additionaly to indices and has some extra functionality build in.
Feedback from more experienced zig developers is very welcome.
If you find any bug or you see some non-idiomatic costructs please let me know.
Usage
see <a>src/USAGE.txt</a>
Licence
csvcut is licensed under the MIT license
see <a>LICENSE.txt</a>
Build requirements
To build csvcut you just need the zig compiler, which can be downloaded from <a>https://ziglang.org/download/</a>
Currently zig master (0.14.0) is supported, builds might break in never and older versions.
There is no installation needed, just download the package for your operating system an extract the archive and add it to your <code>PATH</code>
Windows example
execute following commands in a windows Command Prompt (cmd.exe)
<code>cmd
curl https://ziglang.org/builds/zig-windows-x86_64-0.14.0-dev.2851+b074fb7dd.zip --output zig.zip
tar -xf zig.zip
del zig.zip
move zig-windows-x86_64-0.14.0-dev* zig
set PATH=%cd%\zig;%PATH%</code>
Linux example
execute following commands in a shell
<code>bash
curl zig-linux-x86_64-0.14.0-dev.2851+b074fb7dd.tar.xz --output zig.tar.xz
tar -xf zig.tar.xz
rm zig.tar.xz
mv zig-linux-x86_64-0.14.0-dev* zig
export PATH=$(pwd)/zig:$PATH</code>
Build
If you have zig installed and on your <code>PATH</code> just cd into the directory and execute <code>zig build</code>
The first build takes a while and when it's finished you'll find the executeable (csvcut or csvcut.exe) in zig-out/bin/
You can run the built-in uinit tests with <code>zig build test</code> If everything is ok you will see no output.
Use <code>zig build -Doption=ReleaseFast</code> to build a release version optimized for speed. | [] |
https://avatars.githubusercontent.com/u/55848801?v=4 | SysProgWithZig | avifenesh/SysProgWithZig | 2024-05-24T11:35:14Z | Having fun with ZIG and diving into system programing with it | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/avifenesh/SysProgWithZig/tags | - | [
"fun",
"git",
"study",
"system-programming",
"zig"
] | 240 | false | 2024-10-25T14:30:22Z | false | false | unknown | github | [] | This project is a funtime project
<ol>
<li>The goal is to enjoy and learn system programming in a deeper level.</li>
<li>Second goal is to learn ZIG and do everything in ZIG.</li>
<li>Third goal is to write multiplatform code, that can run on linux and macos,
on 64 and 32 bit.</li>
<li>Fourth goal is to do every thing from the cli,
including creating this repo on github with api,
creating files, building, testing, running, and deploying.</li>
</ol>
In the project I'll use docker and qemu to run the code on different platforms,
so I will also have some fun with docker and qemu.
What I'm coding actually?
<ol>
<li>First I'll write a bunch of programs that are the basics of ZIG.</li>
<li>Second I'll work base on Berkeley C162 course
which is <a>available for free on youtube</a>.
The course is about system and system programming and it's in C,
but I'll do it in ZIG.
The course has <a>homeworks</a>,
so throw the course,
I'll do the homework base on the timeline of the course
(the timeline of me watching the course),
and I'll do some stuff a bit different -
I'll write my own docker images and qemu images, and I'll write the code in ZIG.
Suppose to be fun. :woman_dancing:</li>
</ol>
| [] |
https://avatars.githubusercontent.com/u/54911446?v=4 | zig-bench | milanpoliak/zig-bench | 2024-05-26T23:02:25Z | Simple benchmarking tool for Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/milanpoliak/zig-bench/tags | MIT | [
"benchmarking",
"performance",
"zig"
] | 14 | false | 2024-07-01T23:36:36Z | true | true | unknown | github | [] | Zig Bench
Simple benchmarking tool for Zig.
How to use
Install
<ol>
<li>Add Zig Bench to <code>build.zig.zon</code> dependencies</li>
</ol>
<code>shell
zig fetch --save https://github.com/milanpoliak/zig-bench/archive/refs/tags/v0.1.1.tar.gz</code>
<ol>
<li>Add Zig Bench to <code>build.zig</code></li>
</ol>
```zig
const zig_bench = b.dependency("zig-bench", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("zig-bench", zig_bench.module("zig-bench"));
```
Run
```zig
// Import Zig Bench
const zig_bench = @import("zig-bench");
const Bench = zig_bench.Bench;
const Config = zig_bench.Config;
const table = zig_bench.table;
// Create void functions to benchmark
fn doSomething() void { ... }
fn doSomethingElse() void { ... }
// Create a writer (optional) and an allocator
const writer = std.io.getStdOut().writer();
const allocator = std.testing.allocator;
// Create a bench
var bench = Bench.init(testing.allocator, writer, Config {
.runs = runs,
});
defer bench.deinit();
// Add the functions
try bench.add("do something", doSomething);
try bench.add("do something else", doSomethingElse);
// (Optional) Add reference measurements (e.g. when comparing with functions in other languages, or competing with a challenge)
try bench.addReference("fast implementation somewhere else", 420);
// Run
try bench.run();
// Print results in a table (or use bench.measurements directly to report it in other formats)
try table.writeTable(&bench, std.io.getStdOut().writer(), allocator)
```
Example table output
```text
Name Min Max Mean StdDev P50 P75 P99
testing 0 125 40 9.76 42 42 42
testing something else 0 125 40 8.57 42 42 42
``` | [] |
https://avatars.githubusercontent.com/u/16052180?v=4 | zig-steps | MahanRahmati/zig-steps | 2024-03-27T03:22:43Z | Baby steps to learn Zig programming language | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/MahanRahmati/zig-steps/tags | MIT | [
"step-by-step",
"zig",
"ziglang"
] | 3 | false | 2024-03-27T04:53:01Z | false | false | unknown | github | [] | Zig Steps
Baby steps to learn Zig programming language
<ul>
<li>Step 1: <a>Hello</a></li>
<li>Step 2: <a>Assign</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/161890530?v=4 | minimal-rocksdb | soheil-01/minimal-rocksdb | 2024-03-06T16:05:13Z | Minimal RocksDB with zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/soheil-01/minimal-rocksdb/tags | - | [
"rocksdb",
"zig"
] | 3 | false | 2024-03-06T16:07:44Z | true | true | unknown | github | [] | Minimal RocksDB
My Second project while learning Zig, based on <a>A minimal RocksDB example with Zig
</a>.
Build
<code>bash
git clone https://github.com/facebook/rocksdb
(cd rocksdb && make shared_lib -j8)
zig build</code>
Run
<code>bash
./zig-out/bin/main set a 10
./zig-out/bin/main set b 20
./zig-out/bin/main list
a = 10
b = 20
./zig-out/bin/main get a
10</code> | [] |
https://avatars.githubusercontent.com/u/14295318?v=4 | ziglang.sh | dravenk/ziglang.sh | 2024-03-10T08:15:11Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/dravenk/ziglang.sh/tags | MIT | [
"install-script",
"shell",
"shell-script",
"zig",
"ziglang"
] | 1 | false | 2024-03-10T08:15:52Z | false | false | unknown | github | [] | ziglang.sh | [] |
https://avatars.githubusercontent.com/u/442455?v=4 | dear_bindings_build | dinau/dear_bindings_build | 2024-06-01T10:02:11Z | ImGui: Simple dear_bindings build project | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/dinau/dear_bindings_build/tags | MIT | [
"c-language",
"cimgui",
"clang",
"gcc",
"glfw",
"gui",
"imgui",
"makefile",
"mingw",
"msys2",
"opengl",
"sdl",
"sdl2",
"sdl3",
"windows",
"windowsos",
"zig"
] | 37,929 | false | 2024-06-17T08:59:01Z | false | false | unknown | github | [] |
<ul>
<li><a>Dear_Bindings_Build</a></li>
<li><a>Prerequisites</a></li>
<li><a>Build and run</a></li>
<li><a>Examples screen shots</a></li>
<li><a>Hiding console window</a></li>
<li><a>Regenarate ImGui bindings</a></li>
<li><a>Build with Clang, Zig cc</a></li>
<li><a>SDL</a></li>
<li><a>My tools version</a></li>
<li><a>Similar project</a></li>
</ul>
Dear_Bindings_Build
This project aims to simply and easily build ImGui examples with <strong>C language</strong> and <strong>Zig language</strong> using <a>Dear_Bindings</a> as first step.
ImGui version <strong>1.90.8</strong> (2024/06)
Prerequisites
<ul>
<li>Windows10 OS</li>
<li>GCC (or Clang or <strong>'Zig cc'</strong> compiler)</li>
<li>Use <strong>Zig: 0.12.0</strong> (zig cc: clang version 17.0.6)</li>
<li><strong>Zig 0.13.0 ?</strong> (Compiling is ok so far)</li>
<li>Pyhton3</li>
<li>MSys/MinGW basic commands (make, rm, cp ...)</li>
</ul>
Build and run
<ol>
<li>Download this project.</li>
</ol>
<code>sh
git clone --recurse-submodules https://github.com/dinau/dear_bindings_build</code>
1. Go to one of the examples folder,
<code>sh
cd dear_bindings_build/examples/glfw_opengl3</code>
<ol>
<li>Build and Run </li>
</ol>
<code>sh
make run</code>
Examples screen shots
| Language | GLFW | SDL2 | SDL3 |
|:---------:|----------------------------------------------:|----------------------------------------------:|----------------------------------------------:|
| C lang. | <a>glfw_opengl3</a> | <a>sdl2_opengl3</a> | <a>sdl3_opengl3</a> |
| Zig lang. | <a>zig_glfw_opengl3</a> | <a>zig_sdl2_opengl3</a> | <a>zig_sdl3_opengl3</a> |
| Language | GLFW |
|:--------:|--------------------------------------------:|
| C lang. | <a>glfw_opengl3_jp</a> |
| Language | GLFW |
|:---------:|--------------------------------------------------------------------:|
| C lang. | <a>glfw_opengl3_image_load</a> |
| Zig lang. | <a>zig_glfw_opengl3_image_load</a> |
| Language | GLFW |
|:---------:|--------------------------------------------------------------------:|
| C lang. | <a>glfw_opengl3_image_save</a> |
| Zig lang. | <a>zig_glfw_opengl3_image_load</a> |
Image file captured would be saved in current folder.
Image can be saved as <code>JPEG / PNG / BMP / TGA</code> file.
Hiding console window
<ul>
<li>Zig lang. examples
Open <code>build.zig</code> in each example folder and <strong>enable</strong> option line as follows,</li>
</ul>
<code>zig
... snip ...
exe.subsystem = .Windows; // Hide console window
... snip ...</code>
and execute <code>make</code>.
<ul>
<li>C lang. examples
Open <code>Makefile</code> in each example folder and <strong>change</strong> option as follows,</li>
</ul>
<code>Makefile
... snip ...
HIDE_CONSOLE_WINDOW = true
... snip ...</code>
and execute <code>make</code>.
Regenarate ImGui bindings
For instance,
<code>sh
pwd
glfw_opengl3
make cleanall
make gen
make run</code>
Note: Except Zig lang. examples.
Artifacts are generated into <code>../libs/cimgui</code> folder.
Build with Clang, Zig cc
For instance,
<code>sh
pwd
glfw_opengl3
make cleanobjs
make TC=clang # or TC=zigcc</code>
Compiling with <code>TC=zigcc</code> may link dynamic library at this time.
Note: Except Zig lang. examples.
SDL
<ul>
<li>SDL3 Build-SDL3
https://github.com/mmozeiko/build-sdl3/releases
https://github.com/mmozeiko/build-sdl3</li>
<li>SDL3 Build-SDL3-Win32
https://github.com/JBetz/build-sdl3-win32/releases
https://github.com/JBetz/build-sdl3-win32</li>
</ul>
My tools version
<ul>
<li>clang version 18.1.6</li>
<li>gcc.exe (Rev2, Built by MSYS2 project) 13.2.0</li>
<li>git version 2.41.0.windows.3</li>
<li>make: GNU Make 4.3</li>
<li>Python 3.12.3</li>
<li>zig: 0.12.0 (zig cc: clang version 17.0.6)</li>
<li>SDL2 ver.2.30.3</li>
<li>SDL3 2024-06-02</li>
</ul>
Similar project
| Language | Project |
| -------------------: | :----------------------------------------------------------------: |
| <strong>Nim</strong> | <a>Imguin</a>, <a>Nimgl_test</a>, <a>Nim_implot</a> |
| <strong>Lua</strong> | <a>LuaJITImGui</a> |
| <strong>Python</strong> | <a>DearPyGui for 32bit WindowsOS Binary</a> | | [] |
https://avatars.githubusercontent.com/u/183031282?v=4 | flx-zig | the-flx/flx-zig | 2024-03-10T01:09:49Z | Rewrite emacs-flx in Zig [maintainer=@jcs090218] | master | 2 | 0 | 1 | 0 | https://api.github.com/repos/the-flx/flx-zig/tags | MIT | [
"flx",
"fuzzy",
"zig"
] | 79 | false | 2024-12-02T18:03:13Z | true | true | unknown | github | [] | <a></a>
<a></a>
flx-zig
<blockquote>
Rewrite emacs-flx in Zig
</blockquote>
<a></a>
<a></a>
🔧 Usage
```zig
const result: ?flx.Result = flx.score(allocator, "switch-to-buffer", "stb");
std.debug.print("{d}\n", .{result.?.score});
defer result.?.deinit(); // clean up
```
💾 Installation
<ol>
<li>Add the dependency to the <code>build.zig.zon</code> of your project.</li>
</ol>
<code>zig
.dependencies = .{
.flx = .{
.url = "https://github.com/jcs090218/flx-zig/archive/82eb49e8e26ceb53c58e2f4fe5bc2ab3f6ec91d4.tar.gz",
.hash = "12202ffde84f17914ba10f6bc1799738b5db997e6ff8f9092384c7f8f9f63bfa4c42",
},
},</code>
<ol>
<li>Add the dependency and module to your <code>build.zig</code>.</li>
</ol>
<code>zig
const flx_dep = b.dependency("flx", .{});
const flx_mod = flx_dep.module("flx");
exe.addModule("flx", flx_mod);</code>
<ol>
<li>Import it inside your project.</li>
</ol>
<code>zig
const flx = @import("flx");</code>
<em>📝 P.S. See <a>examples</a> for full example!</em>
⚜️ License
<code>flx-zig</code> is distributed under the terms of the MIT license.
See <a><code>LICENSE</code></a> for details.
| [] |
https://avatars.githubusercontent.com/u/1533514?v=4 | rdf.zig | ubermanu/rdf.zig | 2024-06-20T11:22:22Z | RDF Graph parser | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/ubermanu/rdf.zig/tags | MIT | [
"rdf",
"zig"
] | 14 | false | 2025-03-15T21:36:57Z | true | true | 0.14.0 | github | [] | rdf.zig
A RDF Graph parser, supports the following formats:
<ul>
<li>N-Triples</li>
<li>Turtle</li>
</ul>
Install
<code>sh
zig fetch --save git+https://github.com/ubermanu/rdf.zig</code>
<code>zig
const rdf_mod = b.dependency("rdf", .{});
exe.addImport("rdf", rdf_mod.module("rdf"));</code>
Usage
```zig
const Graph = @import("rdf").Graph;
test {
const graph = Graph.init(std.testing.allocator);
defer graph.deinit();
<code>const ttl =
\\@prefix foaf: <http://xmlns.com/foaf/0.1/> .
\\
\\<http://example.org/person#Alice>
\\ a foaf:Person ;
\\ foaf:name "Alice" ;
\\ foaf:age "30"^^xsd:integer .
;
graph.loadFromString(.turtle, ttl);
try std.testing.expectEqualStrings(
"http://example.org/person#Alice",
graph.nodes.items[0].name,
);
</code>
}
``` | [] |
https://avatars.githubusercontent.com/u/24751061?v=4 | bytzig | nikhilr612/bytzig | 2024-04-04T16:49:28Z | A BytePusher Virtual Machine implementation in Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/nikhilr612/bytzig/tags | MIT | [
"bytepusher",
"emulator",
"sdl2",
"virtual-machine",
"zig",
"ziglang"
] | 1,564 | false | 2024-12-26T08:10:45Z | true | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/11492844?v=4 | atomz | fjebaker/atomz | 2024-08-02T22:34:00Z | An Atom syndication feed generator for Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/fjebaker/atomz/tags | GPL-3.0 | [
"atom",
"feed",
"generator",
"syndication",
"zig"
] | 22 | false | 2024-08-03T13:54:04Z | true | true | unknown | github | [] | atomz
An Atom feed generator for Zig.
```zig
const std = @import("std");
const atomz = @import("atomz");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
<code>var feed = atomz.Feed.init(allocator);
defer feed.deinit();
try feed.setTitle("My new feed");
try feed.setAuthor("Syliva");
var entry = try feed.newEntry();
try entry.setTitle("The conquest of cake");
const ptr = try entry.newField("content", "This would be the content.");
try ptr.put("type", "text/html");
try feed.write(std.io.getStdOut().writer());
</code>
}
```
This will output the following:
<code><feed xmlns="http://www.w3.org/2005/Atom">
<title>My new feed</title>
<author>Syliva</author>
<entry>
<title>The conquest of cake</title>
<content type="text/html">This would be the content.</content>
</entry>
</feed></code> | [] |
https://avatars.githubusercontent.com/u/154885296?v=4 | ZigBLAS | yctai1994/ZigBLAS | 2024-06-16T13:44:46Z | A reimplementation of LAPCK (https://www.netlib.org/lapack/) | main | 0 | 0 | 1 | 0 | https://api.github.com/repos/yctai1994/ZigBLAS/tags | MIT | [
"blas",
"lapack",
"zig"
] | 18 | false | 2024-06-28T09:10:40Z | true | true | unknown | github | [] | ZigBLAS
# TODO
1. BLAS
1.1 Level1
1.2 Level2
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> dtrmv
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> dtrsv
1.3 Level3
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> dgemm
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> dsyrk
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> dtrsm
2. LAPACK
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> dpotrf
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> dpotrf2 | [] |
https://avatars.githubusercontent.com/u/32078353?v=4 | chip8 | xyaman/chip8 | 2024-07-25T15:55:44Z | Chip8 emulator written in Zig that renders in the terminal instead of using graphical libraries. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/xyaman/chip8/tags | - | [
"chip8",
"tui",
"zig"
] | 12 | false | 2024-11-21T09:12:42Z | true | true | unknown | github | [
{
"commit": "refs",
"name": "mibu",
"tar_url": "https://github.com/xyaman/mibu/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/xyaman/mibu"
}
] | [WIP] Chip8 emulator written in Zig
It doesn't use a graphics library, like SDL, but instead renders the screen
in the terminal using mibu.
Why write a Chip8 emulator in Zig?
I just wanted to try and test mibu, a library I wrote to interact with the
terminal.
<blockquote>
Tested with zig 0.13.0
</blockquote> | [] |
https://avatars.githubusercontent.com/u/143726882?v=4 | os | Ang3l404/os | 2024-05-18T03:50:25Z | This is a little personal project to see if I can build an OS from scratch | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Ang3l404/os/tags | - | [
"nasm",
"operating-system",
"qemu",
"zig"
] | 6 | false | 2024-05-18T19:51:50Z | false | false | unknown | github | [] | OS
Hello there ^^\
This is a little thing I'm working on and just thought:
"Why not?"
of course, building an OS from scratch is difficult but-\
It's a project that I'll learn as I'll go,
just for funs and learning.\
yee .w.
This project uses NASM, QEMU, and ZIG
<a><strong>NASM</strong></a>
is a free open source assembly compiler that makes this and many other sorts of projects possible..\
\
the documentation isn't easy to read through though...
<a><strong>Qemu</strong></a>
is a free open source emulator that can work with .bin files...\
unlike virtual box...
<a><strong>Zig</strong></a>
Zig is an in-development low-level programming language.\
That is honestly much easier to read than most other low-level programmming languages.\
\
It doesn't have a preprocessor, nor macros, what it does have the ability for is <em>metaprogramming~</em> and <em>testing</em> right out of the box!
Contribution
W.I.P. | [] |
https://avatars.githubusercontent.com/u/127390315?v=4 | chip8 | magical-chicken/chip8 | 2024-06-11T15:17:23Z | Chip8 emulator written in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/magical-chicken/chip8/tags | - | [
"chip-8",
"chip8",
"chip8-emulator",
"emulation",
"emulator",
"emulator-programming",
"zig",
"ziglang"
] | 32 | false | 2024-12-15T20:07:41Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/62622191?v=4 | hapi | DAlba-sudo/hapi | 2024-03-09T16:28:07Z | Hardware Abstraction Layer for the Pi 4B written in Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/DAlba-sudo/hapi/tags | - | [
"drivers",
"firmware",
"raspberry",
"raspberry-pi-4",
"zig"
] | 89 | false | 2024-03-09T17:29:43Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/114608503?v=4 | yams-calculator | PasVegan/yams-calculator | 2024-02-20T12:37:47Z | Tool written in Zig to compute probabilities for the yams game | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/PasVegan/yams-calculator/tags | - | [
"command-line",
"command-line-tool",
"math",
"mathematics",
"probability",
"tool",
"zig",
"ziglang"
] | 46,120 | false | 2024-02-20T13:48:12Z | true | true | unknown | github | [] | yams-calculator
Tool written in Zig to compute probabilities for the yams game
How to build:
<code>make or make debug</code>
How to use:
<code>USAGE
./yams d1 d2 d3 d4 d5 c cd1 [cd2]
DESCRIPTION
d1 value of the first die (0 if not thrown)
d2 value of the second die (0 if not thrown)
d3 value of the third die (0 if not thrown)
d4 value of the fourth die (0 if not thrown)
d5 value of the fifth die (0 if not thrown)
c combination to be obtained
cd1 first dice in combination
[cd2] second dice in combination (if applicable)</code>
The following combination are implemented: where A and B are the values of the dice in the combination
- pair_A
- three_A
- four_A
- full_A_B
- straight_A
- yams_A
Examples:
```
./yams 1 2 5 1 4 straight_5
./yams 0 0 0 0 0 yams_3
./yams 1 2 3 4 5 three_1
./yams 5 0 0 4 0 full_1_2
``` | [] |
https://avatars.githubusercontent.com/u/170934839?v=4 | New-Standard-Library | Ang3lERR404/New-Standard-Library | 2024-06-11T19:32:28Z | New Standard Library, without skill issues :D (joking, please don't sue me lol) | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Ang3lERR404/New-Standard-Library/tags | MIT | [
"skill-issues",
"standard-library",
"zig",
"ziglang"
] | 30 | false | 2025-05-20T02:23:39Z | false | false | unknown | github | [] | New Standard Library
This library is an ATTEMPT, to rewrite the entirety of the zig standard library.\
With optimizations put forward, instead of being done at a later update, of course-\
since I'm only one person, this will be on a constant game of catch-up.
Contributing
If you also have an inherrent vitriolistic <strong>H A T E</strong> for how the current std library is written.\
Especially if you have actually good optimizations you see.\
Grab an editor by the throat, and fork this repository. | [] |
https://avatars.githubusercontent.com/u/23489037?v=4 | zttp | lacc97/zttp | 2024-04-06T20:42:48Z | null | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/lacc97/zttp/tags | - | [
"http",
"http-server",
"zig"
] | 31 | false | 2024-04-06T21:04:49Z | true | true | unknown | github | [
{
"commit": "0f73adfda1cff9c740160717b5431ebada6b8755",
"name": "libxev",
"tar_url": "https://github.com/mitchellh/libxev/archive/0f73adfda1cff9c740160717b5431ebada6b8755.tar.gz",
"type": "remote",
"url": "https://github.com/mitchellh/libxev"
}
] | 404 | [] |
https://avatars.githubusercontent.com/u/70723965?v=4 | zig_structures | tomBoddaert/zig_structures | 2024-07-08T18:59:49Z | An implementation of some data structures used to help me learn Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/tomBoddaert/zig_structures/tags | - | [
"data-structures",
"zig"
] | 28 | false | 2024-07-30T17:58:45Z | true | true | 0.13.0 | github | [
{
"commit": "037ca63e90a744ab1fdefcf1aee10f8935b80f02.tar.gz",
"name": "meta_match",
"tar_url": "https://github.com/tomBoddaert/meta_match/archive/037ca63e90a744ab1fdefcf1aee10f8935b80f02.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/tomBoddaert/meta_match"
}
] | <code>zig_structures</code>
This is an implementation of some data structures that I wrote to help me learn Zig.
Adding <code>zig_structures</code> to your project
Run
<code>sh
zig fetch --save https://github.com/tomBoddaert/zig_structures/archive/{commit}.tar.gz</code>
Where <code>{commit}</code> is replaced with the commit hash.
Documentation
To build the documentation, clone the repository and run
<code>sh
zig build docs</code> | [] |
https://avatars.githubusercontent.com/u/36482619?v=4 | zig-deb | jkoop/zig-deb | 2024-06-13T18:41:16Z | scripts and helper files that I use to create deb files of zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/jkoop/zig-deb/tags | MIT | [
"debian-packages",
"zig",
"ziglang"
] | 14 | false | 2025-04-22T20:31:30Z | false | false | unknown | github | [] | zig-deb
Here is the script I use to create <code>.deb</code> files from precompiled binaries of <a>Zig</a>, which I host on <a>my apt packages server</a>.
I am not endorsed by <a>the Zig Software Foundation</a>. I just like their project, and see that they aren't publishing <code>.deb</code> files of their own.
Usage (Debian)
<ol>
<li>Go to https://packages.joekoop.com and run the command at the top of the page.</li>
<li>Update your local indecies: <code>sudo apt update</code></li>
<li>Install Zig: <code>sudo apt install zig</code></li>
</ol>
Usage (Docker)
<code>Dockerfile
FROM jkoop/zig:VERSION
RUN zig build-exe ...</code>
Build (Docker)
```bash
example
docker build --tag jkoop/zig:0.14.0 --build-arg VERSION=0.14.0 .
``` | [] |
https://avatars.githubusercontent.com/u/100141028?v=4 | zon-package-list | emastho/zon-package-list | 2024-02-17T17:54:23Z | Zig zon package list | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/emastho/zon-package-list/tags | - | [
"zig"
] | 23 | false | 2024-02-17T18:08:14Z | false | false | unknown | github | [] | create-svelte
Everything you need to build a Svelte project, powered by <a><code>create-svelte</code></a>.
Creating a project
If you're seeing this, you've probably already done this step. Congrats!
```bash
create a new project in the current directory
npm create svelte@latest
create a new project in my-app
npm create svelte@latest my-app
```
Developing
Once you've created a project and installed dependencies with <code>npm install</code> (or <code>pnpm install</code> or <code>yarn</code>), start a development server:
```bash
npm run dev
or start the server and open the app in a new browser tab
npm run dev -- --open
```
Building
To create a production version of your app:
<code>bash
npm run build</code>
You can preview the production build with <code>npm run preview</code>.
<blockquote>
To deploy your app, you may need to install an <a>adapter</a> for your target environment.
</blockquote> | [] |
https://avatars.githubusercontent.com/u/149780728?v=4 | zml | zml/zml | 2024-09-17T09:13:32Z | Any model. Any hardware. Zero compromise. Built with @ziglang / @openxla / MLIR / @bazelbuild | master | 28 | 2,267 | 80 | 2,267 | https://api.github.com/repos/zml/zml/tags | Apache-2.0 | [
"ai",
"bazel",
"hpc",
"inference",
"xla",
"zig"
] | 2,218 | false | 2025-05-21T20:40:16Z | true | false | unknown | github | [] |
<a>Website</a>
| <a>Getting Started</a>
| <a>Documentation</a>
| <a>Discord</a>
| <a>Contributing</a>
Bonjour 👋
At ZML, we are creating exciting AI products on top of our high-performance
AI inference stack. Our stack is built for production, using the amazing
<a>Zig</a> language, <a>MLIR</a>, and the
power of <a>Bazel</a>.
Take me straight to <a>getting started</a> or <a>give me a taste</a> 🥐!
We're happy to share!
We're very happy to share our inference stack with the World and hope it allows
you, too, to build cool and exciting AI projects.
To give you a glimpse of what you can do with ZML, here is an early demo:
It shows a prototype running a LLaMA2 model sharded on 1 NVIDIA RTX 4090, 1 AMD
6800XT, and 1 Google Cloud TPU v2. All accelerators were hosted in different
locations, with activations being passed over a VPN.
All processes used the same model code, cross-compiled on a Mac, and copied onto
the servers.
For more inspiration, see also the examples below or check out the
<a>examples</a> folder.
Getting started
Prerequisites
We use <code>bazel</code> to build ZML and its dependencies. The only prerequisite is
<code>bazel</code>, which we recommend to download through <code>bazelisk</code>, a version manager
for <code>bazel</code>.
<strong>Please note: If you do not wish to install <code>bazel</code></strong> system-wide, we provide
<a>examples/bazel.sh</a> which downloads it to your home folder
and runs it.
<strong>Install Bazel</strong> (recommended):
### macOS
```
brew install bazelisk
```
### Linux
```
curl -L -o /usr/local/bin/bazel 'https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64'
chmod +x /usr/local/bin/bazel
```
Run a pre-packaged model
We have implemented a variety of example models in ZML. See our reference
implementations in the
<a>examples</a> folder.
MNIST
The <a>classic</a> handwritten digits
recognition task. The model is tasked to recognize a handwritten digit, which
has been converted to a 28x28 pixel monochrome image. <code>Bazel</code> will download a
pre-trained model, and the test dataset. The program will load the model,
compile it, and classify a randomly picked example from the test dataset.
On the command line:
```
cd examples
bazel run --config=release //mnist
or
./bazel.sh run --config=release //mnist
```
Meta Llama 3.1 8B
This model has restrictions, see
<a>here</a>. It <strong>requires
approval from Meta on Huggingface</strong>, which can take a few hours to get granted.
While waiting, you can already generate an access token to log into HuggingFace
from <code>bazel</code>; see <a>here</a>.
Once you've been granted access, you're ready to download a gated model like
<code>Meta-Llama-3.1-8B-Instruct</code>!
```
requires token in $HOME/.cache/huggingface/token, as created by the
<code>huggingface-cli login</code> command, or the <code>HUGGINGFACE_TOKEN</code> environment variable.
cd examples
bazel run --config=release //llama:Llama-3.1-8B-Instruct
bazel run --config=release //llama:Llama-3.1-8B-Instruct -- --prompt="What is the capital of France?"
```
You can also try <code>Llama-3.1-70B-Instruct</code> if you have enough memory.
Meta Llama 3.2 1B
Like the 8B model above, this model also requires approval. See
<a>here</a> for access requirements.
<code>cd examples
bazel run --config=release //llama:Llama-3.2-1B-Instruct
bazel run --config=release //llama:Llama-3.2-1B-Instruct -- --prompt="What is the capital of France?"</code>
For a larger 3.2 model, you can also try <code>Llama-3.2-3B-Instruct</code>.
Running Models on GPU / TPU
You can compile models for accelerator runtimes by appending one or more of the
following arguments to the command line when compiling / running a model:
<ul>
<li>NVIDIA CUDA: <code>--@zml//runtimes:cuda=true</code></li>
<li>AMD RoCM: <code>--@zml//runtimes:rocm=true</code></li>
<li>Google TPU: <code>--@zml//runtimes:tpu=true</code></li>
<li>AWS Trainium/Inferentia 2: <code>--@zml//runtimes:neuron=true</code></li>
<li><strong>AVOID CPU:</strong> <code>--@zml//runtimes:cpu=false</code></li>
</ul>
The latter, avoiding compilation for CPU, cuts down compilation time.
So, to run the OpenLLama model from above on your host sporting an NVIDIA GPU,
run the following:
<code>cd examples
bazel run --config=release //llama:Llama-3.2-1B-Instruct \
--@zml//runtimes:cuda=true \
-- --prompt="What is the capital of France?"</code>
Run Tests
<code>bazel test //zml:test</code>
A taste of ZML
MNIST
```zig
const std = @import("std");
const zml = @import("zml");
/// Model definition
const Mnist = struct {
fc1: Layer,
fc2: Layer,
<code>const Layer = struct {
weight: zml.Tensor,
bias: zml.Tensor,
pub fn forward(self: Layer, input: zml.Tensor) zml.Tensor {
return self.weight.matmul(input).add(self.bias).relu();
}
};
/// just two linear layers + relu activation
pub fn forward(self: Mnist, input: zml.Tensor) zml.Tensor {
std.log.info("Compiling for target: {s}", .{@tagName(input.getContext().target())});
var x = input.flattenAll().convert(.f32);
const layers: []const Layer = &.{ self.fc1, self.fc2 };
for (layers) |layer| {
x = zml.call(layer, .forward, .{x});
}
return x.argMax(0, .u8).indices;
}
</code>
};
```
Tagged Tensors
<code>zig
const Sdpa = struct {
pub fn forward(_: Sdpa, ctx: *zml.Context, q_: zml.Tensor, k_: zml.Tensor, v_: zml.Tensor) zml.Tensor {
const q = q_.withTags(.{ .b, .h, .q, .hd });
const k = k_.withTags(.{ .b, .h, .k, .hd });
const v = v_.withTags(.{ .b, .h, .k, .hd });
const attn_mask = zml.nn.causalAttnMask(ctx, .{ .q = q.dim(.q), .k = k.dim(.k) }, q.dtype(), null);
return zml.nn.sdpa(ctx, q, k, v, .{ .attn_mask = attn_mask });
}
};</code>
Where to go next:
You might want to check out more <a>examples</a>, read through the
<a>documentation directly on GitHub</a>, or, for the full rendering
experience, browse the
<a>online documentation with included API reference</a>.
Contributing
See <a>here</a>.
License
ZML is licensed under the <a>Apache 2.0 license</a>.
Thanks to our contributors
<a>
</a> | [] |
https://avatars.githubusercontent.com/u/8205547?v=4 | uscope | jcalabro/uscope | 2025-01-01T13:46:52Z | μscope 🔬 | main | 1 | 950 | 21 | 950 | https://api.github.com/repos/jcalabro/uscope/tags | Apache-2.0 | [
"debugger",
"developer-tools",
"introspection",
"linux",
"zig"
] | 13,918 | false | 2025-05-19T13:41:08Z | true | true | unknown | github | [
{
"commit": "master.tar.gz",
"name": "time",
"tar_url": "https://github.com/jcalabro/zig-time/archive/master.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/jcalabro/zig-time"
},
{
"commit": "master",
"name": "system_sdk",
"tar_url": "https://github.com/zig-gamedev/s... | uscope 🔬
<a></a>
Overview
uscope (pronounced "microscope") is a native code graphical debugger and introspection toolchain for Linux.
<a>See here</a> for background and motivation on the project.
Join the <a>Discord</a> if you're interested in talking debuggers.
Project Status and Roadmap
uscope is not far enough along to consider using as a daily-driver. It's a side project I'm working on for fun and because I need a better debugger for my own use.
In fact, it's currently undergoing a total rewrite of its user interface. I would not recommend even attempting to use it at this time - but stay tuned! See more information on the motivation for this change <a>here</a>. If you want to try to use the old native Linux UI, you can clone <a>this tag</a>, though it likely will not work for your real-world use case.
This is a birds-eye overview of the features I'd like implemented before I'd personally be able to completely ditch other "traditional" debuggers. In no particular order:
<ul>
<li>Remote debugging</li>
<li>Total rewrite of the UI to be web-based to enable easy remote development (even if the agent you're connecting to is <code>localhost</code>)</li>
<li>Ensure that all table-stakes debugger operations are rock-solid and fast</li>
<li>Debug symbol parsing</li>
<li>Subordinate process Control flow (i.e. stepping)</li>
<li>Basic variable value rendering</li>
<li>Stack unwinding</li>
<li>etc.</li>
<li>Support for visualization of common data types in several languages (preliminary C, Zig, Odin, and C3 support is already underway)</li>
<li>Adding support for Go even though it's a very complicated language since that's what I use for work</li>
<li>Also planning on supporting at C++, Rust, Crystal, and Jai</li>
<li>In general, we will design a system that handles transforming data in to user-friendly visualization that is flexible, extensible, and not tied to any one language</li>
<li>Support for multi-threaded programs (preliminary support underway)</li>
<li>Debug tests by clicking on them, at least for programs with built-in testing solutions like Zig, Go, etc.</li>
<li>Run to cursor</li>
<li>User-friendly source code navigation (i.e. go to definition, find all references, etc.)</li>
<li>Better config file management</li>
<li>I don't want to have to manually edit config files; I want to have the debugger configure them for me via the GUI</li>
</ul>
Other long-term features that will be implemented are:
<ul>
<li>Build as a library so other people can build other interesting things as well</li>
<li>The remote debugger agent will be the first consumer of that library (in the same way <a>Ghostty</a> is the first consumer of libghostty)</li>
<li>Many more types of workload-specific data visualizations</li>
<li>For example, I when I work on chess engines, it would be amazing to have a debugger that natively understands my position encoding and automatically visually renders interactive chess boards</li>
<li>Conditional breakpoints</li>
<li>Data/address breakpoints (i.e. break when an address is accessed or a variable mutated)</li>
<li>Trace points (observe variable values over time in a low-overhead manner)</li>
<li>Load and view core dumps</li>
<li>Assembly viewer</li>
<li>Ability to track and visualize system calls (similar to <a>strace</a>)</li>
<li>Various <code>/proc</code> views (there's lots of interesting information in there)</li>
<li>macOS and Windows support</li>
<li>What is important to <em>you</em>? Let me know!</li>
</ul>
Similarly, the following features are non-goals of the project:
<ul>
<li>Supporting non-native languages (i.e. Java, Python, etc.)</li>
</ul>
Building and Running
Do not attempt to build and run uscope at this time. It is under heavy development and is in the middle of a total UI rewrite.
FAQ
1. When will this project be mature enough to use for my day to day work?
Probably a long time (could easily be a year, or several). I have a day job, and this is a passion project I work on in my spare time. Check back often for updates!
2. How can I help out?
The absolute best thing you can do is reach out and talk debuggers so I know that there is interest in the the project. We have a <a>Discord</a>, and you can find my email on my personal site. I love hearing from you!
You could also consider <a>sponsoring my work</a>. This is a very strong signal to me that I'm focused on things that matter.
Additionally, please consider donating to the <a>Zig Software Foundation</a>!
3. Will you provide pre-built binaries?
Once the project is further along, yes, but not now.
4. Why are you building a library for debugging, not just a new debugger? And why not just use DAP?
There are a wide variety of use-cases for an introspection library outside of traditional debuggers (i.e. reverse engineering tools, novel forms of debuggers, etc.). By making this system reusable and nicely packaged, it encourages the entire ecosystem of debugging tools to improve, not just this one project. That being said, we are focusing intently on the traditional debugger first, and then once the core of the system is solid, we will make it more intentionally accessible to other consumers.
Regarding <a>DAP</a>, This toolchain intends to be lower-level and broader in scope than something like DAP would enable. I do not think DAP is very good, but lots of editors out there already speak it, so we're partially stuck with it. However, by creating an introspection library, we easily create a separate DAP-compatible executable completely isolated from the native GUI we're building so that way neither is bloated by the other.
In short, building as a library allows us all to build many novel, simple, and focused introspection tools. | [] |
https://avatars.githubusercontent.com/u/54208873?v=4 | glyph | seatedro/glyph | 2024-08-25T04:22:03Z | convert images, video to ascii! | main | 3 | 405 | 18 | 405 | https://api.github.com/repos/seatedro/glyph/tags | MIT | [
"ascii",
"ascii-art",
"zig"
] | 414 | false | 2025-05-15T19:56:25Z | true | true | 0.14.0 | github | [
{
"commit": "refs",
"name": "clap",
"tar_url": "https://github.com/Hejsil/zig-clap/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/Hejsil/zig-clap"
},
{
"commit": "master",
"name": "stb",
"tar_url": "https://github.com/nothings/stb/archive/master.tar.gz",
"... | glyph - ascii from media
converts images/video to ascii art
Dependencies
these dependencies are only for the <code>av</code> library to output videos. This will be opt-in in the future.
Linux:
<code>bash
sudo apt-get install libavutil-dev libavformat-dev libavcodec-dev libswscale-dev</code>
MacOS:
<code>bash
brew install ffmpeg pkgconf</code>
Windows:
<code>bash
choco install ffmpeg-shared</code>
Installing
Homebrew
<code>bash
brew install glyph</code>
build from source
<code>zig build -Doptimize=ReleaseFast</code>
the above command builds an executable found at <code>./zig-out/bin</code>
if you want to just directly run the executable, run:
<code>zig build run -Doptimize=ReleaseFast -- [options]</code>
see below for explanations for available options
Usage
run the program with the following options (the default zig install directory is <code>./zig-out/bin</code>):
<code>/path/to/glyph [options]</code>
1. options:
- <code>-h, --help</code>: print the help message and exit
- <code>-i, --input <file></code>: specify the input media file path (local path/URL) (required)
- <code>-o, --output <file></code>: specify the output media file (txt/img/vid) (required)
- <code>-c, --color</code>: use color ascii characters (optional)
- <code>-n, --invert_color</code>: Inverts the color values (optional)
- <code>-s, --scale <float></code>: set the downscale or upscale factor (optional, default: 1)
- <code>-e, --detect_edges</code>: enable edge detection (optional)
- <code>--sigma1 <float></code>: set the sigma1 value for DoG filter (optional, default: 0.3)
- <code>--sigma2 <float></code>: set the sigma2 value for DoG filter (optional, default: 1.0)
- <code>--dither floydstein</code>: enable dithering (currently only supports floydstein algorithm)
- <code>-b, --brightness_boost <float></code>: increase/decrease perceived brightness (optional, default: 1.0)
advanced options:
- <code>--full_characters</code>: Uses all ascii characters in generated output.
- <code>--ascii_chars <string></code>: Use what characters you want to use in the generated output. (default: " .:-=+*%@#")
- <code>--disable_sort</code>: Prevents sorting of the ascii_chars by size.
- <code>--block_size <u8></code>: Set the size of the blocks. (default: 8)
- <code>--threshold_disabled</code>: Disables the threshold.
- <code>--codec <string></code>: Set the encoder codec like "libx264" or "hevc_videotoolbox". (default: searches for encoders on your machine)
- <code>--keep_audio</code>: Preserves audio from input video.
- <code>--stretched</code>: Resizes media to fit terminal window
- <code>-f, --frame_rate</code>: Target frame rate for video output (default: matches input fps)
<blockquote>
To render on the terminal directly, just omit the output option.
To output to a text file, use the .txt extension when setting the output option
</blockquote>
<ol>
<li>examples:</li>
</ol>
### Image
basic usage:
<code>bash
glyph -i input.jpg -o output.png</code>
text file output:
<code>bash
glyph -i input.jpg -o output.txt</code>
using color:
<code>bash
glyph -i input.png -o output.png -c</code>
with edge detection, color, and custom downscale:
<code>bash
glyph -i input.jpeg -o output.png -s 4 -e -c</code>
with brightness boost and url input:
<code>bash
# bonus (this is a sweet wallpaper)
glyph -i "https://w.wallhaven.cc/full/p9/wallhaven-p9gr2p.jpg" -o output.png -e -c -b 1.5</code>
terminal output (just omit the output option):
<code>bash
glyph -i "https://w.wallhaven.cc/full/p9/wallhaven-p9gr2p.jpg" -e -c -b 1.5</code>
### Video
with an input video (no urls allowed):
<code>bash
glyph -i /path/to/input/video.mp4 -o ascii.mp4 --codec hevc_nvenc --keep_audio</code>
with an input video and rendering on the terminal (stretched to fit terminal):
<code>bash
glyph -i /path/to/input/video.mp4 --stretched -c</code>
with input video and custom ffmpeg encoder options:
<code>bash
glyph -i /path/to/input/video.mp4 -o ascii.mp4 -c --codec libx264 --keep_audio-- -preset fast -crf 20</code>
with input video and custom ffmpeg encoder options:
<code>bash
glyph -i /path/to/input/video.mp4 -o ascii.mp4 -c --codec libx264 --keep_audio-- -preset fast -crf 20</code>
<ol>
<li>the program will generate an ascii art version of your input media and save it as a new media file.</li>
</ol>
for images: output file needs to be a <code>.png</code> since i saw some weird issues with jpegs.
<ol>
<li>using the long arguments on windows may or may not work. please use the short arguments for now.</li>
</ol> | [] |
https://avatars.githubusercontent.com/u/35976402?v=4 | fancy-cat | freref/fancy-cat | 2024-11-02T21:31:32Z | PDF reader for terminal emulators using the Kitty image protocol | master | 17 | 348 | 10 | 348 | https://api.github.com/repos/freref/fancy-cat/tags | AGPL-3.0 | [
"zig",
"zig-package"
] | 151 | false | 2025-05-20T00:10:46Z | true | true | 0.14.0 | github | [
{
"commit": "6a37605dde55898dcca4769dd3eb1e333959c209.tar.gz",
"name": "vaxis",
"tar_url": "https://github.com/freref/libvaxis/archive/6a37605dde55898dcca4769dd3eb1e333959c209.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/freref/libvaxis"
},
{
"commit": "6d5b49ed5a8ee3ed08... |
📑
fancy-cat
PDF viewer for terminals using the Kitty image protocol
Usage
<code>sh
fancy-cat <path-to-pdf> <optional-page-number></code>
Commands
fancy-cat uses a modal interface similar to Neovim. There are two modes: view mode and command mode. To enter command mode you type <code>:</code> by default (this can be changed in the config file)
Available Commands
<ul>
<li><code>:<page-number></code> - jump to the specified page number</li>
<li><code>:q</code> - quit the application</li>
</ul>
Configuration
fancy-cat can be configured through a JSON config file located at <code>~/.config/fancy-cat/config.json</code>. The file is automatically created on the first run with default settings.
The default <code>config.json</code> can be found <a>here</a> and documentation on the config options can be found <a>here</a>
Installation
<code>fancy-cat</code> is available in the following repositories:
<a></a>
Nix
Available as a Nix package <a>here</a>.
Build Instructions
Requirements
<ul>
<li>Zig version <code>0.14.0</code></li>
<li>Terminal emulator with the Kitty image protocol (e.g. Kitty, Ghostty, WezTerm, etc.)</li>
</ul>
Build
<ol>
<li>Fetch submodules:</li>
</ol>
<code>git submodule update --init --recursive</code>
<ol>
<li>Build the project:</li>
</ol>
<code>sh
zig build --release=small</code>
<blockquote>
<span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span>
There is a <a>known issue</a> with some processors; if the build fails on step 7/10 with the error <code>LLVM ERROR: Do not know how to expand the result of this operator!</code> then try the command below instead:
<code>sh
zig build -Dcpu="skylake" --release=small</code>
</blockquote>
<ol>
<li>Install:</li>
</ol>
```sh
Add to your PATH
Linux
mv zig-out/bin/fancy-cat ~/.local/bin/
macOS
mv zig-out/bin/fancy-cat /usr/local/bin/
```
Run
<code>sh
zig build run -- <path-to-pdf> <optional-page-number></code>
Features
<ul>
<li>✅ Filewatch (hot-reload)</li>
<li>✅ Runtime config</li>
<li>✅ Custom keymappings</li>
<li>✅ Modal interface</li>
<li>✅ Commands</li>
<li>✅ Colorize mode (dark-mode)</li>
<li>✅ Status bar</li>
<li>✅ Page navigation (zoom, prev, next, etc.)</li>
</ul>
License
<a>AGPL-3.0-or-later</a>
Contributing
Contributions are welcome. | [] |
https://avatars.githubusercontent.com/u/54114156?v=4 | SDL | castholm/SDL | 2024-12-14T16:03:37Z | SDL ported to the Zig build system | main | 3 | 235 | 8 | 235 | https://api.github.com/repos/castholm/SDL/tags | NOASSERTION | [
"sdl",
"sdl3",
"zig",
"zig-package"
] | 100,898 | true | 2025-05-22T08:23:54Z | true | true | 0.14.0 | github | [
{
"commit": "085212f286621835f2638cb0cfff078fe515341a",
"name": "sdl_linux_deps",
"tar_url": "https://github.com/castholm/SDL_linux_deps/archive/085212f286621835f2638cb0cfff078fe515341a.tar.gz",
"type": "remote",
"url": "https://github.com/castholm/SDL_linux_deps"
}
] |
SDL ported to the Zig build system
This is a port of <a>SDL</a> to the Zig build system, packaged for the Zig package manager.
Usage
Requires Zig 0.14.0 or 0.15.0-dev (master).
<code>sh
zig fetch --save git+https://github.com/castholm/SDL.git</code>
<code>zig
const sdl_dep = b.dependency("sdl", .{
.target = target,
.optimize = optimize,
//.preferred_linkage = .static,
//.strip = null,
//.pic = null,
//.lto = null,
//.emscripten_pthreads = false,
//.install_build_config_h = false,
});
const sdl_lib = sdl_dep.artifact("SDL3");
const sdl_test_lib = sdl_dep.artifact("SDL3_test");</code>
Examples
Example projects using this SDL package:
<ul>
<li><a>castholm/zig-examples/breakout</a></li>
<li><a>castholm/zig-examples/snake</a></li>
<li><a>castholm/zig-examples/opengl-hexagon</a></li>
</ul>
Supported targets
Target \ Host|Windows|Linux|macOS
-|:-:|:-:|:-:
<code>x86_64-windows-gnu</code>|✅|✅|✅
<code>aarch64-windows-gnu</code>|🧪|🧪|🧪
<code>x86_64-linux-gnu</code>|✅|✅|✅
<code>aarch64-linux-gnu</code>|🧪|🧪|🧪
<code>x86_64-macos-none</code>|❌|❌|🉑
<code>aarch64-macos-none</code>|❌|❌|🉑
<code>wasm32-emscripten-musl</code>|🉑|🉑|🉑
<code>wasm64-emscripten-musl</code>|🉑|🉑|🉑
Legend:
<ul>
<li>✅ Supported</li>
<li>🉑 Supported, but requires external SDKs</li>
<li>🧪 Experimental</li>
<li>❌ Not supported</li>
</ul>
Windows
Building for x86-64 Windows from any host system works out of the box. AArch64 Windows support is experimental and not yet actively tested.
Linux
Building for x86-64 Linux from any host system works out of the box. AArch64 Linux support is experimental and not yet actively tested.
The <a>SDL_linux_deps</a> package provides supplementary headers and source files required for compiling for Linux.
macOS
Building for x86-64 or AArch64 macOS requires Xcode 14.1 or later to be installed on the host macOS system.
<blockquote>
<span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span>
<strong>Cross-compiling for macOS from Windows or Linux host systems is not supported</strong> because <a>the Xcode and Apple SDKs Agreement</a> explicitly prohibits using macOS SDK files from non-Apple-branded computers or devices.
</blockquote>
When building for non-native macOS targets (for example for x86-64 from an AArch64 Mac), you need to provide a path to the macOS SDK sysroot via <code>--sysroot</code>:
<code>sh
sysroot_path=$(xcrun --sdk macosx --show-sdk-path)
zig build -Dtarget=x86_64-macos --sysroot "$sysroot_path"</code>
Emscripten (web)
<blockquote>
<span class="bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300">IMPORTANT</span>
Before you continue, please understand that <strong>Emscripten is an advanced target</strong> and that <strong>building an SDL app for the Web is significantly more complicated compared to Windows, Linux or macOS</strong>:
<ul>
<li>You will need to compile your app into a static library instead of an executable.</li>
<li>If you use libc headers (e.g. by translating C code to Zig), you will need to add the <code>include</code> directory inside the Emscripten sysroot to your header search paths.</li>
<li>To build the final HTML/JS/Wasm artifacts, you will need to invoke <code>emcc</code> using run steps.</li>
<li>You will likely need to do a lot of your own research and try out different combinations of <code>emcc</code> options to get satisfactory results. Make sure you read <a>the official Emscripten documentation</a> as well as <a>SDL's README on Emscripten</a>.</li>
</ul>
In addition, note that Emscripten 4.0.4 or later will provide its own official port of SDL3 if you pass <code>--use-port=sdl3</code> to <code>emcc</code>. Depending on your use case, <strong>you might not even need this package at all</strong>.
Refer to <a>the example projects</a> for examples on how to set up your <code>build.zig</code> for building for the Web.
</blockquote>
Building for Emscripten requires an Emscripten development environment to be set up on the host system. It is strongly recommended that you use <a>the Emscripten SDK</a> to install and manage Emscripten.
When building for Emscripten, you need to provide a path to the Emscripten sysroot via <code>--sysroot</code>:
<code>sh
cache_path=$(em-config CACHE)
sysroot_path="$cache_path/sysroot"
zig build -Dtarget=wasm32-emscripten --sysroot "$sysroot_path"</code>
Depending on the state of your Emscripten cache, you might need to run <code>embuilder build sysroot</code> to ensure that the Emscripten sysroot is built before you run <code>zig build</code>.
To build with <a>pthreads support</a>, specify <code>.emscripten_pthreads = true</code>.
License
This repository is <a>REUSE-compliant</a>. The effective SPDX license expression for the repository as a whole is:
<code>(BSD-3-Clause OR GPL-3.0 OR HIDAPI) AND Apache-2.0 AND BSD-3-Clause AND CC0-1.0 AND HIDAPI AND HPND-sell-variant AND MIT AND SunPro AND Zlib</code>
(This is identical to the upstream SDL repository, just expressed in more explicit terms.)
Copyright notices and license texts have been reproduced in <a><code>LICENSE.txt</code></a>, for your convenience. | [
"https://github.com/Wordluc/Boo",
"https://github.com/braheezy/zpix"
] |
https://avatars.githubusercontent.com/u/104849437?v=4 | gremlin.zig | octopus-foundation/gremlin.zig | 2024-11-14T20:42:25Z | A zero-dependency Google Protocol Buffers implementation in pure Zig. Single allocation encode and lazy decode | master | 1 | 198 | 14 | 198 | https://api.github.com/repos/octopus-foundation/gremlin.zig/tags | MIT | [
"zig",
"zig-package"
] | 210 | false | 2025-05-11T17:36:27Z | true | true | 0.14.0 | github | [] | gremlin
A zero-dependency Google Protocol Buffers implementation in pure Zig (no protoc required)
Installation & Setup
Single command setup:
<code>bash
zig fetch --save https://github.com/octopus-foundation/gremlin.zig/archive/refs/tags/0.0.0.tar.gz</code>
This command will:
1. Download gremlin
2. Add it to your <code>build.zig.zon</code>
3. Generate the correct dependency hash
In your <code>build.zig</code>:
```zig
const std = @import("std");
const ProtoGenStep = @import("gremlin").ProtoGenStep;
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
<code>// Get the parser dependency
const gremlin_dep = b.dependency("gremlin", .{
.target = target,
.optimize = optimize,
}).module("gremlin");
// Generate Zig code from .proto files
// This will process all .proto files in the proto/ directory
// and output generated Zig code to src/gen/
const protobuf = ProtoGenStep.create(
b,
.{
.proto_sources = b.path("proto"), // Directory containing .proto files
.target = b.path("src/gen"), // Output directory for generated Zig code
},
);
// Create binary
const exe = b.addExecutable(.{
.name = "example",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
// Add the parser module
exe.root_module.addImport("gremlin", gremlin_dep);
exe.step.dependOn(&protobuf.step);
b.installArtifact(exe);
</code>
}
```
Features
<ul>
<li>Zero dependencies</li>
<li>Pure Zig implementation (no protoc required)</li>
<li>Compatible with Protocol Buffers version 2 and 3</li>
<li>Simple integration with Zig build system</li>
<li>Single! allocation for serialization (including complex recursive messages)</li>
<li>Lazy parsing - parses only required complex fields</li>
<li>Tested with Zig 0.14.0-dev</li>
</ul>
Generated code
See the complete working example in the <a><code>example</code></a> folder.
Given a protobuf definition:
```protobuf
syntax = "proto3";
message User {
string name = 1;
uint64 id = 2;
repeated string tags = 10;
}
```
Gremlin will generate equivalent Zig code (see <a>example.proto.zig</a>):
```zig
const std = @import("std");
const gremlin = @import("gremlin");
// Wire numbers for fields
const UserWire = struct {
const NAME_WIRE: gremlin.ProtoWireNumber = 1;
const ID_WIRE: gremlin.ProtoWireNumber = 2;
const TAGS_WIRE: gremlin.ProtoWireNumber = 10;
};
// Message struct
pub const User = struct {
name: ?[]const u8 = null,
id: u64 = 0,
tags: ?[]const ?[]const u8 = null,
<code>// Calculate size for allocation
pub fn calcProtobufSize(self: *const User) usize { ... }
// Encode to new buffer
pub fn encode(self: *const User, allocator: std.mem.Allocator) gremlin.Error![]const u8 { ... }
// Encode to existing buffer
pub fn encodeTo(self: *const User, target: *gremlin.Writer) void { ... }
</code>
};
// Reader for lazy parsing
pub const UserReader = struct {
allocator: std.mem.Allocator,
buf: gremlin.Reader,
_name: ?[]const u8 = null,
_id: u64 = 0,
_tags: ?std.ArrayList([]const u8) = null,
<code>pub fn init(allocator: std.mem.Allocator, src: []const u8) gremlin.Error!UserReader { ... }
pub fn deinit(self: *const UserReader) void { ... }
// Accessor methods
pub inline fn getName(self: *const UserReader) []const u8 { ... }
pub inline fn getId(self: *const UserReader) u64 { ... }
pub fn getTags(self: *const UserReader) []const []const u8 { ... }
</code>
};
``` | [] |
https://avatars.githubusercontent.com/u/196498040?v=4 | tardy | tardy-org/tardy | 2024-10-09T21:43:08Z | An asynchronous runtime for writing applications and services. Supports io_uring, epoll, kqueue, and poll for I/O. | main | 4 | 186 | 11 | 186 | https://api.github.com/repos/tardy-org/tardy/tags | MPL-2.0 | [
"async",
"coroutines",
"epoll",
"io-uring",
"kqueue",
"net",
"runtime",
"tardy",
"zig",
"zig-package"
] | 601 | false | 2025-05-18T20:35:28Z | true | true | 0.14.0 | github | [] | tardy
tardy <em>(def: delaying or delayed beyond the right or expected time; late.)</em> is an asynchronous runtime for writing applications and services in Zig.
Most of the code for this project originated in <a>zzz</a>, a performance oriented networking framework.
<ul>
<li>tardy utilizes the latest Asynchronous APIs while minimizing allocations.</li>
<li>tardy natively supports Linux, Mac, BSD, and Windows.</li>
<li>tardy is configurable, allowing you to optimize the runtime for your specific use-case.</li>
</ul>
<a></a>
Summary
tardy is a thread-local, I/O driven runtime for Zig, providing the core implementation for asynchronous libraries and services.
- Per-thread Runtime isolation for minimal contention
- Native async I/O (io_uring, epoll, kqueue, poll, etc.)
- Asynchronous <code>Socket</code>s and <code>File</code>s.
- Coroutines (internally called Frames).
Installing
Compatible Zig Version: <code>0.14.0</code>
Latest Release: <code>0.3.0</code>
<code>zig fetch --save git+https://github.com/tardy-org/tardy#v0.3.0</code>
You can then add the dependency in your <code>build.zig</code> file:
```zig
const tardy = b.dependency("tardy", .{
.target = target,
.optimize = optimize,
}).module("tardy");
exe_mod.addImport("tardy", tardy);
```
Building and Running Examples
<ul>
<li>
NOTE: by default build/install step uses <code>-Dexample=none</code> , meaning it wont build any examples
</li>
<li>
List available examples
<code>sh
zig build --help</code>
</li>
<li>
Build/run a specific example
<code>sh
zig build -Dexample=[nameOfExample]</code>
<code>sh
zig build run -Dexample=[nameOfExample]</code>
</li>
<li>
Build all examples
<code>sh
zig build -Dexample=all</code>
</li>
</ul>
TCP Example
A basic multi-threaded TCP echo server.
```zig
const std = @import("std");
const log = std.log.scoped(.@"tardy/example/echo");
const Pool = @import("tardy").Pool;
const Runtime = @import("tardy").Runtime;
const Task = @import("tardy").Task;
const Tardy = @import("tardy").Tardy(.auto);
const Cross = @import("tardy").Cross;
const Socket = @import("tardy").Socket;
const Timer = @import("tardy").Timer;
const AcceptResult = @import("tardy").AcceptResult;
const RecvResult = @import("tardy").RecvResult;
const SendResult = @import("tardy").SendResult;
fn echo_frame(rt: <em>Runtime, server: </em>const Socket) !void {
const socket = try server.accept(rt);
defer socket.close_blocking();
<code>// you can use the standard Zig Reader/Writer if you want!
const reader = socket.reader(rt);
const writer = socket.writer(rt);
log.debug(
"{d} - accepted socket [{}]",
.{ std.time.milliTimestamp(), socket.addr },
);
try rt.spawn(.{ rt, server }, echo_frame, 1024 * 16);
var buffer: [1024]u8 = undefined;
while (true) {
const recv_length = reader.read(&buffer) catch |e| {
log.err("Failed to recv on socket | {}", .{e});
return;
};
writer.writeAll(buffer[0..recv_length]) catch |e| {
log.err("Failed to send on socket | {}", .{e});
return;
};
log.debug("Echoed: {s}", .{buffer[0..recv_length]});
}
</code>
}
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
defer _ = gpa.deinit();
<code>// tardy by default is
// - multithreaded
// - unbounded in terms of spawnable tasks
var tardy = try Tardy.init(allocator, .{});
defer tardy.deinit();
const server = try Socket.init(.{ .tcp = .{ .host = "127.0.0.1", .port = 9862 } });
try server.bind();
try server.listen(256);
try tardy.entry(
&server,
struct {
fn start(rt: *Runtime, tcp_server: *const Socket) !void {
try rt.spawn(.{ rt, tcp_server }, echo_frame, 1024 * 1024 * 4);
}
}.start,
);
</code>
}
```
There exist a lot more examples, highlighting a variety of use cases and features <a>here</a>. For an example of tardy in use, you can check out any of the projects in the <a>ecosystem</a>.
Ecosystem
<ul>
<li><a>zzz</a>: a framework for writing performant and reliable networked services.</li>
<li><a>secsock</a>: Async TLS for the Tardy Socket.</li>
</ul>
Contribution
We use Nix Flakes for managing the development environment. Nix Flakes provide a reproducible, declarative approach to managing dependencies and development tools.
Prerequisites
<ul>
<li>Install <a>Nix</a>
<code>bash
sh <(curl -L https://nixos.org/nix/install) --daemon</code></li>
<li>Enable <a>Flake support</a> in your Nix config (<code>~/.config/nix/nix.conf</code>): <code>experimental-features = nix-command flakes</code></li>
</ul>
Getting Started
<ol>
<li>
Clone this repository:
<code>bash
git clone https://github.com/tardy-org/tardy.git
cd tardy</code>
</li>
<li>
Enter the development environment:
<code>bash
nix develop</code>
</li>
</ol>
This will provide you with a shell that contains all of the necessary tools and dependencies for development.
Once you are inside of the development shell, you can update the development dependencies by:
1. Modifying the <code>flake.nix</code>
2. Running <code>nix flake update</code>
3. Committing both the <code>flake.nix</code> and the <code>flake.lock</code>
License
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tardy by you, shall be licensed as MPL2.0, without any additional terms or conditions. | [
"https://github.com/tardy-org/secsock",
"https://github.com/tardy-org/zzz"
] |
https://avatars.githubusercontent.com/u/184196411?v=4 | io | Super-ZIG/io | 2024-11-18T11:03:45Z | Easy input/output in ZIG. | main | 0 | 175 | 6 | 175 | https://api.github.com/repos/Super-ZIG/io/tags | MIT | [
"io",
"lib",
"string",
"terminal",
"zig"
] | 7,194 | false | 2025-05-22T06:39:38Z | true | true | 0.14.0 | github | [] |
<a>
</a>
<a>
</a>
<b>
When simplicity meets efficiency
</b>
<b>
<i>
part of <a>SuperZIG</a> framework
</i>
</b>
<ul>
<li>
<strong>🍃 Zero dependencies</strong>—meticulously crafted code.
</li>
<li>
<strong>🚀 Blazing fast</strong>—almost as fast as light!
</li>
<li>
<strong>🌍 Universal compatibility</strong>—Windows, Linux, and macOS.
</li>
<li>
<strong>🛡️ Battle-tested</strong>—ready for production.
</li>
</ul>
<ul>
<li>
API
<ul>
<li>
String
<ul>
<li>
Types
<blockquote>
<ul>
<li>
view
</li>
<li>
fixed
</li>
<li>
managed
</li>
<li>
unmanaged
</li>
</ul>
</blockquote>
</li>
<li>
Utils
</li>
<li>
<a>ascii</a>
</li>
<li>
<a>utf8</a>
<blockquote>
<ul>
<li>
codepoint
</li>
<li>
grapheme
</li>
<li>
memory
</li>
</ul>
</blockquote>
</li>
</ul>
</li>
<li>
Terminal
<ul>
<li>
App
<blockquote>
<ul>
<li>
cli
</li>
<li>
prompts
</li>
</ul>
</blockquote>
</li>
<li>
Utils
<blockquote>
<ul>
<li>
ansi
</li>
<li>
print
</li>
<li>
info
</li>
<li>
settings
</li>
<li>
events
</li>
</ul>
</blockquote>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li>
Benchmark
<blockquote>
A quick summary with sample performance test results between <em><strong><code>SuperZIG</code>.<code>io</code></strong></em> implementations and its popular competitors.
</blockquote>
| Implementation | Competitor | Result |
| -------------------------------------------------------------------------------- | ------------- | ---------------------- |
| <a><code>io.string.ascii</code></a> | <code>std.ascii</code> | same speed |
| <a><code>io.string.utf8</code></a> | <code>std.unicode</code> | <strong>x5 faster ⚡</strong> |
</li>
</ul>
<a>
</a>
| [
"https://github.com/allyourcodebase/boost-libraries-zig",
"https://github.com/kassane/beast"
] |
https://avatars.githubusercontent.com/u/27973237?v=4 | translate-c | ziglang/translate-c | 2024-11-05T21:34:19Z | A Zig package for translating C code into Zig code. | main | 0 | 174 | 11 | 174 | https://api.github.com/repos/ziglang/translate-c/tags | MIT | [
"c",
"zig"
] | 414 | false | 2025-05-21T17:52:47Z | true | true | 0.15.0-dev.460+f4e9846bc | github | [
{
"commit": "0ba11fd46816886829277f88213302011d4c8c9d",
"name": "aro",
"tar_url": "https://github.com/Vexu/arocc/archive/0ba11fd46816886829277f88213302011d4c8c9d.tar.gz",
"type": "remote",
"url": "https://github.com/Vexu/arocc"
}
] | Translate-C
<blockquote>
<span class="bg-yellow-100 text-yellow-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-yellow-900 dark:text-yellow-300">WARNING</span>
This project is WIP and not ready for general use only passing ~92% (355/383) of the current tests.
</blockquote>
A Zig package for translating C code into Zig code intended to replace <code>@cImport</code> and <code>zig translate-c</code>.
Usage examples
<ul>
<li><a>import header</a></li>
<li><a>compile c</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/1638331?v=4 | wasmbots | sjml/wasmbots | 2024-10-03T03:33:20Z | wasm. bots. 🤖🧙♂️🧚🧙♀️⚔️🏰🤖 | main | 2 | 167 | 12 | 167 | https://api.github.com/repos/sjml/wasmbots/tags | MIT | [
"assemblyscript",
"c",
"golang",
"roguelike",
"rust",
"svelte",
"typescript",
"webassembly",
"zig"
] | 7,698 | false | 2025-05-11T02:02:33Z | false | false | unknown | github | [] | WasmBots
(NB: this repo is active, but progress may be a little slow. <a>see this video for more specifics.</a>)
<a>A multi-wizard arena where all the competitors are bots!</a> (Always a latest build at <a>GitHub Pages</a>, but that site is the canonical deployment.)
<a>The programming interface is described here</a>, and there are <a>pre-made libraries in a bunch of languages</a> to get you started. You can also peruse <a>the code for the example bots</a>.
The <a>documentation can also be useful</a>, or maybe just <a>the development history</a>.,
Development
It's a big ole monorepo. Sorry about that; it's what happens when a proof-of-concept just grows organically. I presumptively registered a <a>wasmbots org on GitHub</a> just in case this becomes A Thing™ in which case I'll split things out more productively.
Devbox
You can always build and run with <a>devbox</a>. (<a>Installation instructions are here.</a>)
Run <code>devbox shell</code> to be in a usable environment where you can run
Docker
The <a>Dockerfile</a> just pipes everything through devbox, but makes it a little more turnkey, especially if you're already a Docker user.
```sh
produces a container with a built frontend,
including example bots, served with Caddy
docker build -t wasmbots .
to actually get it serving:
docker run -d -p 8080:80 wasmbots
Then look for it in your favorite browser at:
<code>http://localhost:8080</code>
(change out the port number to whatever you want)
```
```sh
this will drop you into a shell within the container
where all the tools are installed and paths are set
and everything.
docker build --target dev -t wasmbots-dev .
docker run -it -v $PWD:/code wasmbots-dev
```
Manual Installation
If you don't want to install a whole other package manager, here's what I (used to) use to get up and running with <a>Homebrew</a> on macOS. Modify appropriately if you're using something else.
<code>sh
brew install deno node wabt emscripten rust zig go tinygo-org/tools/tinygo</code>
Simple Checks
Regardless of how you get your dev environment running, you can verify everything is working as expected by running:
<code>./scripts/_build_wasms.sh
./scripts/_validate_wasms.sh</code>
That will build and validate all the example bots; it doesn't check their functionality at all, just that WebAssembly modules were produced that conform to <a>the expected interface</a>. | [] |
https://avatars.githubusercontent.com/u/23725145?v=4 | leviathan | kython28/leviathan | 2024-10-08T17:19:06Z | A lightning-fast Zig-powered event loop for Python's asyncio. | master | 1 | 159 | 4 | 159 | https://api.github.com/repos/kython28/leviathan/tags | MIT | [
"asyncio",
"iouring",
"python",
"zig",
"ziglang"
] | 5,101 | false | 2025-05-14T19:20:37Z | true | true | unknown | github | [
{
"commit": "refs",
"name": "jdz_allocator",
"tar_url": "https://github.com/kython28/jdz_allocator/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/kython28/jdz_allocator"
}
] |
From the depths of the sea, where darkness meets vastness, emerges Leviathan: an unyielding force of speed and power. In a world where the arcane and the agile intertwine, a loop forged in Python takes its dance. Leviathan, master of the journey, governs events with a steady hand—an <strong>ultra-fast event loop</strong> that deploys its bastion in <strong>asyncio</strong>, powered by the artistry of Zig. Between promises and futures, its path is clear: to rule swiftly where code is prepared.
🚀 Features
<ul>
<li><strong>Ultra-fast speed</strong>: Thanks to low-level optimizations enabled by Zig.</li>
<li><strong>Full asyncio compatibility</strong>: A drop-in replacement for the default event loop.</li>
<li><strong>Efficient design</strong>: Focused on maximizing performance and minimizing latency.</li>
<li><strong>Simplicity</strong>: Easy integration with existing Python projects.</li>
<li><strong>Robust Safety</strong>: Carefully engineered for critical systems with advanced error recovery and graceful degradation mechanisms.</li>
</ul>
📜 Requirements
<ul>
<li>Python >= 3.13</li>
<li>Zig >= 0.14.0 (for development or contributions)</li>
<li>Linux >= 5.11</li>
</ul>
🔧 Installation
To install Leviathan, just execute:
<code>bash
python setup.py install</code>
📦 Basic Usage
```python
import leviathan
import asyncio
async def main():
print("Hello from Leviathan!")
await asyncio.sleep(1)
print("Goodbye from Leviathan!")
leviathan.run(main())
```
🧪 Benchmarks
Leviathan stands out for its speed and performance. Here is a preliminary chart illustrating its superiority over other event loops:
For more information and additional tests, check the following file: <a>More benchmarks and details</a>.
⚠️ <strong>Warning</strong>: Leviathan is still under active development. Some integrations, such as full networking support, are pending implementation. | [] |
https://avatars.githubusercontent.com/u/5785605?v=4 | zig-learning | zouyee/zig-learning | 2024-11-27T03:21:33Z | A bunch of links to blog posts, articles, videos, etc for learning Zig | main | 1 | 131 | 9 | 131 | https://api.github.com/repos/zouyee/zig-learning/tags | - | [
"book",
"learn",
"learning",
"teaching",
"teaching-materials",
"toturial",
"zig",
"ziglang"
] | 95 | false | 2025-05-20T02:27:43Z | false | false | unknown | github | [] | zig-learning <a></a>
A bunch of links to blog posts, articles, videos, etc for learning Zig. Feel free to submit a pull request if you have some links/resources to add. Also, I try to verify that the articles below have some real content (i.e. they aren't 2 paragraph long blog posts with little information) to ensure I'm not listing "fluff" pieces. If you have an idea for a better way to organize these links, please let me know. <strong>Inspired</strong> by rust-learning.
Introduction
<em>Do you want to be convinced that Zig is worth learning?</em> Let us show you the <a>Comparison</a>).
The main documentation is always the best beginning, so if you haven't read it yet, start by reading the <a>Zig learn</a>). Online learning resources <a>here</a> and <a>here</a>.
Tag meanings
<ul>
<li>:star: Something made by repo owner member.</li>
<li>:end: Concepts are still useful but code could not compile.</li>
<li>:soon: Work In Progress.</li>
</ul>
Table of Contents
<ul>
<li><a>Books</a></li>
<li><a>Videos</a></li>
<li><a>Playlists</a></li>
<li><a>Presentations</a></li>
<li><a>Podcasts</a></li>
<li><a>Zig in practice</a></li>
<li><a>Best Practices/Style Guides</a></li>
<li><a>Cheat sheets</a></li>
<li><a>Zig internals</a></li>
<li><a>Compilation</a></li>
<li><a>FFI</a></li>
<li><a>CI / Testing</a></li>
<li><a>Debug / Profiling</a></li>
<li><a>Are we ... yet?</a></li>
<li><a>Comparison with Other Languages</a></li>
<li><a>Applications / Libraries / Tools</a></li>
<li><a>Language stuff</a></li>
<li><a>Closures</a></li>
<li><a>Documentation</a></li>
<li><a>Enums</a></li>
<li><a>Errors</a></li>
<li><a>Iterators</a></li>
<li><a>Memory</a></li>
<li><a>Comptime</a></li>
<li><a>Strings</a></li>
<li><a>Syntax extensions</a></li>
<li><a>Optional</a></li>
<li><a>Playground</a></li>
<li><a>Locale links</a></li>
<li><a>Connection</a></li>
<li><a>Fearless Zig Bloggers</a></li>
<li><a>Tutorials & Workshop Materials</a></li>
</ul>
Books
<ul>
<li>:star: <a>Learning Zig</a> - Introduction to Zig aimed at developers coming from garbage collected languages.</li>
<li>:star: <a>Zig Programming Language</a> - An introductory book on Zig, covering the basics to advanced topics.</li>
<li>:star: <a>Zig by Example</a> - A hands-on guide with examples to learn Zig.</li>
<li>:star: <a>zig-cookbook</a> - Simple Zig programs that demonstrate good practices to accomplish common programming tasks.</li>
</ul>
Videos
<ul>
<li>:star: <a>Introduction to Zig</a> - A video introduction to Zig and its features.</li>
<li>:star: <a>Zig ShowTime</a> - A playlist of talks and tutorials on Zig by community members.</li>
<li>:star: <a>Zig Roadmap 2024(Andrew Kelley)</a></li>
<li>:star:<a>Is 2024 The Year Of Zig ?</a></li>
<li><a>Advent of Code 2023 in Zig</a></li>
</ul>
Playlists
<ul>
<li>:star:<a>Zig Programming Language</a></li>
</ul>
Presentations
<ul>
<li>2023-10-04 - <a>Rust & Zig Combined • Richard Feldman • GOTO 2023</a> - Richard Feldman</li>
<li>2022-10-04 - <a>Intro to the Zig Programming Language • Andrew Kelley • GOTO 2022</a>- Andrew Kelley</li>
<li>2019-04-23 - <a>Andrew Kelley - The Zen of Zig</a> - A presentation by the creator of Zig, explaining its philosophy and features.</li>
<li>2024-09-30 - <a>Pragma driven shared memory parallelism in Zig by supporting OpenMP loop directives</a> - In this paper they describe enhancing the Zig compiler to add support for OpenMP loop directives.</li>
</ul>
Podcasts
<ul>
<li>2024-07-14 - <a>Zig as a Multi-OS Build System (with Loris Cro)</a> - Loris Cro</li>
<li>2022-07-01 - <a>Full-Time Open Source With Andrew Kelley</a></li>
<li>2022-06-24 - <a>Zig with Andrew Kelley</a></li>
<li>2022-01-24 - <a>Zig and Zigler with Isaac Yonemoto</a> - Isaac Yonemoto</li>
</ul>
Zig in practice
<ul>
<li>:star: <a>Zig By Example</a></li>
<li><a>Why your first FizzBuzz implementation may not work</a></li>
<li>:star: <a>Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one</a> - Brian Anderson</li>
<li>:star: <a>Building an HTTP client/server from scratch</a> - A practical guide to building a web server in Zig.</li>
<li><a>Writing a struct deserializer with Zig metaprogramming</a></li>
<li><a>Starting a new game dev project</a> - A practical guide to building a new game dev project</li>
<li><a>Exploring Zig Programming Language with The Mandelbrot Set</a> - Explore Zig by building a program that plots the Mandelbrot set</li>
</ul>
Best Practices/Style Guides
<ul>
<li>:star: <a>Zig Design Patterns</a></li>
<li>:star: <a>zig-common-tasks</a> - <a>renatoathaydes</a></li>
<li>:star: <a>Zig API guidelines</a></li>
<li><a>Reading Zig Function Signatures</a> - Val</li>
<li><a>Good Practices for consuming C libraries</a> - <a>cztomsik</a></li>
<li><a>Zig Bits</a></li>
<li><a>Best Practices for Structuring Zig Projects with External Dependencies</a> - castholm</li>
<li><a>Comparing Rust vs. Zig: Performance, safety, and more</a> - Eze</li>
<li><a>Memory Safety in C++ vs Rust vs Zig</a></li>
<li><a>A TypeScripter's Take on Zig (Advent of Code 2023)</a></li>
<li><a>Zig in Depth: A video course that covers the Zig programming language in depth.</a></li>
</ul>
Cheat sheets
<ul>
<li>:star: <a>Syntax Index</a> - Official documentation covering Zig's syntax and key concepts.</li>
<li><a>Zig Learn</a> - A community-maintained guide for beginners, offering an introduction to Zig's core features with practical examples.</li>
<li><a>Zig by Example</a> - A collection of simple and concise Zig code examples for learning and reference.</li>
<li><a>Zig Standard Library Overview</a> - A detailed overview of Zig’s standard library, ideal for understanding built-in utilities and functions.</li>
<li><a>Zig Cheat Sheet</a> - A handy reference guide with key Zig programming concepts and syntax patterns, created by a Zig community member.</li>
<li><a>Zig Language Patterns</a> - Best practices and design patterns written by Andrew Kelley, the creator of Zig.</li>
<li><a>Zig Playground</a> - An online environment for experimenting with Zig code snippets and testing ideas quickly.</li>
<li><a>Community Zig Tutorials</a> - A portal for discovering new Zig tutorials and community-driven content.</li>
<li><a>Zig Memory Management Guide</a> - Useful tips and tricks for managing memory safely and efficiently in Zig.</li>
</ul>
Zig internals
<ul>
<li>:star: <a>Zig Proposals</a> - A collection of Zig’s proposed RFCs (Request for Comments) for proposals.</li>
<li>:star: <a>Zig Documentation</a> - The official and comprehensive documentation for understanding Zig’s features and syntax.</li>
<li>:star: <a>Zig Community Forum</a> - A discussion platform for Zig language design, development news, and technical questions.</li>
</ul>
Compilation
<ul>
<li>
<a>Zig Compilation Guide</a> - Zig official documentation. This guide provides detailed information on how to set up compilation with Zig. It includes basic steps, toolchain setup, and target options.
</li>
<li>
<strong><a>Zig for Raspberry Pi</a></strong> - A community-driven project that shows how to cross-compile Zig programs for the Raspberry Pi, with a setup for cross-compiling Zig on Linux.
</li>
<li>
<strong><a>Zig Cross Compilation for macOS</a></strong> - This project allows you to cross-compile code on Linux that will be executed on macOS.
</li>
<li>
<strong><a>Zig: Cross-compiling for Systems</a></strong> - A blog post that explores how Zig can be used for multi-systems, Cross-compilation is especially great when you need to release an application that runs on multiple platforms: with Zig you can create all release artifacts from a single machine.
</li>
<li>
<strong><a>Compile Cargo project with zig</a></strong> - It is a tool that facilitates building Rust projects with the Zig toolchain, enabling cross-compilation and optimizations that are typically more straightforward than using Rust's native toolchain alone.
</li>
</ul>
FFI
<ul>
<li>
<strong><a>Using Zig with C: Interop Guide</a></strong> - The official Zig documentation for C interop. Zig provides seamless integration with C, allowing you to call C functions directly and link against C libraries without needing additional tooling.
</li>
<li>
<strong><a>Zig and Node.js: Writing Native Modules</a></strong> - A GitHub issue tracking the integration of Zig with Node.js for native modules. It discusses potential setups for creating fast, native Node.js modules using Zig.
</li>
<li>
<strong><a>Cross-compiling Zig for Mobile Platforms (Android/iOS)</a></strong> - A tutorial by Andrew Kelley on cross-compiling Zig for Android, including setup instructions and guidance on building shared libraries. Though there isn't a direct iOS equivalent yet, the process can be adapted similarly.
</li>
<li>
<strong><a>Zig and Dynamic Libraries: Working with .so and .dll</a></strong> - A blog post that explores how to build dynamic libraries (.so and .dll) using Zig. This is particularly useful when you need to create shared libraries for FFI purposes.
</li>
<li>
<strong><a>Integrating Zig with Rust for FFI</a></strong> - A tutorial on how to create a Rust-Zig integration, using Zig’s FFI to enhance performance or utilize Zig’s unique features.
</li>
<li>
<strong><a>Building and Linking C Libraries with Zig</a></strong> - This ZigLearn chapter shows how to use and link C libraries with Zig, which is helpful when creating bindings or using external C code in a Zig project.
</li>
</ul>
CI / Testing
<ul>
<li>
<strong><a>Setting up Zig with GitHub Actions</a></strong> - A detailed guide on using GitHub Actions for Zig projects. It covers basic configurations for running tests and building Zig code on different platforms.
</li>
<li>
<strong><a>Using Zig with Travis CI</a></strong> - While less common than GitHub Actions, some legacy projects still use Travis CI. Zig's documentation includes pointers on setting up Travis CI for Zig builds.
</li>
<li>
<strong><a>Fuzz Testing in Zig</a></strong> - Official announcement detailing Zig's built-in support for fuzz testing introduced in Zig 0.14. It includes how to use the fuzz testing features and examples of detecting bugs in Zig applications.
</li>
<li>
<strong><a>Test Coverage for Zig Projects</a></strong> - A GitHub issue discussing ideas and strategies for implementing test coverage in Zig. Though Zig doesn’t have built-in support for test coverage yet, there are community-driven approaches and tools you can try.
</li>
<li>
<strong><a>Beautiful Commits and Code Formatting with zig fmt</a></strong> - Zig comes with a built-in formatter, <code>zig fmt</code>, to ensure consistent code style. You can integrate this into your CI setup to enforce formatting rules automatically.
</li>
<li>
<strong><a>Performance Testing in Zig</a></strong> - This project exists to track various benchmarks related to the Zig project regarding execution speed, memory usage, throughput, and other resource utilization statistics.
</li>
<li>
<strong><a>Zig Test Documentation</a></strong> - Zig’s documentation on writing and running tests. It provides an overview of Zig's testing features, including test declarations, assertions, and running tests as part of your CI pipeline.
</li>
</ul>
Debug / Profiling
<ul>
<li>
<strong><a>Zig Debugging with vscode</a></strong> - A gist about using vscode for debugging Zig programs.
</li>
<li>
<strong><a>Zig on Compiler Explorer</a></strong> - Like Rust's Compiler Explorer, Zig is also supported on Compiler Explorer. You can use this to explore Zig code as assembly and view the generated machine code. Simply select Zig as the compiler on the site.
</li>
<li>
<strong><a>Zig Performance Tracking</a></strong> - This project exists to <em>track various benchmarks related to the Zig project</em> regarding execution speed, memory usage, throughput, and other resource.
</li>
<li>
<strong><a>Code Coverage for Zig</a></strong> - Despite the Zig compiler not having built-in support for generating code coverage information, it is still possible to generate it (on Linux at least). There might be other possibilities.
</li>
</ul>
Are we ... yet?
<ul>
<li>
<strong><a>Are We IDE Yet? - Zig</a></strong> - An overview of current IDE support for Zig. It lists plugins and extensions for popular editors like VSCode, Sublime Text, and Vim, tracking the maturity of the Zig developer experience.
</li>
<li>
<strong><a>Are We Game Yet? - Zig</a></strong> - It explores libraries, game engines, and Zig's capabilities for game-related projects.
</li>
<li>
<strong><a>Are We Async Yet? - Zig</a></strong> - Zig's official documentation on asynchronous programming. Zig is still developing its async features, but this section provides an in-depth look at the current state and future goals for asynchronous execution.
</li>
<li>
<strong><a>Awesome Zig</a></strong> - A comprehensive list of curated resources for Zig, covering libraries, tools, tutorials, and more. It's similar to "Not-Yet-Awesome Rust," helping developers find or contribute to Zig projects.
</li>
<li>
<strong><a>Zig GUI Libraries</a></strong> - Capy is a <strong>GUI library for Zig</strong>. It is mainly intended for creating applications using native controls from the operating system. It has been made with the goal to empower standalone UI applications, integration in games or any other rendering process is a non-goal.
</li>
</ul>
Zig Comparison with Other Languages
| <strong>Languages</strong> | <strong>Links</strong> |
| -------------- | ------------------------------------------------------------ |
| <strong>C</strong> | <ul><li><a>Meet Zig: The modern alternative to C</a> - infoWorld </li><li><a>Zig is more pragmatic than C</a> - Andrew Kelley</li><li><a>Zig: Already More Knowable Than C</a> - Andrew Kelley</li><li><a>A "BETTER C" BENCHMARK</a> - Serge</li></ul> |
| <strong>C++</strong> | <ul><li><a>Why Zig When There is Already C++, D, and Rust?</a> - Zig Community</li><li><a>Goodbye to the C++ Implementation of Zig</a> - Zig Community</li><li><a>Memory Safety in C++ vs Rust vs Zig</a> - B Shyam Sundar</li><li><a>Software Reliability C++ vs Zig</a> - Erik Engheim</li></ul> |
| <strong>Go</strong> | <ul><li><a>The Zig and Go Programming Showdown!</a> - ERIK ENGHEIM</li><li><a>Zig Makes Go Cross Compilation Just Work</a> - Loris Cro </li></ul> |
| <strong>Rust</strong> | <ul><li><a>How (memory) safe is zig?</a> - Jamie Brandon</li><li><a>Comparing Rust vs. Zig: Performance, safety, and more</a> - Eze Sunday</li><li><a>Zero Cost Abstractions in C++20, Rust, & Zig</a> - Context Free</li></ul> |
| <strong>Python</strong> | <ul><li><a>How to create Zig Binding for Python to create compiled and optimized libraries</a> - Nicola Landro</li><li><a>Speeding up Python with Zig</a> - Adam Serafini</li></ul> |
| <strong>JavaScript</strong> | <ul><li><a>Access the JS host environment from Zig compiled to WebAssembly.</a> - mitchellh</li><li><a>Zig vs JavaScript</a> - Asher White</li></ul> |
| <strong>Java</strong> | <ul><li>[<a>Zig structs vs Java classes</a> - ziggit.dev</li></ul> |
| <strong>Swift</strong> | <ul><li><a>zig-and-swiftui</a> - mitchellh </li><li><a>Mapping Types between Zig and Swift</a> - Loris Cro</li></ul> |
| <strong>Haskell</strong> | |
| <strong>Ruby</strong> | <ul><li><a>Long story short: I build a Ruby extension with Zig</a> - Paweł Świątkowski</li></ul> |
| <strong>Erlang</strong> | <ul><li><a>Build and Extend Erlang OTP with Zig</a> - Marcel Lanz</li></ul> |
| <strong>Nim</strong> | <ul><li><a>Nim safety features like Zig & Rust?</a> - NimZig Community</li></ul> |
Applications / Libraries / Tools
See repos <a>nrdmn/awesome-zig</a> & <a>zigcc/awesome-zig</a>
Language stuff
Closures
<ul>
<li>:star:<a>Closure Pattern in Zig</a> - <a>Andrew Houghton</a> </li>
<li><a>Implementing Closures and Monads in Zig</a>- <a>Andrew Brent Gossage</a></li>
<li><a>Zig Anonymous Functions and Closures: An In-Depth Analysis</a></li>
</ul>
Documentation
<ul>
<li>:star: <a>Writing Documentation for Zig Projects</a> - Zig Community </li>
<li><a>Generating documentation from zig build</a> - sudw1n </li>
<li><a>Using Zig's Built-in Documentation Generator</a> - docgen</li>
</ul>
Enums
<ul>
<li>:star: <a>The Power of Zig Enums</a> - ziglang.org</li>
<li><a>Extending an Enum in Zig</a> - Fredrik Kihlander </li>
</ul>
Errors
<ul>
<li>:star: <a>Ziglang Document:Errors</a> ziglang.org</li>
<li><a>Error Handling in Zig</a> - zig.guide</li>
<li><a>Support error sets in switch cases</a> - <a>hryx</a></li>
<li><a>Return Values and Error Unions in Zig</a> - gencmurat </li>
<li><a>Error Handling In Zig</a> - <a>karlseguin</a></li>
<li><a>Errors and Zig</a> - <a>Phil Eaton</a></li>
</ul>
Iterators
<ul>
<li>:star:<a>proposal: Streamline loops, and enhance iteration</a> - <a>Tetralux</a></li>
<li>:star:<a>Proposal: Generator / Iterator Syntactic Sugar</a> - <a>kayomn</a></li>
<li><a>How Zig Handles Iteration</a> - zig.guide</li>
<li><a>Zig's Curious Multi-Sequence For Loops</a> - Loris Cro </li>
<li><a>Learning interfaces by implementing iterator in zig</a> - <a>Akhil</a> </li>
</ul>
Memory
<ul>
<li>:star: <a>Memory Management in Zig: A Lifetime-Free Approach</a> - Andrew Kelley</li>
<li>:star:<a>Memory Management in Zig</a> - ziglang documentation</li>
<li><a>Memory Management With Zig</a> - Nathan</li>
<li><a>How (memory) safe is zig?</a> - <a>Jamie Brandon</a></li>
<li><a>Learning Zig - Heap Memory & Allocators</a> - <a>Karl Seguin</a></li>
<li><a>What's a Memory Allocator Anyway?</a> - Benjamin Feng</li>
</ul>
Comptime
<ul>
<li>:star: <a>Zig Programming Language Blurs the Line Between Compile-Time and Run-Time</a> - Andrew Kelley</li>
<li>:star: <a>Conditionally Disabling Code with Comptime in Zig</a> - <a>Mitchell Hashimoto</a></li>
<li>:star: <a>Tagged Union Subsets with Comptime in Zig</a> - <a>Mitchell Hashimoto</a></li>
<li><a>What is <code>comptime</code>?</a> - <a>Loris Cro</a></li>
<li>
<a>Compile-time Programming: A Beginner's Guide to <code>comptime</code> in Zig</a> - Guillaume Chérel
</li>
<li>
<a>Custom String Formatting and JSON Serializing in Zig</a> - Karl Seguin
</li>
<li><a>Exploring Compile-Time Interfaces in Zig</a> - <a>Jerry Thomas</a></li>
<li><a>Zig's Comptime is Bonkers Good</a> - Scott Redig</li>
</ul>
Strings
<ul>
<li><a>Proposal: Add String to the type system</a> - <a>mlarouche</a></li>
<li><a>Unicode String Operations</a> - <a>dude_the_builder</a></li>
<li><a>Using Zig to Call C Code: Strings</a> - <a>Michael Lynch</a></li>
<li><a>How to use hash map contexts to save memory when doing a string table</a> - <a>Andrew Kelley</a></li>
<li><a>Zig / Strings in 5 minutes</a> - <a>Huy</a></li>
<li><a>Pointers in Zig</a> - <a>Nathan</a></li>
</ul>
Syntax Extensions
<ul>
<li><a>Zig Metaprogramming</a> - ikrima</li>
<li><a>Supercharging Python Performance with Zig: Building Python Packages and Benchmarking for Speed</a> - <a>Bassem Aziz</a></li>
</ul>
Optional
<ul>
<li><a>What's up with Zig's Optionals?</a> - Reddit</li>
<li><a>Proposal: Optional argument names in function calls</a></li>
<li><a>Ziglang Document:Optionals</a></li>
</ul>
Playground
<ul>
<li><a>Zig Playground</a></li>
<li><a>alternative</a></li>
</ul>
Locale links
<ul>
<li><a>TODO: Chinese</a></li>
</ul>
Connection
Are you searching for a Ziguanas ? <a>Ziglang.org</a>
Do you want to ask a question? <a>Zig Users Forum</a>, <a>Reddit</a>
Do you want to meet them IRL? <a>Community</a>
Go to Ziguanas events? <a>Zig SHOWTIME</a>, <a>Zig conferences and events</a>
Are you looking for a job? <a>Zig Jobs on Indeed</a>
Are you fast, simple, and focused? <a>Find something Ziggy to work on!</a>
Do you want to stay up to date? <a>The official blog</a>, <a>Zig NEWS</a>, <a>The official reddit</a>
Do you want to find out why some historical decisions took place? <a>Zig GitHub Discussions</a>
Fearless Zig Bloggers
<ul>
<li><a>Andrew Kelley</a> - <a>blog</a></li>
<li><a>Jonathan Marler</a> - <a>blog</a></li>
<li><a>Hejsil</a> - <a>blog</a></li>
<li><a>Hexops</a> - <a>blog</a></li>
<li><a>Karl Seguin</a> - <a>blog</a></li>
<li><a>Loris Cro</a> - <a>blog</a></li>
<li><a>tigerbeetle</a> - <a>blog</a></li>
<li><a>Validark</a> - <a>blog</a></li>
<li><a>Mitchell Hashimoto</a> - <a>blog</a></li>
</ul>
Tutorials & Workshop Materials
These are slides and materials from brick-and-mortar workshops about Zig.
While they're unlikely to help a student learning independently, they may be
of interest if you're running a workshop on Zig.
<ul>
<li>Loris Cro's <a>Ziglings</a>, a series of small exercises introducing Zig syntax and concepts interactively. </li>
<li><a>Zig SHOWTIME Videos</a> featuring tutorials and real-world examples from the Zig community. </li>
<li>sleibrock' <a>Zig and WebAssembly Tutorial</a> covering Zig's use in modern WebAssembly projects. </li>
<li><a>Zig Advent Calendar</a> offering a curated set of beginner to advanced Zig tutorials and exercises. </li>
<li>orhun's <a>Zig Bits</a> focusing on practical library implementation in Zig. </li>
<li><a>A half-hour to learn Zig</a> this is inspired by <a>a-half-hour-to-learn-rust</a></li>
<li><a>A Unix Shell in Zig</a> exploration combining Zig with scripting tools.</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/85748765?v=4 | clay-zig-bindings | johan0A/clay-zig-bindings | 2024-09-19T16:05:39Z | Zig bindings for the library clay: A high performance UI layout library in C. | main | 0 | 129 | 7 | 129 | https://api.github.com/repos/johan0A/clay-zig-bindings/tags | MIT | [
"layout",
"ui",
"zig",
"zig-library",
"zig-package"
] | 644 | false | 2025-05-12T17:41:49Z | true | true | unknown | github | [
{
"commit": "master",
"name": "clay",
"tar_url": "https://github.com/nicbarker/clay/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/nicbarker/clay"
}
] | Zig Bindings for clay.h
This repository contains Zig bindings for the <a>clay UI layout library</a>, as well as an example implementation of the <a>clay website</a> in Zig.
This README is abbreviated and applies to using clay in Zig specifically: If you haven't taken a look at the <a>full documentation for clay</a>, it's recommended that you take a look there first to familiarise yourself with the general concepts.
Some differences between the C API and the Zig bindings include:
<ul>
<li>minor naming changes</li>
<li>ability to initialize a parameter by calling a function that is part of its type's namespace for example <code>.fixed()</code> or <code>.layout()</code></li>
<li>ability to initialize a parameter by using a public constant that is part of its type's namespace for example <code>.grow</code></li>
</ul>
In C:
<code>C
CLAY({ // C macro for creating a scope
.id = CLAY_ID("SideBar"),
.layout = {
.layoutDirection = CLAY_TOP_TO_BOTTOM,
.sizing = { .width = CLAY_SIZING_FIXED(300), .height = CLAY_SIZING_GROW(0) },
.padding = CLAY_PADDING_ALL(16),
.childAlignment = .{ .x = CLAY_ALIGN_X_CENTER , .y = .CLAY_ALIGN_Y_TOP },
.childGap = 16
},
.backgroundColor = COLOR_LIGHT
}){
// Child elements here
}</code>
In Zig:
<code>Zig
clay.UI()(.{ // function call for creating a scope
.id = .ID("SideBar"),
.layout = .{
.direction = .top_to_bottom,
.sizing = .{ .w = .fixed(300), .h = .grow },
.padding = .all(16),
.child_alignment = .{ .x = .center, .y = .top },
.child_gap = 16,
},
.background_color = light_grey,
})({
// Child elements here
});</code>
installation:
Compatible Zig Version: <code>0.14.0</code>
<ol>
<li>Add <code>zclay</code> to the dependency list in <code>build.zig.zon</code>: </li>
</ol>
<code>sh
zig fetch --save git+https://github.com/johan0A/clay-zig-bindings#v0.13</code>
<ol>
<li>Config <code>build.zig</code>:</li>
</ol>
<code>zig
...
const zclay_dep = b.dependency("zclay", .{
.target = target,
.optimize = optimize,
});
compile_step.root_module.addImport("zclay", zclay_dep.module("zclay"));
...</code>
quickstart
<ol>
<li>Ask clay for how much static memory it needs using <a>clay.minMemorySize()</a>, create an Arena for it to use with <a>clay.createArenaWithCapacityAndMemory(minMemorySize, memory)</a>, and initialize it with <a>clay.Initialize(arena)</a>.</li>
</ol>
<code>zig
const min_memory_size: u32 = clay.minMemorySize();
const memory = try allocator.alloc(u8, min_memory_size);
defer allocator.free(memory);
const arena: clay.Arena = clay.createArenaWithCapacityAndMemory(memory);
_ = clay.initialize(arena, .{ .h = 1000, .w = 1000 }, .{});
clay.setMeasureTextFunction(void, {}, renderer.measureText);</code>
<ol>
<li>Provide a <code>measureText(text, config)</code> function with <a>clay.setMeasureTextFunction(function)</a> so that clay can measure and wrap text.</li>
</ol>
```zig
// Example measure text function
pub fn measureText(clay_text: []const u8, config: *clay.TextElementConfig, user_data: void) clay.Dimensions {
// clay.TextElementConfig contains members such as fontId, fontSize, letterSpacing etc
// Note: clay.String.chars is not guaranteed to be null terminated
}
// Tell clay how to measure text
clay.setMeasureTextFunction({}, measureText)
```
<ol>
<li><strong>Optional</strong> - Call <a>clay.setPointerPosition(pointerPosition)</a> if you want to use mouse interactions.</li>
</ol>
<code>Zig
// Update internal pointer position for handling mouseover / click / touch events
clay.setPointerState(.{
.x = mouse_position_x,
.y = mouse_position_y,
}, is_left_mouse_button_down);</code>
<ol>
<li>Call <a>clay.beginLayout()</a> and declare your layout using the provided functions.</li>
</ol>
```Zig
const light_grey: clay.Color = .{ 224, 215, 210, 255 };
const red: clay.Color = .{ 168, 66, 28, 255 };
const orange: clay.Color = .{ 225, 138, 50, 255 };
const white: clay.Color = .{ 250, 250, 255, 255 };
const sidebar_item_layout: clay.LayoutConfig = .{ .sizing = .{ .w = .grow, .h = .fixed(50) } };
// Re-useable components are just normal functions
fn sidebarItemComponent(index: u32) void {
clay.UI()(.{
.id = .IDI("SidebarBlob", index),
.layout = sidebar_item_layout,
.background_color = orange,
})({});
}
// An example function to begin the "root" of your layout tree
fn createLayout(profile_picture: *const rl.Texture2D) clay.ClayArray(clay.RenderCommand) {
clay.beginLayout();
clay.UI()(.{
.id = .ID("OuterContainer"),
.layout = .{ .direction = .left_to_right, .sizing = .grow, .padding = .all(16), .child_gap = 16 },
.background_color = white,
})({
clay.UI()(.{
.id = .ID("SideBar"),
.layout = .{
.direction = .top_to_bottom,
.sizing = .{ .h = .grow, .w = .fixed(300) },
.padding = .all(16),
.child_alignment = .{ .x = .center, .y = .top },
.child_gap = 16,
},
.background_color = light_grey,
})({
clay.UI()(.{
.id = .ID("ProfilePictureOuter"),
.layout = .{ .sizing = .{ .w = .grow }, .padding = .all(16), .child_alignment = .{ .x = .left, .y = .center }, .child_gap = 16 },
.background_color = red,
})({
clay.UI()(.{
.id = .ID("ProfilePicture"),
.layout = .{ .sizing = .{ .h = .fixed(60), .w = .fixed(60) } },
.image = .{ .source_dimensions = .{ .h = 60, .w = 60 }, .image_data = @ptrCast(profile_picture) },
})({});
clay.text("Clay - UI Library", .{ .font_size = 24, .color = light_grey });
});
<code> for (0..5) |i| sidebarItemComponent(@intCast(i));
});
clay.UI()(.{
.id = .ID("MainContent"),
.layout = .{ .sizing = .grow },
.background_color = light_grey,
})({
//...
});
});
return clay.endLayout();
</code>
}
```
<ol>
<li>Call <a>clay.endLayout()</a> and process the resulting <a>clay.RenderCommandArray</a> in your choice of renderer.</li>
</ol>
<code>zig
pub fn clayRaylibRender(render_commands: *clay.ClayArray(clay.RenderCommand), allocator: std.mem.Allocator) void {
var i: usize = 0;
while (i < render_commands.length) : (i += 1) {
const render_command = clay.renderCommandArrayGet(render_commands, @intCast(i));
const bounding_box = render_command.bounding_box;
switch (render_command.command_type) {
.none => {},
.text => {
...</code>
Please see the <a>full C documentation for clay</a> for API details and the example folder in this repo. All public C functions and Macros have Zig binding equivalents, generally of the form <code>Clay_BeginLayout</code> (C) -> <code>clay.beginLayout</code> (zig) | [] |
https://avatars.githubusercontent.com/u/50487716?v=4 | jam | srijan-paul/jam | 2024-10-14T17:02:23Z | Fast and effective parser, formatter, code optimizer, and linter for the JS ecosystem | main | 1 | 118 | 2 | 118 | https://api.github.com/repos/srijan-paul/jam/tags | NOASSERTION | [
"javascript",
"linter",
"toolchain",
"zig"
] | 4,406 | false | 2025-05-09T08:17:51Z | true | true | 0.13.0 | github | [
{
"commit": "d56c5ed310058463cf6587a62a9febc595efc5e7.tar.gz",
"name": "unicode_id",
"tar_url": "https://codeberg.org/injuly/unicode-id/archive/d56c5ed310058463cf6587a62a9febc595efc5e7.tar.gz.tar.gz",
"type": "remote",
"url": "https://codeberg.org/injuly/unicode-id"
}
] | Jam
A high-performance JavaScript toolchain + analyzer built from the ground up.
<strong>Work in progress!</strong>
Jam is a JavaScript parser, linter, formatter, printer and vulnerability scanner.
Goals
<ul>
<li>Competitive in performance with existing tools. </li>
<li>Support JS, JSX, and TypeScript out of the box.<ul>
<li>And the <code><script></code> part of VueJS code.</li>
</ul>
</li>
<li>Single, small binary.</li>
<li>Support data flow analysis and call-graphs with an accessible API. </li>
<li>Expose a capable parsing and scope resolution, such that a bundler, minifier, etc., can be built on top of it.</li>
<li>API to write lint rules with zig.</li>
<li>Custom JavaScript plugins.</li>
</ul>
Roadmap
<ul>
<li>Phase 1:
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> A fast, 100% Spec compliant JavaScript parser.
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Port <a>ESLint scope</a> to Zig
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> JSX parsing.
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Semantic analysis: Control Flow Graphs (<strong>WIP</strong>).
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> TypeScript parsing (<strong>WIP</strong>).
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Runtime for a linter, with Zig plugin support.
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Formatter with a <strong>language agnostic backend</strong>.</li>
<li>Alpha release
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Simple linter with all the base rules from ESLint.
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> A prototype for the jam formatter</li>
<li>Beta release
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Data flow analysis and taint checking</li>
</ul>
Local development
I've tried to keep the development process hassle-free.
You need only a Zig compiler (and optionally an environment variable) to get going.
If you still face any issues, feel free to open an issue
or reach out to me on discord (<code>@injuly.</code>), <a>twitter</a>, or <a>e-mail</a>.
I usually respond within a day.
<blockquote>
<strong>NOTE:</strong> If you're willing to contribute, It's a good idea to copy the contents of ./pre-commit to
your <code>./.git/hooks/pre-commit</code>.
This will ensure you didn't break any existing functionality before letting you commit changes.
</blockquote>
Basic setup
<ol>
<li>Ensure you have a <code>master</code> build of the zig compiler –
to seamlessly switch between multiple zig versions, I recommend using <a>zvm</a>.</li>
<li>Clone this project into your development machine.</li>
<li>Run <code>zig build run -- <path-to-file.js></code> to see a parsed AST for the given file.</li>
<li>Run <code>zig build test</code> to run the unit tests.</li>
</ol>
Checking ECMAScript conformance
To avoid regressions and keep track of spec compliance, we use a <code>results.json</code> and <code>babel-results.json</code> file –
their formats are explained in the <a>tools README</a>.
You'll need to set the <code>JAM_TESTS_262_DIR</code> environment variable to the path of a cloned <a>tc39/test262-parser-tests</a> repository:
```sh
git clone --depth 1 https://github.com/tc39/test262-parser-tests.git /tmp/test262-parser-tests
<code>tools/ec262-tests</code> can find the tests if you set the environment variable.
export JAM_TESTS_262_DIR=/tmp/test262-parser-tests
```
To compare your changes with the existing test results, run <code>zig build test262 -- compare ./tools/results.json</code>.
If it exits normally, you didn't break anything!
To update the test results when you increase conformance, run <code>zig build test262 > ./tools/results.json</code>.
Currently, the format of the <code>results.json</code> file is roughly as follows:
<code>js
{
// % of test files that either: a) parsed incorrectly, or b) failed to parse.
"fail_percent": 35.703479576399396,
// % of test files that were parsed correctly.
"pass_percent": 64.2965204236006,
// number of test files that parsed but had an incorrect syntax tree.
"unmatching_ast_count": 17,
// results for individual test cases:
"test_cases": {
"2db5219f0ac5dd71.js": "parse_error",
"c532e126a986c1d4.js": "pass",
"d532e126a986c1d4.js": "ast_no_match",
// ...goes on for a few thousand lines...</code> | [] |
https://avatars.githubusercontent.com/u/16590917?v=4 | zigscient | llogick/zigscient | 2024-10-16T09:58:26Z | A Zig Language Server | dev | 2 | 114 | 6 | 114 | https://api.github.com/repos/llogick/zigscient/tags | NOASSERTION | [
"language-server",
"language-server-protocol",
"zig",
"zig-auto-complete",
"zig-language",
"zig-language-server"
] | 6,336 | false | 2025-05-05T19:28:50Z | true | true | 0.14.0 | github | [
{
"commit": "aa24df42183ad415d10bc0a33e6238c437fc0f59.tar.gz",
"name": "known_folders",
"tar_url": "https://github.com/ziglibs/known-folders/archive/aa24df42183ad415d10bc0a33e6238c437fc0f59.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/ziglibs/known-folders"
},
{
"commit":... | A drop-in alternative to the original Zig Language Server, with several enhancements.
Key features and improvements:
- Reworked Modules Collection and Lookup
- Modules are grouped by CompileStep (root ID). See <a>How to set/switch <code>root_id</code></a>
- Improved parser performance:
- Slightly better syntax error handling
- Faster reparsing of large documents
- Enhanced code completions:
- Declaration literals: autocompletion and navigation support
- Error and function return type completions, e.g. <code>return .</code>, <code>return error.</code>, and <code>switch(err) { error. }</code>
<blockquote>
<span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span>
Remember to rename the executable or update your editor's configuration
</blockquote> | [] |
https://avatars.githubusercontent.com/u/92454917?v=4 | nexlog | chrischtel/nexlog | 2024-12-15T13:40:10Z | A modern, feature-rich logging library for Zig with thread-safety, file rotation, and colorized output. High-performance logging made easy. | main | 1 | 71 | 3 | 71 | https://api.github.com/repos/chrischtel/nexlog/tags | BSD-3-Clause | [
"file-rotation",
"library",
"logging",
"thread-safe",
"zig"
] | 209 | false | 2025-05-13T20:54:36Z | true | true | 0.11.0 | github | [] | nexlog
<strong>nexlog</strong> is a high-performance, flexible, and feature-rich logging library for Zig applications. Designed with both power and ease-of-use in mind, nexlog offers asynchronous logging, file rotation, structured logging, and much more — making it a perfect fit for projects of any size.
<a></a>
<a></a>
<a></a>
Table of Contents
<ul>
<li><a>Features</a></li>
<li><a>Installation</a></li>
<li><a>Quick Start</a></li>
<li><a>Examples</a></li>
<li><a>Advanced Features</a></li>
<li><a>Structured Logging</a></li>
<li><a>File Rotation</a></li>
<li><a>Custom Handlers</a></li>
<li><a>JSON Logging</a></li>
<li><a>Context Tracking</a></li>
<li><a>Configuration</a></li>
<li><a>Benchmarks</a></li>
<li><a>Contributing</a></li>
<li><a>License</a></li>
</ul>
Features
<ul>
<li><strong>Multiple Log Levels</strong>: Supports debug, info, warning, and error levels</li>
<li><strong>Asynchronous Logging</strong>: High-performance async mode minimizes impact on application performance</li>
<li><strong>File Rotation</strong>: Automatic log file rotation with configurable size and backup counts</li>
<li><strong>Structured Logging</strong>: Multiple output formats (JSON, logfmt, custom) for machine-readable logs</li>
<li><strong>Rich Metadata</strong>: Automatic inclusion of timestamps, thread IDs, file names, and function names</li>
<li><strong>Custom Handlers</strong>: Built-in handlers for console, file, and JSON outputs; extensible for custom needs</li>
<li><strong>Color Support</strong>: Terminal color coding for different log levels</li>
<li><strong>Configurable Buffer Size</strong>: Adjustable buffer size for optimal performance</li>
<li><strong>Context Tracking</strong>: Support for department- or component-specific logging contexts</li>
<li><strong>High Performance</strong>: Benchmarked at 40K+ logs per second</li>
<li><strong>Type Safety</strong>: Full Zig type safety and compile-time checks</li>
</ul>
Installation
Add <strong>nexlog</strong> as a dependency in your <code>build.zig.zon</code> file:
<code>zig
.{
.name = "my-project",
.version = "0.1.0",
.dependencies = .{
.nexlog = .{
.url = "git+https://github.com/chrischtel/nexlog/",
.hash = "...", // Run `zig fetch` to get the hash
},
},
}</code>
Quick Install
<code>bash
zig fetch --save git+https://github.com/chrischtel/nexlog/</code>
<blockquote>
<strong>Note:</strong> For development versions, append <code>#develop</code> to the URL.
</blockquote>
Quick Start
Here's a simple example to get you started:
```zig
const std = @import("std");
const nexlog = @import("nexlog");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
<code>// Initialize logger
var builder = nexlog.LogBuilder.init();
try builder
.setMinLevel(.debug)
.enableColors(true)
.enableFileLogging(true, "logs/app.log")
.build(allocator);
defer nexlog.deinit();
// Get the default logger
const logger = nexlog.getDefaultLogger() orelse return error.LoggerNotInitialized;
// Log messages
logger.info("Application starting", .{}, null);
logger.debug("Debug information", .{}, null);
logger.warn("Warning message", .{}, null);
logger.err("Error occurred", .{}, null);
</code>
}
```
Examples
The <code>examples/</code> directory contains comprehensive examples for all features:
<ul>
<li><code>basic_usage.zig</code>: Simple logging setup and usage</li>
<li><code>structured_logging.zig</code>: Advanced structured logging with JSON and logfmt</li>
<li><code>file_rotation.zig</code>: File rotation configuration and management</li>
<li><code>custom_handler.zig</code>: Creating custom log handlers</li>
<li><code>json_logging.zig</code>: JSON-specific logging features</li>
<li><code>logger_integration.zig</code>: Integrating with existing applications</li>
<li><code>benchmark.zig</code>: Performance benchmarking examples</li>
</ul>
Structured Logging Example
```zig
const fields = [_]nexlog.StructuredField{
.{
.name = "user_id",
.value = "12345",
},
.{
.name = "action",
.value = "login",
},
};
logger.info("User logged in", .{}, &fields);
```
File Rotation Example
<code>zig
try builder
.enableFileLogging(true, "logs/app.log")
.setMaxFileSize(5 * 1024 * 1024) // 5MB
.setMaxRotatedFiles(3)
.enableRotation(true)
.build(allocator);</code>
Advanced Features
Structured Logging
nexlog supports multiple structured logging formats:
<ol>
<li>
<strong>JSON Format</strong>
<code>json
{
"timestamp": "2024-03-19T10:42:00Z",
"level": "info",
"message": "User logged in",
"fields": {
"user_id": "12345",
"action": "login"
}
}</code>
</li>
<li>
<strong>Logfmt Format</strong>
<code>timestamp=2024-03-19T10:42:00Z level=info message="User logged in" user_id=12345 action=login</code>
</li>
<li>
<strong>Custom Format</strong>
<code>[2024-03-19T10:42:00Z] INFO | User logged in | user_id=12345 | action=login</code>
</li>
</ol>
File Rotation
Configure file rotation with size limits and backup counts:
<code>zig
try builder
.enableFileLogging(true, "logs/app.log")
.setMaxFileSize(5 * 1024 * 1024) // 5MB
.setMaxRotatedFiles(3)
.enableRotation(true)
.build(allocator);</code>
This creates rotated files like:
- <code>app.log</code>
- <code>app.log.1</code>
- <code>app.log.2</code>
- <code>app.log.3</code>
Custom Handlers
Create custom log handlers for specialized needs:
<code>zig
const CustomHandler = struct {
pub fn handle(level: nexlog.LogLevel, message: []const u8, fields: ?[]const nexlog.StructuredField) !void {
// Custom handling logic
}
};</code>
Configuration
Advanced configuration using the builder pattern:
<code>zig
try builder
.setMinLevel(.debug)
.enableColors(true)
.setBufferSize(8192)
.enableFileLogging(true, "logs/app.log")
.setMaxFileSize(5 * 1024 * 1024)
.setMaxRotatedFiles(3)
.enableRotation(true)
.enableAsyncMode(true)
.enableMetadata(true)
.build(allocator);</code>
Configuration Options
| Option | Description | Default |
|--------|-------------|---------|
| <code>minLevel</code> | Minimum log level to process | <code>.info</code> |
| <code>bufferSize</code> | Size of the log buffer | <code>4096</code> |
| <code>maxFileSize</code> | Maximum size before rotation | <code>10MB</code> |
| <code>maxRotatedFiles</code> | Number of backup files to keep | <code>5</code> |
| <code>asyncMode</code> | Enable asynchronous logging | <code>false</code> |
| <code>colors</code> | Enable terminal colors | <code>true</code> |
| <code>metadata</code> | Include metadata in logs | <code>true</code> |
Benchmarks
Recent benchmark results (Windows, Release mode):
| Format | Logs/Second | Notes |
|--------|-------------|-------|
| JSON | 26,790 | Base structured format |
| Logfmt | 39,284 | ~47% faster than JSON |
| Custom | 41,297 | Fastest format |
| Large Fields | 8,594 | With 100-field JSON payload |
| Many Fields | 7,333 | With 50 separate fields |
| With Attributes | 20,776 | Including field attributes |
| Full Integration | 5,878 | Complete logging pipeline |
Run benchmarks with:
<code>bash
zig build bench</code>
Contributing
Contributions are welcome! Please:
<ol>
<li>Fork the repository</li>
<li>Create a feature branch</li>
<li>Commit your changes</li>
<li>Open a Pull Request</li>
</ol>
For major changes, please open an issue first to discuss your ideas.
License
This project is licensed under the BSD 3-Clause License. See the <a>LICENSE</a> file for details.
Happy logging with <strong>nexlog</strong>! 🚀 | [] |
https://avatars.githubusercontent.com/u/179981696?v=4 | gRPC-zig | ziglana/gRPC-zig | 2024-10-31T12:24:20Z | blazigly fast gRPC client & server implementation in zig | main | 1 | 54 | 6 | 54 | https://api.github.com/repos/ziglana/gRPC-zig/tags | Unlicense | [
"blazigly",
"grpc",
"rpc",
"zig",
"zig-package"
] | 15 | false | 2025-05-13T00:11:18Z | true | true | unknown | github | [
{
"commit": "refs",
"name": "spice",
"tar_url": "https://github.com/judofyr/spice/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/judofyr/spice"
}
] | 🚀 gRPC-zig
A blazingly fast gRPC client & server implementation in Zig, designed for maximum performance and minimal overhead.
<a></a>
<a></a>
<a></a>
⚡️ Features
<ul>
<li>🔥 <strong>Blazingly Fast</strong>: Built from ground up in Zig for maximum performance</li>
<li>🔐 <strong>Full Security</strong>: Built-in JWT authentication and TLS support</li>
<li>🗜️ <strong>Compression</strong>: Support for gzip and deflate compression</li>
<li>🌊 <strong>Streaming</strong>: Efficient bi-directional streaming</li>
<li>💪 <strong>HTTP/2</strong>: Full HTTP/2 support with proper flow control</li>
<li>🏥 <strong>Health Checks</strong>: Built-in health checking system</li>
<li>🎯 <strong>Zero Dependencies</strong>: Pure Zig implementation</li>
<li>🔍 <strong>Type Safety</strong>: Leverages Zig's comptime for compile-time checks</li>
</ul>
🚀 Quick Start
```zig
// Server
const server = try GrpcServer.init(allocator, 50051, "secret-key");
try server.handlers.append(.{
.name = "SayHello",
.handler_fn = sayHello,
});
try server.start();
// Client
var client = try GrpcClient.init(allocator, "localhost", 50051);
const response = try client.call("SayHello", "World", .none);
```
📚 Examples
Basic Server
```zig
const std = @import("std");
const GrpcServer = @import("server.zig").GrpcServer;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
<code>var server = try GrpcServer.init(gpa.allocator(), 50051, "secret-key");
defer server.deinit();
try server.start();
</code>
}
```
Streaming
<code>zig
var stream = streaming.MessageStream.init(allocator, 5);
try stream.push("First message", false);
try stream.push("Final message", true);</code>
🔧 Installation
<ol>
<li>Add to your <code>build.zig.zon</code>:</li>
</ol>
<code>zig
.dependencies = .{
.grpc_zig = .{
.url = "https://github.com/ziglana/grpc-zig/archive/refs/tags/v0.1.0.tar.gz",
},
},</code>
<ol>
<li>Add to your <code>build.zig</code>:</li>
</ol>
<code>zig
const grpc_zig = b.dependency("grpc_zig", .{});
exe.addModule("grpc", grpc_zig.module("grpc"));</code>
🏃 Performance
Benchmarked against other gRPC implementations (ops/sec, lower is better):
<code>gRPC-zig │████████░░░░░░░░░░│ 2.1ms
gRPC Go │██████████████░░░░│ 3.8ms
gRPC C++ │████████████████░░│ 4.2ms</code>
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
📜 License
This project is licensed under the Unlicense - see the <a>LICENSE</a> file for details.
⭐️ Support
If you find this project useful, please consider giving it a star on GitHub to show your support!
🙏 Acknowledgments
<ul>
<li><a>Spice</a> - For the amazing Protocol Buffers implementation</li>
<li><a>Tonic</a> - For inspiration on API design</li>
<li>The Zig community for their invaluable feedback and support</li>
</ul>
Made with ❤️ in Zig | [] |
https://avatars.githubusercontent.com/u/192897928?v=4 | zig-luajit | sackosoft/zig-luajit | 2025-01-14T15:57:31Z | Run Lua code in Zig apps! A package providing Zig language bindings to LuaJIT. | main | 1 | 49 | 3 | 49 | https://api.github.com/repos/sackosoft/zig-luajit/tags | AGPL-3.0 | [
"bindings",
"language-bindings",
"lua",
"lua-bindings",
"luajit",
"zig",
"zig-package"
] | 399 | false | 2025-05-22T03:14:00Z | true | true | unknown | github | [
{
"commit": "d75c20acaa4df39f51187926fa9d98e4e5231064",
"name": "luajit_build",
"tar_url": "https://github.com/sackosoft/zig-luajit-build/archive/d75c20acaa4df39f51187926fa9d98e4e5231064.tar.gz",
"type": "remote",
"url": "https://github.com/sackosoft/zig-luajit-build"
}
] |
# zig-luajit
**Zig ⚡ language bindings for the [LuaJIT](https://luajit.org/) C API. Use `zig-luajit` to run [Lua scripts](https://www.lua.org/) within a Zig application.**



About
The goal of the <code>zig-luajit</code> project is to provide the most idiomatic Zig language bindings for the LuaJIT C API and C
API Auxilary Library. Additionally the <code>zig-luajit</code> project emphasizes safety by making liberal use of runtime safety
checks in <code>Debug</code> and <code>ReleaseSafe</code> builds and provides full test coverage of the API.
Zig Version
The <code>main</code> branch targets recent builds of Zig's <code>master</code> branch (last tested with Zig <code>0.15.0-dev.565+8e72a2528</code>).
Installation & Usage
It is recommended that you install <code>zig-luajit</code> using <code>zig fetch</code>. This will add a <code>luajit</code> dependency to your <code>build.zig.zon</code> file.
<code>bash
zig fetch --save=luajit git+https://github.com/sackosoft/zig-luajit</code>
Next, in order for your code to import <code>zig-luajit</code>, you'll need to update your <code>build.zig</code> to do the following:
<ol>
<li>get a reference the <code>zig-luajit</code> dependency.</li>
<li>get a reference to the <code>luajit</code> module, which contains the core Zig language bindings for LuaJIT.</li>
<li>add the module as an import to your executable or library.</li>
</ol>
<code>``zig
// (1) Get a reference to the</code>zig fetch`'ed dependency
const luajit_dep = b.dependency("luajit", .{
.target = target,
.optimize = optimize,
});
// (2) Get a reference to the language bindings module.
const luajit = luajit_dep.module("luajit");
// Set up your library or executable
const lib = // ...
const exe = // ...
// (3) Add the module as an import to your executable or library.
my_exe.root_module.addImport("luajit", luajit);
my_lib.root_module.addImport("luajit", luajit);
```
Now the code in your library or exectable can import and use the LuaJIT Zig API!
```zig
const luajit = @import("luajit");
const Lua = luajit.Lua;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const lua = Lua.init(gpa.allocator());
defer lua.deinit();
lua.openBaseLib();
lua.doString(
\ print("Hello, world!")
);
```
Examples
Some examples are provided in <a>examples/</a> to aid users in learning to use <code>zig-luajit</code>. These
small self-contained applications should always be working, please create an issue if they do not work for
you.
Language Binding Coverage Progress
| API | Support |
|-----------------------------|---------------------------------------|
| Lua C API (<code>lua_*</code>) | 🎉 100% coverage† (92/92) |
| Auxilary Library (<code>luaL_*</code>) | 🤩 100% coverage (48/48) |
| Debug API (<code>lua_Debug</code>) | 🥳 100% coverage (12/12) |
| LuaJIT Extensions | <em>No plans to implement.</em> |
<em>†: Coroutine yield/resume is not yet part of the public <code>zig-luajit</code> Zig API, see <a>#6</a>.</em>
Coverage and Compatibility
This section describes the current status of Zig language bindings ("the Zig API").
<ul>
<li>☑️ Fully Supported: Test coverage and runtime safety checks enabled in <code>Debug</code> or <code>ReleaseSafe</code> builds.</li>
<li>➖ Internal: Used internally and intentionally hidden from the Zig API.</li>
<li>🆖 Superseded: Has no direct Zig equivalent, but the functionality is provided by a different part of the Zig API.</li>
<li>📢 Renamed: Renamed in a non-obvious way from the C API. Renaming is avoided but done in cases deemed required:<ol>
<li>to conform to Zig idioms or patterns, such as the <code>init()</code> / <code>deinit()</code> pattern.</li>
<li>to avoid conflicts with Zig language keywords, such as the Zig <code>error</code> keyword.</li>
<li>to show that the Zig API has slightly different behavior than the C API, such as using <code>lua.setAllocator()</code>
instead of <code>lua.setAllocF()</code>; since the Zig API uses <code>std.mem.Allocator</code> instead of allocation functions.</li>
<li>to improve the clarity, discoverability or consistency of the symbol in the overall API surface.</li>
</ol>
</li>
</ul>
Core C API Coverage (<code>lua_</code>)
| C Type Definition | Available in <code>zig-luajit</code> |
|----------------------------|---------------------------------------------------------------------|
| <code>lua_State</code> | ☑️ <code>Lua</code> |
| <code>lua_Alloc</code> | ➖ Hidden, please use <code>lua.setAllocator()</code> and <code>lua.getAllocator()</code> |
| <code>lua_CFunction</code> | ☑️ <code>lua.CFunction</code> |
| <code>lua_Integer</code> | ☑️ <code>Lua.Integer</code> |
| <code>lua_Number</code> | ☑️ <code>Lua.Number</code> |
| <code>lua_Reader</code> | ☑️ <a><code>std.io.AnyReader</code></a> |
| <code>lua_Writer</code> | ☑️ <a><code>std.io.AnyWriter</code></a> |
| C API Symbols | Available in <code>zig-luajit</code> |
|----------------------------|-------------------------------------|
| <code>lua_atpanic</code> | ☑️ <code>lua.atPanic()</code> |
| <code>lua_call</code> | ☑️ <code>lua.call()</code> |
| <code>lua_pcall</code> | ☑️📢 <code>lua.callProtected()</code> |
| <code>lua_cpcall</code> | ☑️📢 <code>lua.callProtectedC()</code> |
| <code>lua_checkstack</code> | ☑️ <code>lua.checkStack()</code> |
| <code>lua_close</code> | ☑️📢 <code>lua.deinit()</code> |
| <code>lua_concat</code> | ☑️ <code>lua.concat()</code> |
| <code>lua_createtable</code> | ☑️ <code>lua.createTable()</code> |
| <code>lua_dump</code> | ☑️ <code>lua.dump()</code> |
| <code>lua_equal</code> | ☑️ <code>lua.equal()</code> |
| <code>lua_error</code> | ☑️📢 <code>lua.raiseError()</code> |
| <code>lua_gc</code> | ☑️ <code>lua.gc()</code> + <code>lua.gcIsRunning()</code> |
| <code>lua_getallocf</code> | ☑️📢 <code>lua.getAllocator()</code> |
| <code>lua_getfenv</code> | ☑️📢 <code>lua.getEnvironment()</code> |
| <code>lua_getfield</code> | ☑️ <code>lua.getField()</code> |
| <code>lua_getglobal</code> | ☑️ <code>lua.getGlobal()</code> |
| <code>lua_getmetatable</code> | ☑️ <code>lua.getMetatable()</code> |
| <code>lua_gettable</code> | ☑️ <code>lua.getTable()</code> |
| <code>lua_gettop</code> | ☑️ <code>lua.getTop()</code> |
| <code>lua_insert</code> | ☑️ <code>lua.insert()</code> |
| <code>lua_isboolean</code> | ☑️ <code>lua.isBoolean()</code> |
| <code>lua_iscfunction</code> | ☑️ <code>lua.isCFunction()</code> |
| <code>lua_isfunction</code> | ☑️ <code>lua.isFunction()</code> |
| <code>lua_islightuserdata</code> | ☑️ <code>lua.isLightUserdata()</code> |
| <code>lua_isnil</code> | ☑️ <code>lua.isNil()</code> |
| <code>lua_isnone</code> | ☑️ <code>lua.isNone()</code> |
| <code>lua_isnoneornil</code> | ☑️ <code>lua.isNilOrNone()</code> |
| <code>lua_isnumber</code> | ☑️ <code>lua.isNumber()</code> |
| <code>lua_isstring</code> | ☑️ <code>lua.isString()</code> |
| <code>lua_istable</code> | ☑️ <code>lua.isTable()</code> |
| <code>lua_isthread</code> | ☑️ <code>lua.isThread()</code> |
| <code>lua_isuserdata</code> | ☑️ <code>lua.isUserdata()</code> |
| <code>lua_lessthan</code> | ☑️ <code>lua.lessThan()</code> |
| <code>lua_load</code> | ☑️ <code>lua.load()</code> |
| <code>lua_newstate</code> | ☑️📢 <code>Lua.init()</code> |
| <code>lua_newtable</code> | ☑️ <code>lua.newTable()</code> |
| <code>lua_newthread</code> | ☑️ <code>lua.newThread()</code> |
| <code>lua_newuserdata</code> | ☑️ <code>lua.newUserdata()</code> |
| <code>lua_next</code> | ☑️ <code>lua.next()</code> |
| <code>lua_objlen</code> | ☑️📢 <code>lua.getLength()</code> |
| <code>lua_pop</code> | ☑️ <code>lua.pop()</code> |
| <code>lua_pushboolean</code> | ☑️ <code>lua.pushBoolean()</code> |
| <code>lua_pushcclosure</code> | ☑️ <code>lua.pushCClosure()</code> |
| <code>lua_pushcfunction</code> | ☑️ <code>lua.pushCFunction()</code> |
| <code>lua_pushfstring</code> | ☑️ <code>lua.pushFString()</code> |
| <code>lua_pushinteger</code> | ☑️ <code>lua.pushInteger()</code> |
| <code>lua_pushlightuserdata</code> | ☑️ <code>lua.pushLightUserdata()</code> |
| <code>lua_pushliteral</code> | 🆖 please use <code>lua.pushLString()</code> |
| <code>lua_pushlstring</code> | ☑️ <code>lua.pushLString()</code> |
| <code>lua_pushnil</code> | ☑️ <code>lua.pushNil()</code> |
| <code>lua_pushnumber</code> | ☑️ <code>lua.pushNumber()</code> |
| <code>lua_pushstring</code> | ☑️ <code>lua.pushString()</code> |
| <code>lua_pushthread</code> | ☑️ <code>lua.pushThread()</code> |
| <code>lua_pushvalue</code> | ☑️ <code>lua.pushValue()</code> |
| <code>lua_pushvfstring</code> | 🆖 please use <code>lua.pushFString()</code> |
| <code>lua_rawequal</code> | ☑️📢 <code>lua.equalRaw()</code> |
| <code>lua_rawgeti</code> | ☑️📢 <code>lua.getTableIndexRaw()</code> |
| <code>lua_rawget</code> | ☑️📢 <code>lua.getTableRaw()</code> |
| <code>lua_rawseti</code> | ☑️📢 <code>lua.setTableIndexRaw()</code> |
| <code>lua_rawset</code> | ☑️📢 <code>lua.setTableRaw()</code> |
| <code>lua_register</code> | ☑️📢 <code>lua.registerFunction()</code> |
| <code>lua_remove</code> | ☑️ <code>lua.remove()</code> |
| <code>lua_replace</code> | ☑️ <code>lua.replace()</code> |
| <code>lua_resume</code> | ➖ Hidden, see <a>Issue #6</a> |
| <code>lua_setallocf</code> | ☑️📢 <code>lua.setAllocator()</code> |
| <code>lua_setfenv</code> | ☑️📢 <code>lua.setEnvironment()</code> |
| <code>lua_setfield</code> | ☑️ <code>lua.setField()</code> |
| <code>lua_setglobal</code> | ☑️ <code>lua.setGlobal()</code> |
| <code>lua_setmetatable</code> | ☑️ <code>lua.setMetatable()</code> |
| <code>lua_settable</code> | ☑️ <code>lua.setTable()</code> |
| <code>lua_settop</code> | ☑️ <code>lua.setTop()</code> |
| <code>lua_status</code> | ☑️ <code>lua.status()</code> |
| <code>lua_toboolean</code> | ☑️ <code>lua.toBoolean()</code> |
| <code>lua_tocfunction</code> | ☑️ <code>lua.toCFunction()</code> |
| <code>lua_tointeger</code> | ☑️ <code>lua.toInteger()</code> |
| <code>lua_tolstring</code> | ☑️ <code>lua.toLString()</code> |
| <code>lua_tonumber</code> | ☑️ <code>lua.toNumber()</code> |
| <code>lua_topointer</code> | ☑️ <code>lua.toPointer()</code> |
| <code>lua_tostring</code> | ☑️ <code>lua.toString()</code> |
| <code>lua_tothread</code> | ☑️ <code>lua.toThread()</code> |
| <code>lua_touserdata</code> | ☑️ <code>lua.toUserdata()</code> |
| <code>lua_type</code> | ☑️📢 <code>lua.getType()</code> |
| <code>lua_typename</code> | ☑️ <code>lua.getTypeName()</code> |
| <code>lua_xmove</code> | ☑️ <code>lua.xmove()</code> |
| <code>lua_yield</code> | ➖ Hidden, see <a>Issue #6</a> |
Auxilary Library Coverage (<code>luaL_</code>)
| C Type Definition | Available in <code>zig-luajit</code> |
|----------------------------|-------------------------------------|
| <code>luaL_Buffer</code> | ☑️ <code>Lua.Buffer</code> |
| <code>luaL_Reg</code> | ☑️ <code>Lua.Reg</code> and <code>Lua.RegEnd</code> |
| C API Symbol | Available in <code>zig-luajit</code> |
|----------------------------|-------------------------------------|
| <code>luaL_addchar</code> | ☑️ <code>buffer.addChar()</code>|
| <code>luaL_addsize</code> | ☑️ <code>buffer.addSize()</code>|
| <code>luaL_addlstring</code> | ☑️ <code>buffer.addLString()</code>|
| <code>luaL_addstring</code> | ☑️ <code>buffer.addString()</code>|
| <code>luaL_addvalue</code> | ☑️ <code>buffer.addValue()</code>|
| <code>luaL_argcheck</code> | ☑️📢 <code>lua.checkArgument()</code> |
| <code>luaL_argerror</code> | ☑️📢 <code>lua.raiseErrorArgument()</code> |
| <code>luaL_buffinit</code> | ☑️📢 <code>lua.initBuffer()</code>|
| <code>luaL_callmeta</code> | ☑️ <code>lua.callMeta()</code>|
| <code>luaL_checkany</code> | ☑️ <code>lua.checkAny()</code>|
| <code>luaL_checkinteger</code> | ☑️ <code>lua.checkInteger()</code> |
| <code>luaL_checkint</code> | 🆖 please use <code>lua.checkInteger()</code> |
| <code>luaL_checklong</code> | 🆖 please use <code>lua.checkInteger()</code> |
| <code>luaL_checklstring</code> | ☑️ <code>lua.checkLString()</code> |
| <code>luaL_checknumber</code> | ☑️ <code>lua.checkNumber()</code> |
| <code>luaL_checkoption</code> | ☑️ <code>lua.checkOption()</code> |
| <code>luaL_checkstack</code> | ☑️📢 <code>lua.checkStackOrError()</code> |
| <code>luaL_checkstring</code> | ☑️ <code>lua.checkString()</code> |
| <code>luaL_checktype</code> | ☑️ <code>lua.checkType()</code> |
| <code>luaL_checkudata</code> | ☑️ <code>lua.checkUserdata()</code>|
| <code>luaL_dofile</code> | ☑️ <code>lua.doFile()</code> |
| <code>luaL_dostring</code> | ☑️ <code>lua.doString()</code> |
| <code>luaL_error</code> | ☑️📢 <code>lua.raiseErrorFormat()</code> |
| <code>luaL_getmetafield</code> | ☑️ <code>lua.getMetaField()</code> |
| <code>luaL_getmetatable</code> | ☑️📢 <code>lua.getMetatableRegistry()</code> |
| <code>luaL_gsub</code> | ☑️ <code>lua.gsub()</code> |
| <code>luaL_loadbuffer</code> | ☑️ <code>lua.loadBuffer()</code> |
| <code>luaL_loadfile</code> | ☑️ <code>lua.loadFile()</code> |
| <code>luaL_loadstring</code> | ☑️ <code>lua.loadString()</code> |
| <code>luaL_newmetatable</code> | ☑️ <code>lua.newMetatable()</code> |
| <code>luaL_newstate</code> | 🆖 please use <code>Lua.init()</code> |
| <code>luaL_openlibs</code> | ☑️ <code>lua.openLibs()</code> |
| <code>luaL_optinteger</code> | ☑️📢 <code>lua.checkIntegerOptional()</code> |
| <code>luaL_optint</code> | 🆖 please use <code>lua.checkIntegerOptional()</code> |
| <code>luaL_optlong</code> | 🆖 please use <code>lua.checkIntegerOptional()</code> |
| <code>luaL_optlstring</code> | ☑️📢 <code>lua.checkLStringOptional()</code> |
| <code>luaL_optnumber</code> | ☑️📢 <code>lua.checkNumberOptional()</code> |
| <code>luaL_optstring</code> | ☑️📢 <code>lua.checkStringOptional()</code> |
| <code>luaL_prepbuffer</code> | ☑️ <code>buffer.prepBuffer()</code> |
| <code>luaL_pushresult</code> | ☑️ <code>buffer.pushResult()</code> |
| <code>luaL_ref</code> | ☑️ <code>lua.ref()</code> |
| <code>luaL_unref</code> | ☑️ <code>lua.unref()</code> |
| <code>luaL_register</code> | ☑️📢 <code>lua.registerLibrary()</code> |
| <code>luaL_typename</code> | ☑️ <code>lua.getTypeNameAt()</code> |
| <code>luaL_typerror</code> | ☑️📢 <code>lua.raiseErrorType()</code> |
| <code>luaL_where</code> | ☑️ <code>lua.where()</code> |
Debug API Coverage (<code>lua_Debug</code>)
| C Type Definition | Available in <code>zig-luajit</code> |
|----------------------------|-------------------------------------|
| <code>lua_Debug</code> | ☑️ <code>Lua.DebugInfo</code> |
| <code>lua_Hook</code> | ☑️📢 <code>Lua.HookFunction</code> |
| C API Symbol | Available in <code>zig-luajit</code> |
|----------------------------|-------------------------------------|
| <code>lua_getinfo</code> | ☑️ <code>lua.getInfo()</code> |
| <code>lua_getstack</code> | ☑️ <code>lua.getStack()</code> |
| <code>lua_gethookcount</code> | ☑️ <code>lua.getHookCount()</code> |
| <code>lua_gethookmask</code> | ☑️ <code>lua.getHookMask()</code> |
| <code>lua_gethook</code> | ☑️ <code>lua.getHook()</code> |
| <code>lua_sethook</code> | ☑️ <code>lua.setHook()</code> |
| <code>lua_getlocal</code> | ☑️ <code>lua.getLocal()</code> |
| <code>lua_setlocal</code> | ☑️ <code>lua.setLocal()</code> |
| <code>lua_getupvalue</code> | ☑️ <code>lua.getUpvalue()</code> |
| <code>lua_setupvalue</code> | ☑️ <code>lua.setUpvalue()</code> |
Additions to the API in <code>zig-luajit</code>
The following functions are added in <code>zig-luajit</code> and do not necessarily have a corresponding
function or macro in the C API.
| <code>zig-luajit</code> Extension Function | Description |
|---------------------------------|-------------|
| <code>lua.getInfoFunction()</code> | A simplified version of <code>lua.getInfo()</code> for inspecting functions, that has a more idiomatic Zig result type. |
| <code>lua.toNumberStrict()</code> | Gets the value of a number on the stack, without doing type coersion (e.g. from string values). |
| <code>lua.toIntegerStrict()</code> | Gets the value of an integer on the stack, without doing type coersion (e.g. from string values). |
| <code>lua.toBooleanStrict()</code> | Gets the value of a boolean on the stack, without doing type coersion based on "truthyness" of the value. |
| <code>lua.openBaseLib()</code> | Opens the <code>Base</code> Lua standard library. |
| <code>lua.openMathLib()</code> | Opens the <code>Math</code> Lua standard library. |
| <code>lua.openStringLib()</code> | Opens the <code>String</code> Lua standard library. |
| <code>lua.openTableLib()</code> | Opens the <code>Table</code> Lua standard library. |
| <code>lua.openIOLib()</code> | Opens the <code>IO</code> Lua standard library. |
| <code>lua.openOSLib()</code> | Opens the <code>OS</code> Lua standard library. |
| <code>lua.openPackageLib()</code> | Opens the <code>Package</code> Lua standard library. |
| <code>lua.openDebugLib()</code> | Opens the <code>Debug</code> Lua standard library. |
| <code>lua.openBitLib()</code> | Opens the <code>Bit</code> LuaJIT standard library. |
| <code>lua.openJITLib()</code> | Opens the <code>JIT</code> LuaJIT standard library. |
| <code>lua.openFFILib()</code> | Opens the <code>FFI</code> LuaJIT standard library. |
| <code>lua.openStringBufferLib()</code> | Opens the <code>StringBuffer</code> LuaJIT standard library. |
Licensing
The <code>zig-luajit</code> Zig languge bindings are distributed under the terms of the AGPL-3.0 License. The terms of this
license can be found in the <a>LICENSE</a> file.
This project depends on source code and other artifacts from third parties. Information about their respective licenses
can be found in the <a>COPYRIGHT</a> file.
* <a>The LuaJIT Project</a>
* <a>Lua</a>
Credits
This project was inspired by <a>natecraddock/ziglua</a> which provides great
functionality if you're looking to use Lua runtimes other than LuaJIT! | [] |
https://avatars.githubusercontent.com/u/15877106?v=4 | rockbox-zig | tsirysndr/rockbox-zig | 2024-08-27T14:45:36Z | Rockbox open source high quality audio player as a Music Player Daemon. This project brings modern enhancements to the classic Rockbox firmware, using Zig and Rust for improved performance and maintainability ⚡ 🦀 | master | 6 | 49 | 3 | 49 | https://api.github.com/repos/tsirysndr/rockbox-zig/tags | GPL-2.0 | [
"audio",
"deno",
"flatpak",
"graphql",
"grpc",
"gtk",
"jukebox",
"libadwaita",
"mpd",
"mpris",
"music-player",
"music-server",
"music-streaming",
"rockbox",
"rust",
"self-hosted",
"tokio",
"typescript",
"zig"
] | 226,390 | true | 2025-05-19T14:23:49Z | true | true | unknown | github | [] |
Rockbox Zig 🎵 ⚡
<a></a>
<a></a>
<a></a>
<a></a>
<a></a>
A modern take on the <a>Rockbox</a> open source high quality
audio player with enhancements in Zig and Rust. This project offers:
<ul>
<li>gRPC & GraphQL APIs for seamless interaction and control</li>
<li>Chromecast support for streaming to your TV</li>
<li><a>MPD</a> server for
compatibility with existing clients</li>
<li><a>MPRIS</a> support for
desktop integration</li>
<li>TypeScript support for building powerful extensions</li>
</ul>
Take advantage of modern tooling while preserving the core functionality of
Rockbox.
<blockquote>
<span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span> <strong>🐲 It is a work in progress and is not yet ready for use. 🏗️🚧</strong>
</blockquote>
✨ Features
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Zig Build System
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Rockbox API FFI for Rust
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>gRPC API</a>
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> GraphQL API
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> HTTP API
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Web Client (React)
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Fast search engine, built with
<a>Tantivy</a>
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Desktop Client (Electron/Gtk)
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Rockbox REPL
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Terminal Client (TUI)
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Systemd service
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Gapless playback and crossfading
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Navigate music by folders or tag database
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Supports over 20 sound codecs: MP3, OGG, WAV, FLAC and many more
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Android Library
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Mobile version (React Native)
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Stream from Youtube (audio only)
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Stream from Spotify
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Stream from Tidal
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Stream to Chromecast
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Stream to Kodi
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> TuneIn Radio
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> MPD Server
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> MPRIS
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> UPnP/DLNA
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Airplay
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> TypeScript (<a>Deno</a>) API (for writing plugins)
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Wasm extensions
🚀 Quickstart
To quickly get started, you can run the following docker command:
<code>sh
docker run \
--device /dev/snd \
--privileged \
-p 6061:6061 \
-p 6062:6062 \
-p 6063:6063 \
-p 6600:6600 \
-v $HOME/Music:/root/Music \
tsiry/rockbox:latest</code>
🚚 Installation
Ubuntu/Debian
<code>sh
echo "deb [trusted=yes] https://apt.fury.io/tsiry/ /" | sudo tee /etc/apt/sources.list.d/fury.list
sudo apt-get update
sudo apt-get install rockbox</code>
Fedora
Add the following to <code>/etc/yum.repos.d/fury.repo</code>:
<code>[fury]
name=Gemfury Private Repo
baseurl=https://yum.fury.io/tsiry/
enabled=1
gpgcheck=0</code>
Then run:
<code>sh
dnf install rockbox</code>
Arch Linux
<code>sh
paru -S rockbox-zig-bin</code>
Bash
<code>sh
curl -fsSL https://raw.githubusercontent.com/tsirysndr/rockbox-zig/HEAD/install.sh | bash</code>
📦 Downloads
<ul>
<li><code>Linux</code>: intel:
<a>rockbox_2025.02.16_x86_64-linux.tar.gz</a>
arm64:
<a>rockbox_2025.02.16_aarch64-linux.tar.gz</a></li>
</ul>
🧙♂️ Systemd Service
Rockbox daemon can be started as a systemd service. To enable and start the
service, run the following command:
<code>sh
rockbox service install</code>
To disable and stop the service, run the following command:
<code>sh
rockbox service uninstall</code>
To check the status of the service, run the following command:
<code>sh
rockbox service status</code>
Compiling from Source
Run the following commands to build the project:
Before building the project, you need to install the necessary dependencies for
your operating system.
On Ubuntu/Debian
<code>bash
sudo apt-get install libsdl2-dev libfreetype6-dev libunwind-dev zip protobuf-compiler cmake</code>
On Fedora40/41:
<code>sh
sudo dnf install SDL2-devel freetype-devel libunwind-devel zip protobuf-compiler cmake</code>
Build Instructions
<ol>
<li>Clone the repository</li>
</ol>
<code>sh
git clone https://github.com/tsirysndr/rockbox-zig.git
git submodule update --init --recursive</code>
<ol>
<li>Navigate to the project directory</li>
</ol>
<code>sh
cd rockbox-zig</code>
<ol>
<li>Build the webui</li>
</ol>
<code>sh
cd webui/rockbox
deno install
deno run build</code>
<ol>
<li>Run the following command to build the project</li>
</ol>
<code>sh
mkdir -p build && cd build
../tools/configure --target=sdlapp --type=N --lcdwidth=320 --lcdheight=240 --prefix=$HOME/.local
make zig</code>
Build GUI (Gtk4)
<code>sh
sudo apt-get install flatpak
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install --user flathub org.flatpak.Builder
flatpak install --user flathub org.gnome.Sdk/x86_64/47
flatpak install --user flathub org.gnome.Platform/x86_64/47
flatpak install --user org.freedesktop.Sdk.Extension.rust-stable
flatpak install --user org.freedesktop.Sdk.Extension.llvm18
cd gtk
flatpak run org.flatpak.Builder --user --disable-rofiles-fuse --repo=repo flatpak_app build-aux/io.github.tsirysndr.Rockbox.json --force-clean
flatpak run org.flatpak.Builder --run flatpak_app build-aux/io.github.tsirysndr.Rockbox.json rockbox-gtk</code>
🧑🔬 Architecture
📚 GraphQL API
Open <a>http://localhost:6062/graphiql</a> in your
browser.
📚 HTTP API
Open <a>http://localhost:6063</a> in your browser.
📚 gRPC API
<a>https://buf.build/tsiry/rockboxapis/docs/main:rockbox.v1alpha1</a>
Try Rockbox gRPC API using
<a>Buf Studio</a>.
| [] |
https://avatars.githubusercontent.com/u/113083639?v=4 | zgui | zig-gamedev/zgui | 2024-11-03T22:53:14Z | Zig build package and bindings for https://github.com/ocornut/imgui and optional extras. | main | 13 | 48 | 31 | 48 | https://api.github.com/repos/zig-gamedev/zgui/tags | MIT | [
"dearimgui",
"gamedev",
"gui",
"imgui",
"zig"
] | 2,014 | false | 2025-05-20T14:22:19Z | true | true | 0.14.0 | github | [
{
"commit": "c0dbf11cdc17da5904ea8a17eadc54dee26567ec.tar.gz",
"name": "system_sdk",
"tar_url": "https://github.com/zig-gamedev/system_sdk/archive/c0dbf11cdc17da5904ea8a17eadc54dee26567ec.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/zig-gamedev/system_sdk"
},
{
"commit": ... | <a>zgui</a>
Zig build package and bindings for <a>Dear Imgui</a> & extras.
Easy to use, hand-crafted API with default arguments, named parameters and Zig style text formatting. <a>Here</a> is a simple sample application, and <a>here</a> is a full one.
Features
<ul>
<li>Most public dear imgui API exposed</li>
<li>All memory allocations go through user provided Zig allocator</li>
<li><a>DrawList API</a> for vector graphics, text rendering and custom widgets</li>
<li><a>Test engine API</a> for automatic testing</li>
<li><a>Plot API</a> for advanced data visualizations</li>
<li><a>Gizmo API</a> for gizmo</li>
<li><a>Node editor API</a> for node based stuff</li>
</ul>
Versions
<ul>
<li><a>ImGui</a> <code>1.91.8-docking</code></li>
<li><a>ImGui test engine</a> <code>1.91.8</code></li>
<li><a>ImPlot</a> <code>O.17</code></li>
<li><a>ImGuizmo</a> <code>1.89 WIP</code></li>
<li><a>ImGuiNodeEditor</a> <code>O.9.3</code></li>
</ul>
Getting started
Example <code>build.zig</code>:
```zig
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ ... });
<code>const zgui = b.dependency("zgui", .{
.shared = false,
.with_implot = true,
});
exe.root_module.addImport("zgui", zgui.module("root"));
exe.linkLibrary(zgui.artifact("imgui"));
{ // Needed for glfw/wgpu rendering backend
const zglfw = b.dependency("zglfw", .{});
exe.root_module.addImport("zglfw", zglfw.module("root"));
exe.linkLibrary(zglfw.artifact("glfw"));
const zpool = b.dependency("zpool", .{});
exe.root_module.addImport("zpool", zpool.module("root"));
const zgpu = b.dependency("zgpu", .{});
exe.root_module.addImport("zgpu", zgpu.module("root"));
exe.linkLibrary(zgpu.artifact("zdawn"));
}
</code>
}
```
Now in your code you may import and use <code>zgui</code>:
```zig
const zgui = @import("zgui");
zgui.init(allocator);
_ = zgui.io.addFontFromFile(content_dir ++ "Roboto-Medium.ttf", 16.0);
zgui.backend.init(
window,
demo.gctx.device,
@enumToInt(swapchain_format),
@enumToInt(depth_format),
);
```
```zig
// Main loop
while (...) {
zgui.backend.newFrame(framebuffer_width, framebuffer_height);
<code>zgui.bulletText(
"Average : {d:.3} ms/frame ({d:.1} fps)",
.{ demo.gctx.stats.average_cpu_time, demo.gctx.stats.fps },
);
zgui.bulletText("W, A, S, D : move camera", .{});
zgui.spacing();
if (zgui.button("Setup Scene", .{})) {
// Button pressed.
}
if (zgui.dragFloat("Drag 1", .{ .v = &value0 })) {
// value0 has changed
}
if (zgui.dragFloat("Drag 2", .{ .v = &value0, .min = -1.0, .max = 1.0 })) {
// value1 has changed
}
// Setup wgpu render pass here
zgui.backend.draw(pass);
</code>
}
```
Building a shared library
If your project spans multiple zig modules that both use ImGui, such as an exe paired with a dll, you may want to build the <code>zgui</code> dependencies (<code>zgui_pkg.zgui_c_cpp</code>) as a shared library. This can be enabled with the <code>shared</code> build option. Then, in <code>build.zig</code>, use <code>zgui_pkg.link</code> to link <code>zgui</code> to all the modules that use ImGui.
When built this way, the ImGui context will be located in the shared library. However, the <code>zgui</code> zig code (which is compiled separately into each module) requires its own memory buffer which has to be initialized separately with <code>initNoContext</code>.
In your executable:
<code>zig
const zgui = @import("zgui");
zgui.init(allocator);
defer zgui.deinit();</code>
In your shared library:
<code>zig
const zgui = @import("zgui");
zgui.initNoContext(allocator);
defer zgui.deinitNoContxt();</code>
DrawList API
<code>zig
draw_list.addQuad(.{
.p1 = .{ 170, 420 },
.p2 = .{ 270, 420 },
.p3 = .{ 220, 520 },
.p4 = .{ 120, 520 },
.col = 0xff_00_00_ff,
.thickness = 3.0,
});
draw_list.addText(.{ 130, 130 }, 0xff_00_00_ff, "The number is: {}", .{7});
draw_list.addCircleFilled(.{ .p = .{ 200, 600 }, .r = 50, .col = 0xff_ff_ff_ff });
draw_list.addCircle(.{ .p = .{ 200, 600 }, .r = 30, .col = 0xff_00_00_ff, .thickness = 11 });
draw_list.addPolyline(
&.{ .{ 100, 700 }, .{ 200, 600 }, .{ 300, 700 }, .{ 400, 600 } },
.{ .col = 0xff_00_aa_11, .thickness = 7 },
);</code>
Test Engine API
Zig wraper for <a>ImGUI test engine</a>.
```zig
var check_b = false;
var _te: <em>zgui.te.TestEngine = zgui.te.getTestEngine().?;
fn registerTests() void {
_ = _te.registerTest(
"Awesome",
"should_do_some_another_magic",
@src(),
struct {
pub fn gui(ctx: </em>zgui.te.TestContext) !void {
_ = ctx; // autofix
_ = zgui.begin("Test Window", .{ .flags = .{ .no_saved_settings = true } });
defer zgui.end();
<code> zgui.text("Hello, automation world", .{});
_ = zgui.button("Click Me", .{});
if (zgui.treeNode("Node")) {
defer zgui.treePop();
_ = zgui.checkbox("Checkbox", .{ .v = &check_b });
}
}
pub fn run(ctx: *zgui.te.TestContext) !void {
ctx.setRef("/Test Window");
ctx.windowFocus("");
ctx.itemAction(.click, "Click Me", .{}, null);
ctx.itemAction(.open, "Node", .{}, null);
ctx.itemAction(.check, "Node/Checkbox", .{}, null);
ctx.itemAction(.uncheck, "Node/Checkbox", .{}, null);
std.testing.expect(true) catch |err| {
zgui.te.checkTestError(@src(), err);
return;
};
}
},
);
</code>
}
```
Plot API
<code>zig
if (zgui.plot.beginPlot("Line Plot", .{ .h = -1.0 })) {
zgui.plot.setupAxis(.x1, .{ .label = "xaxis" });
zgui.plot.setupAxisLimits(.x1, .{ .min = 0, .max = 5 });
zgui.plot.setupLegend(.{ .south = true, .west = true }, .{});
zgui.plot.setupFinish();
zgui.plot.plotLineValues("y data", i32, .{ .v = &.{ 0, 1, 0, 1, 0, 1 } });
zgui.plot.plotLine("xy data", f32, .{
.xv = &.{ 0.1, 0.2, 0.5, 2.5 },
.yv = &.{ 0.1, 0.3, 0.5, 0.9 },
});
zgui.plot.endPlot();
}</code>
Gizmo API
Zig wraper for <a>ImGuizmo</a>.
Node editor API
Zig wraper for <a>ImGuiNodeEditor</a>.
```zig
var node_editor = zgui.node_editor.EditorContext.create(.{ .enable_smooth_zoom = true }),
zgui.node_editor.setCurrentEditor(node_editor);
defer zgui.node_editor.setCurrentEditor(null);
{
zgui.node_editor.begin("NodeEditor", .{ 0, 0 });
defer zgui.node_editor.end();
<code>zgui.node_editor.beginNode(1);
{
defer zgui.node_editor.endNode();
zgui.textUnformatted("Node A");
zgui.node_editor.beginPin(1, .input);
{
defer zgui.node_editor.endPin();
zgui.textUnformatted("-> In");
}
zgui.sameLine(.{});
zgui.node_editor.beginPin(2, .output);
{
defer zgui.node_editor.endPin();
zgui.textUnformatted("Out ->");
}
}
</code>
}
``` | [
"https://github.com/Aryvyo/zigClipboard",
"https://github.com/Avokadoen/zig_vulkan",
"https://github.com/Name-hw/JanRenderer",
"https://github.com/Senryoku/Deecy",
"https://github.com/azillion/gravitas",
"https://github.com/braheezy/zonk",
"https://github.com/cyberegoorg/cetech1",
"https://github.com/... |
https://avatars.githubusercontent.com/u/1856197?v=4 | zig-ai | FOLLGAD/zig-ai | 2024-11-30T21:23:56Z | OpenAI SDK with streaming support | main | 0 | 41 | 5 | 41 | https://api.github.com/repos/FOLLGAD/zig-ai/tags | - | [
"openai",
"zig",
"zig-package"
] | 17 | false | 2025-05-11T01:39:10Z | true | true | unknown | github | [] | zig-ai
A simple OpenAI API client for Zig with streaming support.
Find examples in the <a><code>examples</code></a> directory.
Usage
With streaming:
```zig
const std = @import("std");
const OpenAI = @import("zig-ai");
pub fn main() !void {
// ...
<code>var messages = std.ArrayList(OpenAI.Message).init(allocator);
try messages.append(.{
.role = "system",
.content = "You are a helpful assistant",
});
try messages.append(.{
.role = "user",
.content = "User message here",
});
const payload = OpenAI.ChatPayload{
.model = "gpt-4o",
.messages = messages.items,
.max_tokens = 1000,
.temperature = 0.2,
};
var stream = try openai.streamChat(payload, false);
defer stream.deinit();
while (try stream.next()) |response| {
// Stream the response to stdout
if (response.choices[0].delta.content) |content| {
try writer.writeAll(content);
try buf_writer.flush();
}
}
</code>
}
```
Installation
<code>bash
$ zig fetch --save git+https://github.com/FOLLGAD/zig-ai</code>
and add <code>zig-ai</code> to your <code>build.zig</code> file:
```zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
<code>const exe = b.addExecutable(.{
.name = "stream-cli",
.root_source_file = b.path("examples/stream-cli.zig"),
.target = target,
.optimize = optimize,
});
const module = b.dependency("zig-ai", .{
.root_source_file = b.path("src/llm.zig"),
});
exe.root_module.addImport("zig-ai", module.module("zig-ai"));
</code>
}
```
Usage
See the <code>examples</code> directory for usage examples. | [] |
https://avatars.githubusercontent.com/u/47111091?v=4 | ymir | smallkirby/ymir | 2024-08-10T11:35:16Z | Ymir: The Type-1 Hypervisor. | master | 1 | 41 | 2 | 41 | https://api.github.com/repos/smallkirby/ymir/tags | MIT | [
"hypervisor",
"zig"
] | 780 | false | 2025-05-15T10:05:42Z | true | true | 0.14.0 | github | [] | Ymir: The Type-1 Hypervisor
Ymir is an Intel VT-x based baremetal hypervisor written in Zig.
It is minimalistic but can boot latest Linux kernel (v6.9).
Features
<ul>
<li>Supports Intel x64 architecture.</li>
<li>Can boot latest Linux kernel with initramfs.</li>
<li>Uses EPT (Extended Page Tables) for memory virtualization.</li>
<li>Super thin (passthrough) and minimalistic hypervisor.</li>
<li>No dependencty. Everything is written from scratch in Zig.</li>
</ul>
Limitations / Future Work
<ul>
<li>No support of SMP.</li>
<li>No support of APIC and other fundamental features.</li>
<li>Can boot only Linux kernel with <a>x86 boot protocol</a>.</li>
<li>Can host only one VM at a time.</li>
<li>And many more...</li>
</ul>
Requirements
Install <code>ovmf</code> package to run UEFI firmware on QEMU:
<code>sh
sudo apt install ovmf</code>
Development
<code>sh
zig build install-samples
zig build run -Dlog_level=info -Doptimize=ReleaseFast</code>
If you want to use your own kernel image and initramfs,
you can put your kernel image (<code>bzImage</code>) and initramfs (<code>initramfs.cpio</code>) to <code>/zig-out/img</code>.
It is tested that Ymir can boot Linux kernel v6.9 that is compiled with <code>defconfig</code> of x86-64. | [] |
https://avatars.githubusercontent.com/u/127856937?v=4 | ymlz | pwbh/ymlz | 2024-08-11T18:01:10Z | Small and convenient YAML parser for Zig | master | 0 | 41 | 7 | 41 | https://api.github.com/repos/pwbh/ymlz/tags | Apache-2.0 | [
"yaml-parser",
"zig",
"zig-library",
"zig-package"
] | 108 | false | 2025-05-06T01:02:24Z | true | true | unknown | github | [] |
Small and convenient <a target="_blank">YAML</a> parser
<a>Key Features</a> •
<a>How To Use</a> •
<a>Support</a> •
<a>Contribution</a> •
<a>License</a>
Key Features
<ul>
<li>Simple and straightforward to use thanks to built-in <a>reflections</a>.</li>
<li>Just define a struct, load a yml into it, and access your fields.</li>
<li>Supports recursive struct.</li>
<li>Deinitialization is handled for you, just call <code>deinit()</code> and you are done.</li>
<li>Fields are automatically parsed based on field type.</li>
<li>Ability to parse fields optionally.</li>
</ul>
How To Use
Easiest way to use ymlz is to fetch it via <code>zig fetch</code>, <strong>make sure to provide it the url of latest released version as the argument</strong>.
See an example below.
<code>bash
zig fetch --save https://github.com/pwbh/ymlz/archive/refs/tags/0.5.0.tar.gz</code>
Now in your <code>build.zig</code> we need to import ymlz as a module the following way:
```zig
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ ... });
<code>const ymlz = b.dependency("ymlz", .{});
exe.root_module.addImport("ymlz", ymlz.module("root"));
</code>
}
```
Parsing YAML from file
We can utilize <code>loadFile</code> which expects the absolute path to your YAML file, I will be loading the following YAML file located in the root of my project under the name <code>file.yml</code>:
<code>yml
first: 500
second: -3
name: just testing strings overhere
fourth: 142.241
foods:
- Apple
- Orange
- Strawberry
- Mango
inner:
sd: 12
k: 2
l: hello world
another:
new: 1
stringed: its just a string</code>
main.zig:
```zig
/// Usage
/// zig build run -- ./file.yml
const std = @import("std");
const Ymlz = @import("ymlz").Ymlz;
// Notice how simple it is to define a struct that is one-to-one
// to the yaml file structure
const Tester = struct {
first: i32,
second: i64,
name: []const u8,
fourth: f32,
foods: [][]const u8,
inner: struct {
sd: i32,
k: u8,
l: []const u8,
another: struct {
new: f32,
stringed: []const u8,
},
},
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
defer _ = gpa.deinit();
<code>const args = try std.process.argsAlloc(allocator);
defer std.process.argsFree(allocator, args);
if (args.len < 2) {
return error.NoPathArgument;
}
const yml_location = args[1];
const yml_path = try std.fs.cwd().realpathAlloc(
allocator,
yml_location,
);
defer allocator.free(yml_path);
var ymlz = try Ymlz(Tester).init(allocator);
const result = try ymlz.loadFile(yml_path);
defer ymlz.deinit(result);
// We can print and see that all the fields have been loaded
std.debug.print("Tester: {any}\n", .{result});
// Lets try accessing the first field and printing it
std.debug.print("First: {}\n", .{result.first});
// same goes for the array that we've defined `foods`
for (result.foods) |food| {
std.debug.print("{s}", .{food});
}
</code>
}
```
Parsing YAML from bytes
Parsing YAML file using generic <code>u8</code> slice for the sake of our example, lets parse a small YAML inlined in to some variable that contains our YAML in <code>[]const u8</code>.
```zig
const std = @import("std");
const Ymlz = @import("root.zig").Ymlz;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
defer _ = gpa.deinit();
<code>const yaml_content =
\\first: 500
\\second: -3
\\name: just testing strings overhere # just a comment
\\fourth: 142.241
\\# comment in between lines
\\foods:
\\ - Apple
\\ - Orange
\\ - Strawberry
\\ - Mango
\\inner:
\\ abcd: 12
\\ k: 2
\\ l: hello world # comment somewhere
\\ another:
\\ new: 1
\\ stringed: its just a string
;
const Experiment = struct {
first: i32,
second: i64,
name: []const u8,
fourth: f32,
foods: [][]const u8,
inner: struct {
abcd: i32,
k: u8,
l: []const u8,
another: struct {
new: f32,
stringed: []const u8,
},
},
};
var ymlz = try Ymlz(Experiment).init(allocator);
const result = try ymlz.loadRaw(yaml_content);
defer ymlz.deinit(result);
std.debug.print("Experiment.first: {}\n", .{result.first});
</code>
}
```
Parsing by providing a custom std.io.AnyReader
It's possible to pass your own implementation of the std.io.AnyReader interface to ymlz using <code>loadReader</code> which is used internally for both <code>loadFile</code> and <code>loadRaw</code>. See <a>internal implementation</a> for reference.
Contribution
You are more then welcomed to submit a PR, ymlz codebase is still pretty small and it should be relatively simple to get into it, if you have any questions regarding the project or you just need assist starting out, open an issue.
Support
If you find a bug please <a>submit new issue</a> and I will try to address it in my free time. I do however want to note that this project is used in my bigger project, so any bugs I find, I fix without reporting them as an issue, so some issues that may have been reported have beeen fixed without me seeing them.
License
Apache License 2.0. Can be found under the <a>LICENSE</a>. | [
"https://github.com/ceyhunkerti/oracle_tocsv"
] |
https://avatars.githubusercontent.com/u/113083639?v=4 | zmath | zig-gamedev/zmath | 2024-11-03T20:05:17Z | SIMD math library for Zig game developers | main | 6 | 39 | 13 | 39 | https://api.github.com/repos/zig-gamedev/zmath/tags | MIT | [
"3d-graphics",
"gamedev",
"linear-algebra",
"math",
"simd",
"zig"
] | 112 | false | 2025-05-18T20:56:50Z | true | true | 0.14.0 | github | [] | <a>zmath</a>
SIMD math library for game developers
Tested on x86_64 and AArch64.
Provides ~140 optimized routines and ~70 extensive tests.
Can be used with any graphics API.
Documentation can be found <a>here</a>.
Benchamrks can be found <a>here</a>.
An intro article can be found <a>here</a>.
Getting started
How to get dependencies
<ol>
<li>specific version: <code>zig fetch --save https://github.com/zig-gamedev/zmath/archive/refs/tags/<REPLACE ME>.tar.gz</code></li>
<li>main branch version: <code>zig fetch --save git+https://github.com/zig-gamedev/zmath.git</code></li>
</ol>
Example <code>build.zig</code>
```zig
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ ... });
<code>const zmath = b.dependency("zmath", .{});
exe.root_module.addImport("zmath", zmath.module("root"));
</code>
}
```
Now in your code you may import and use zmath:
```zig
const zm = @import("zmath");
pub fn main() !void {
//
// OpenGL/Vulkan example
//
const object_to_world = zm.rotationY(..);
const world_to_view = zm.lookAtRh(
zm.f32x4(3.0, 3.0, 3.0, 1.0), // eye position
zm.f32x4(0.0, 0.0, 0.0, 1.0), // focus point
zm.f32x4(0.0, 1.0, 0.0, 0.0), // up direction ('w' coord is zero because this is a vector not a point)
);
// <code>perspectiveFovRhGl</code> produces Z values in [-1.0, 1.0] range (Vulkan app should use <code>perspectiveFovRh</code>)
const view_to_clip = zm.perspectiveFovRhGl(0.25 * math.pi, aspect_ratio, 0.1, 20.0);
<code>const object_to_view = zm.mul(object_to_world, world_to_view);
const object_to_clip = zm.mul(object_to_view, view_to_clip);
// Transposition is needed because GLSL uses column-major matrices by default
gl.uniformMatrix4fv(0, 1, gl.TRUE, zm.arrNPtr(&object_to_clip));
// In GLSL: gl_Position = vec4(in_position, 1.0) * object_to_clip;
//
// DirectX example
//
const object_to_world = zm.rotationY(..);
const world_to_view = zm.lookAtLh(
zm.f32x4(3.0, 3.0, -3.0, 1.0), // eye position
zm.f32x4(0.0, 0.0, 0.0, 1.0), // focus point
zm.f32x4(0.0, 1.0, 0.0, 0.0), // up direction ('w' coord is zero because this is a vector not a point)
);
const view_to_clip = zm.perspectiveFovLh(0.25 * math.pi, aspect_ratio, 0.1, 20.0);
const object_to_view = zm.mul(object_to_world, world_to_view);
const object_to_clip = zm.mul(object_to_view, view_to_clip);
// Transposition is needed because HLSL uses column-major matrices by default
const mem = allocateUploadMemory(...);
zm.storeMat(mem, zm.transpose(object_to_clip));
// In HLSL: out_position_sv = mul(float4(in_position, 1.0), object_to_clip);
//
// 'WASD' camera movement example
//
{
const speed = zm.f32x4s(10.0);
const delta_time = zm.f32x4s(demo.frame_stats.delta_time);
const transform = zm.mul(zm.rotationX(demo.camera.pitch), zm.rotationY(demo.camera.yaw));
var forward = zm.normalize3(zm.mul(zm.f32x4(0.0, 0.0, 1.0, 0.0), transform));
zm.storeArr3(&demo.camera.forward, forward);
const right = speed * delta_time * zm.normalize3(zm.cross3(zm.f32x4(0.0, 1.0, 0.0, 0.0), forward));
forward = speed * delta_time * forward;
var cam_pos = zm.loadArr3(demo.camera.position);
if (keyDown('W')) {
cam_pos += forward;
} else if (keyDown('S')) {
cam_pos -= forward;
}
if (keyDown('D')) {
cam_pos += right;
} else if (keyDown('A')) {
cam_pos -= right;
}
zm.storeArr3(&demo.camera.position, cam_pos);
}
//
// SIMD wave equation solver example (works with vector width 4, 8 and 16)
// 'T' can be F32x4, F32x8 or F32x16
//
var z_index: i32 = 0;
while (z_index < grid_size) : (z_index += 1) {
const z = scale * @intToFloat(f32, z_index - grid_size / 2);
const vz = zm.splat(T, z);
var x_index: i32 = 0;
while (x_index < grid_size) : (x_index += zm.veclen(T)) {
const x = scale * @intToFloat(f32, x_index - grid_size / 2);
const vx = zm.splat(T, x) + voffset * zm.splat(T, scale);
const d = zm.sqrt(vx * vx + vz * vz);
const vy = zm.sin(d - vtime);
const index = @intCast(usize, x_index + z_index * grid_size);
zm.store(xslice[index..], vx, 0);
zm.store(yslice[index..], vy, 0);
zm.store(zslice[index..], vz, 0);
}
}
</code>
}
``` | [
"https://github.com/Catniped/capy-stl-viewer",
"https://github.com/Game4all/unnamed-voxel-tracer",
"https://github.com/JamWils/zig-graphics-experiments",
"https://github.com/Miou-zora/Zaytracer",
"https://github.com/Name-hw/JanRenderer",
"https://github.com/azillion/gravitas",
"https://github.com/brahee... |
https://avatars.githubusercontent.com/u/20110944?v=4 | commy | ringtailsoftware/commy | 2024-12-13T16:31:33Z | A serial monitor for Mac, Linux and Windows | main | 0 | 39 | 3 | 39 | https://api.github.com/repos/ringtailsoftware/commy/tags | MIT | [
"serial",
"serial-communication",
"serialmonitor",
"uart",
"zig",
"zig-package"
] | 3,158 | false | 2025-03-20T21:51:17Z | true | true | unknown | github | [
{
"commit": "ddb549398cafd9cedbe96e13e893faa6e8bfa2db",
"name": "serial",
"tar_url": "https://github.com/ringtailsoftware/serial/archive/ddb549398cafd9cedbe96e13e893faa6e8bfa2db.tar.gz",
"type": "remote",
"url": "https://github.com/ringtailsoftware/serial"
},
{
"commit": "00c26bea76ba3d3... | Commy, a serial monitor
Commy is a small console utility for communicating with tty, UART or COM port devices. It runs on Mac, Linux and Windows. Windows support is experimental (bug reports appreciated).
Does (some of) the same things as <a>tio</a>, <a>minicom</a>, <a>screen</a>, <a>miniterm.py</a>, <a>zcom</a>, <a>PuTTY</a>, etc.
Commy incorporates a VT220/xterm/ECMA-48 terminal emulator for consistency whether running in <a>Windows Terminal</a>, <a>XTerm</a> or <a>Terminal.app</a>.
Build from source
Use zig 0.14.0
<code>shell
zig build
zig-out/bin/commy -h</code>
The binary is:
<code>shell
zig-out/bin/commy</code>
Copy it to a directory in your path for easy access:
<code>shell
sudo cp zig-out/bin/commy /usr/local/bin</code>
Or if you prefer, let zig install it in your home directory (assuming <code>~/.local/bin</code> is in your <code>$PATH</code>):
<code>shell
zig build -Doptimize=ReleaseSafe --prefix ~/.local</code>
<code>commy</code> is a single statically linked binary. No further runtime files are required.
You may install it on another system by simply copying the binary. It can be cross compiled using zig's <code>-Dtarget</code>
<code>shell
zig build -Dtarget=x86_64-windows</code>
Typical use
List available serial ports
```shell
commy -l
/dev/cu.usbmodem1124101
/dev/cu.usbmodem1124203
```
Connect to a port
<code>shell
commy /dev/cu.usbmodem1124203 115200</code>
Commy will try to find available ports which match so connecting to <code>/dev/ttyUSB0</code> can be written as:
<code>shell
commy USB0 115200</code>
The status bar at the top shows keyboard shortcuts. Press <code>ctrl-a</code> then <code>q</code>, <code>\</code> or <code>x</code> to quit.
Log data received from a device (only received data will be logged, unless local echo is enabled):
<code>shell
commy /dev/cu.usbmodem1124203 115200 -o log.txt</code>
Enable local echo of sent data, used for devices which do not echo back characters they receive:
<code>shell
commy /dev/cu.usbmodem1124203 115200 -e</code>
Scrollback
Commy supports moving back and forwards in terminal history. However, unlike some serial monitors, it stores screen updates rather than lines of incoming text. This means that a terminal UI can be rewound and replayed in time visually. To enter scrollback, press <code>ctrl-a</code>, then use up/down/pageup/pagedown to move through terminal history.
To run commy with a longer scrollback history, use a larger <code>-b <value></code>.
Why use Commy?
It tells you how to quit.
Commy does what I use GNU <code>screen</code> for, but it's better in two important respects. First, it is slightly smaller; and secondly it has the words "ctrl-a and quit" inscribed in large friendly letters on its cover.
Help text
<code>Usage: commy [ARGS] [OPTIONS]
Args:
port serial port file
speed baudrate
Options:
-v, --version Version
-l, --list List available serial ports
-e, --echo Enable local echo
-o, --output=<output> Log to file
-p, --parity=<parity> Parity
values: { none, even, odd, mark, space }
-w, --wordsize=<wordsize> wordsize
values: { five, six, seven, eight }
-s, --stop=<stop> stop
values: { one, two }
-f, --flow=<flow> flow
values: { none, software, hardware }
-b, --buffer=<buffer> Scrollback buffer size
-h, --help Print this help and exit
</code>
Testing
If no serial device is available, commy can connect to a Linux serial terminal inside docker. From here, any standard linux terminal software can be used.
<code>shell
cd linux-test
./lincommy.sh</code>
This will build commy, then build a docker container and start it. Inside the container <code>socat</code> will create a virtual serial port and bind it to <code>bash</code>. commy will then connect to the virtual serial port. Quitting commy will close down the docker container. | [] |
https://avatars.githubusercontent.com/u/43412083?v=4 | zigimports | tusharsadhwani/zigimports | 2024-09-02T20:25:33Z | Automatically remove unused imports and globals from Zig files. | main | 2 | 36 | 3 | 36 | https://api.github.com/repos/tusharsadhwani/zigimports/tags | MIT | [
"imports",
"zig"
] | 42 | false | 2025-05-18T22:36:28Z | true | true | 0.13.0 | github | [] | zigimports
Automatically remove unused imports and global variables from Zig files.
Zig currently entirely ignores unused globals, which means unused imports aren't errors.
They aren't even warnings.
In fact, you can have an import importing a module/file that <em>doesn't even exist</em>, and
the Zig compiler will simply ignore it.
<code>zigimports</code> helps you avoid that by cleaning up unused imports.
<blockquote>
<span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span>
Zig plans to eventually address this issue in the compiler directly:
https://github.com/ziglang/zig/issues/335
</blockquote>
Installation
Get it from the Releases page:
<a>https://github.com/tusharsadhwani/zigimports/releases</a>
Or if you prefer,
Build it locally
Requires Zig 0.13.0 or newer:
<code>bash
zig build --release=safe</code>
You should have the <code>./zig-out/bin/zigimports</code> binary now.
Usage
Basic usage:
```console
$ zigimports path/to/file.zig
path/to/file.zig:1:0: std is unused
path/to/file.zig:2:0: otherfile is unused
path/to/file.zig:9:0: MyStruct is unused
$ zigimports path/to/file.zig --fix
path/to/file.zig - Removed 3 unused imports
```
To tidy up your entire codebase, use:
<code>bash
zigimports --fix .</code> | [] |
https://avatars.githubusercontent.com/u/7820420?v=4 | zig-cats | flyfish30/zig-cats | 2024-09-10T01:45:04Z | A category and functional programing library for Zig language | main | 0 | 35 | 2 | 35 | https://api.github.com/repos/flyfish30/zig-cats/tags | GPL-3.0 | [
"category-theory",
"functional-programming",
"zig",
"zig-package"
] | 557 | false | 2025-05-22T07:36:30Z | true | true | 0.14.0 | github | [] | zig-cats
A category and functional programing library for Zig: Monoid, Functor, Applicative, Monad, Compose, Product, Coproduct, Generic, etc.
The Monoid/Functor/Applicative/Monad has support pure data type.
current supported feature list
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> SemiGroup
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Monoid
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Functor
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Natural Transformation
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Applicative Functor
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Monad
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Compose
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Product
<br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Coproduct
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Foldable
<br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Traversable | [] |
https://avatars.githubusercontent.com/u/77889270?v=4 | droidux | leath-dub/droidux | 2024-09-06T18:53:54Z | Create user space drivers for your android devices (digitizer, buttons, etc) | main | 1 | 35 | 3 | 35 | https://api.github.com/repos/leath-dub/droidux/tags | MIT | [
"android",
"android-tablet",
"app",
"buttons",
"linux",
"low-latency",
"stylus",
"tablet",
"touch",
"uinput",
"wayland",
"x11",
"xorg",
"zig"
] | 43 | false | 2025-05-19T23:23:01Z | true | true | unknown | github | [
{
"commit": "refs",
"name": "clap",
"tar_url": "https://github.com/Hejsil/zig-clap/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/Hejsil/zig-clap"
}
] | Droidux
Let your Linux device inherit the hardware components of your android device.
With this you can:
<ul>
<li>
Use your android tablets digitizer (touch-sensor) as though it was an
external (wacom-like) tablet for your Linux device.
</li>
<li>
Use your android phones touch screen on your Linux device.
</li>
</ul>
NOTE: this is a WIP and it will almost certainly have bugs, especially due to the fact that I wrote the device parser based on only the hardware I have. If you have any issues please raise them and I am happy to fix them.
Installation
Binary builds are in the releases page on this repository: <a>latest one here</a>.
Example on how to download and install
<code>sh
curl -LO https://github.com/leath-dub/droidux/releases/download/latest/droidux-x86_64-linux-musl.xz
xz -d droidux-x86_64-linux-musl.xz
doas install -m +x droidux-x86_64-linux-musl /usr/local/bin/droidux</code>
This will install <code>droidux</code> binary into <code>/usr/local/bin</code>.
Replace <code>x86_64</code> with your CPU architecture (most likely you are <code>x86_64</code> too).
<strong>IMPORTANT:</strong> You still need to follow the steps below with binary release, you
just don't need <code>zig</code> or have to build the project.
Building
To build the project you will need <code>zig</code> version <code>0.13.0</code> and <code>adb</code>.
ADB
This project uses <code>adb</code> for getting device information and reading device
events.
On archlinux:
<code>sh
sudo pacman -S android-tools</code>
This will install <code>adb</code> and and <code>android-udev</code> which will setup the udev rules
for <code>adb</code> to work.
On voidlinux:
<code>sh
sudo xbps-install -S android-tools android-udev-rules</code>
On other distros the their naming maybe slightly different however the important thing is that you get <code>adb</code> binary and the proper <code>udev</code> rules.
You can test that adb works by running:
<code>sh
adb devices</code>
If you get any warnings or errors, make sure you login and out
again (or reboot) as the <code>udev</code> rules may not be realised yet.
Droidux specific udev rules and hwdb files
IMPORTANT: make sure you complete this step otherwise <code>droidux</code> will not be able to run, either due to permission issues
or libinput not being happy about the initial values of certain devices.
Udev
First make sure you have <code>udev</code> running on your distro. This is more than likely already setup however at least
for voidlinux you need to make sure you the <code>udevd</code> service is running. Also I think on voidlinux you will have to add your user to the <code>plugdev</code> group.
There is a example <code>udev</code> rules file in the repo <code>rules.d/00-droidux.rules</code>. It should look like this:
<code>KERNEL=="uinput", GROUP="wheel"</code>
Either add your user to the <code>wheel</code> group or replace the "wheel" with your user name.
Hwdb
Hwdb as far as I know is just a way to set default values for devices that the drivers of which do not properly
set. Unfortunately I have hit this issue with my boox note air 2. The tell tale sign that you need a hwdb entry
is if libinput is complaining about skipping the device when you run:
<code>sh
sudo libinput list-devices</code>
Consult these docs if you are hitting this issue with a different device: https://wayland.freedesktop.org/libinput/doc/1.12.0/tablet-debugging.html. Also feel free to make an issue about it and I can try to help you out with it.
A boox devices hwdb file is in this repo at <code>hwdb.d/00-boox.hwdb</code>. This should work for most boox devices as from my limited knowledge from an older version of this project they seem to all have the same digitizer. The idea is to have many different devices in <code>hwdb.d/</code> on this repo. Also if you know of a list of android's <code>hwdb</code> files that would be super helpful for this of course !
Similar to <code>udev</code> you need to put the files in <code>/etc/udev</code>, however this time at <code>/etc/udev/hwdb.d/00-boox.hwdb</code>. Unlike udev you need
to also trigger a recompilation of the database (at <code>/etc/udev/hwdb.bin</code> for me).
On systemd-distros (most distros) you run:
<code>sh
sudo sytemd-hwdb update</code>
Many doc also tell you to run <code>udevadm trigger /dev/input/eventXX</code> however for <code>droidux</code> this is not really applicable unless you are running it while you run <code>systemd-hwdb update</code>.
On non-systemd distros, or at least on voidlinux you can run:
<code>sh
sudo udevadm hwdb --root=/ --update</code>
Zig
Don't worry the hard part is over if you have setup <code>adb</code> and <code>hwdb</code>. Now you just need to install <code>zig</code> compiler. If your distro
ships version <code>0.13.0</code> you should install it via that, otherwise you can install it at https://ziglang.org/download/.
Finally
You can build the project with:
<code>sh
zig build -Doptimize=ReleaseFast</code>
The binary for <code>droidux</code> will be in <code>zig-out/bin/droidux</code>. Make sure it is in your path, or the simplest is to just copy it to
<code>/usr/local/bin/</code> directory.
Usage
The general usage of the tool has 2 main parts:
<ol>
<li>getting device information</li>
<li>setting up the virtual device you choose</li>
</ol>
NOTE: make sure you enable usb debugging on your android device. See https://developer.android.com/studio/debug/dev-options.
After you plug in you android device via usb (you can also use wifi consult https://developer.android.com/tools/adb). You can run:
<code>sh
droidux -l</code>
You will need to accept "usb debugging" message on your device. If you are not lightning fast <code>droidux</code> will likely exit as it failed
to connect to the device. Just re-run the command after you have accepted the "usb debugging" message.
The command will dump the list of hardware devices on your android device as json. You can use a tool like <code>jq</code> to filter this output
to for example list only the names:
<code>sh
droidux -l | jq ".name"</code>
Once you have found a device you wish to use just copy the name, for boox users it will likely be "onyx_emp_Wacom I2C Digitizer".
Now just run <code>droidux</code> passing that device name, e.g.:
<code>sh
droidux "onyx_emp_Wacom I2C Digitizer"</code>
This should setup your device and proxy and events it reads.
To check that it is setup run something like this:
<code>sh
cat /proc/bus/input/devices | grep "<put device name here!>"</code>
It is fine to "Ctrl+C" this to stop it, or if it is running in
the background you can stop it with:
<code>sh
pkill -USR1 droidux</code>
Or run <code>kill -USR1</code> after finding the pid of <code>droidux</code>.
I dont want to iteract with tablet and computer at the same time!
You can use a drawing app on the android device and just use the eraser or you could use https://play.google.com/store/apps/details?id=ch.dissem.apps.lightbox&hl=en-US (recommended) - this is just a simple app that is a blank white screen.
Mapping tablet output
The default behaviour on linux is to stretch the viewport of the tablet onto
that of the screen.
A good general resource for reading is this <a>archwiki</a> post.
Depending on your tablet dimensions with respect to the screen you are mapping
it onto (NOTE: width and height are swapped if you rotate the tablet*), your
strategy for mapping may be different.
if your tablets <code>width / height</code> is less than that of the monitor you are
mapping to (e.g. <code>4 / 3 < 16 / 9</code>). You should fix the height to be the same as
the monitor you are mapping to. If we fix the height, we must sacrifice some of
the width of the monitor, so we need to calculate a horizontal offset position
of the new viewport onto the monitors resolution and we need to find how wide
the new viewport is. The following calculates these variables:
<code>horizontal_offset</code> and <code>new_viewport_width</code>:
```
proportion_change_in_height = (tablet_height - monitor_width) / tablet_height
change_in_width = tablet_width * proportion_change_in_height
new_viewport_width = tablet_width - change_in_width
horizontal_offset = (monitor_width - new_viewport_width) / 2
```
This basically just calculates the proportional change that happens if we
linearly map the height of the tablets viewport to height of the monitors
viewport. We just use this change to calculate the new view port and the offset
that would center it on the screen.
For example if we have a tablet with <code>width * height = 1872 * 1404</code> (ONYX BOOX
Note Air 2 orientated horizontally). If we calculate the values above we
get <code>new_viewport_width = 1440</code> and <code>horizontal_offset = 240</code>.
The same process applies for if you want to fix the width, if for example you
have
a <code>4:3</code> monitor and <code>16:9</code> tablet (lazy example).
Now finally if you have these values, I know that at least for fellow sway users
you can change the tablets mapping like so:
```sh
input "11551:299:onyx_emp_Wacom_I2C_Digitizer" map_to_region 240 0 1440 1080
This is the width offset --^ ^ ^-------- This is the new viewport
|
`-- Height offset stays the same
```
That first argument to <code>input</code> is the device identifier you can get by
extracting the <code>identifier</code> field from <code>swaymsg</code>:
<code>sh
DROIDUX_DEVICE="onyx_emp_Wacom I2C Digitizer"
swaymsg -rt get_inputs | jq -r '.[] | select(.name == "'"$DROIDUX_DEVICE"'").identifier'</code>
Services
I do not use systemd myself. However I plan to write a service file for it (unless somebody else beats me !).
As for voidlinux. I am using <code>turnstiled</code> following how to setup user services via https://docs.voidlinux.org/config/services/user-services.html#turnstile. Then I run the following command in my window manager's config:
<code>sh
turnstile-update-runit-env DROIDUX_DEVICE='onyx_emp_Wacom I2C Digitizer'</code>
This sets up the environment for the following service script, which I put in <code>$HOME/.config/service/droidux/run</code> (make sure <code>run</code> is executable!):
```sh
!/bin/sh
exec droidux "$(cat "$TURNSTILE_ENV_DIR/DROIDUX_DEVICE")"
``` | [] |
https://avatars.githubusercontent.com/u/113083639?v=4 | zphysics | zig-gamedev/zphysics | 2024-11-04T21:13:35Z | Zig build package, bindings and C API (JoltC) for https://github.com/jrouwe/JoltPhysics | main | 4 | 33 | 10 | 33 | https://api.github.com/repos/zig-gamedev/zphysics/tags | MIT | [
"3d",
"bindings",
"gamedev",
"jolt-physics",
"physics",
"simulation",
"zig"
] | 1,034 | false | 2025-05-17T14:24:38Z | true | true | unknown | github | [] | <a>zphysics</a>
Zig build package, bindings and <a>C API</a> for <a>Jolt Physics</a>.
For a simple sample applications please see <a>here</a>.
Getting started
Example <code>build.zig</code>:
```zig
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ ... });
<code>const zphysics = b.dependency("zphysics", .{
.use_double_precision = false,
.enable_cross_platform_determinism = true,
});
exe.root_module.addImport("zphysics", zphysics.module("root"));
exe.linkLibrary(zphysics.artifact("joltc"));
</code>
}
```
Now in your code you may import and use <code>zphysics</code>:
```zig
const zphy = @import("zphysics");
pub fn main() !void {
try zphy.init(allocator, .{});
defer zphy.deinit();
<code>// Create physics system
const physics_system = try zphy.PhysicsSystem.create(
... // layer interfaces - please see sample application
.{
.max_bodies = 1024,
.num_body_mutexes = 0,
.max_body_pairs = 1024,
.max_contact_constraints = 1024,
},
);
defer physics_system.destroy();
// Create shape
const body_interface = physics_system.getBodyInterfaceMut();
const shape_settings = try zphy.BoxShapeSettings.create(.{ 1.0, 1.0, 1.0 });
defer shape_settings.release();
const shape = try shape_settings.createShape();
defer shape.release();
// Create body
const body_id = try body_interface.createAndAddBody(.{
.position = .{ 0.0, -1.0, 0.0, 1.0 },
.rotation = .{ 0.0, 0.0, 0.0, 1.0 },
.shape = shape,
.motion_type = .dynamic,
.object_layer = object_layers.non_moving,
}, .activate);
defer body_interface.removeAndDestroyBody(body_id);
physics_system.optimizeBroadPhase();
// Perform ray cast
{
const query = physics_system.getNarrowPhaseQuery();
var result = query.castRay(.{ .origin = .{ 0, 10, 0, 1 }, .direction = .{ 0, -20, 0, 0 } }, .{});
if (result.has_hit) {
// result.hit.body_id
// result.hit.fraction
// result.hit.sub_shape_id
...
}
}
// Main loop
while (...) {
physics_system.update(1.0 / 60.0, .{});
// Draw all bodies
const bodies = physics_system.getBodiesUnsafe();
for (bodies) |body| {
if (!zphy.isValidBodyPointer(body)) continue;
const object_to_world = object_to_world: {
const position = zm.loadArr4(body.position);
const rotation = zm.loadArr4(body.rotation);
var xform = zm.matFromQuat(rotation);
xform[3] = position;
xform[3][3] = 1.0;
break :object_to_world xform;
};
// Issue a draw call
...
}
}
</code>
}
```
Usage in a shared library
The <code>joltc</code> artifact can be built as a shared library by specifying the <code>shared</code> build option:
<code>const zphysics = b.dependency("zphysics", .{
.shared = true,
});</code>
If your zig module uses <code>zphysics</code> and is itself part of a shared library that is reloaded at runtime, then some additional steps are required:
<ul>
<li>Before unloading the shared library, call <code>preUnload</code> to export the internal global state</li>
<li>After reloading the shared library, call <code>postReload</code> to import the internal state and update allocator vtables</li>
</ul>
If you use <code>registerTrace</code> or <code>registerAssertFailed</code>, these must also be called again to update their function pointers. | [
"https://github.com/zig-gamedev/zig-gamedev"
] |
https://avatars.githubusercontent.com/u/44649669?v=4 | aoc.zig-template | Tomcat-42/aoc.zig-template | 2024-11-20T01:57:55Z | Advent of Code Zig Template | main | 0 | 32 | 3 | 32 | https://api.github.com/repos/Tomcat-42/aoc.zig-template/tags | - | [
"advent-of-code",
"advent-of-code-zig",
"aoc",
"zig",
"ziglang"
] | 59 | false | 2025-01-08T18:17:11Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/173191406?v=4 | Zune | Scythe-Technology/Zune | 2024-08-13T12:32:52Z | A Luau runtime | master | 4 | 30 | 2 | 30 | https://api.github.com/repos/Scythe-Technology/Zune/tags | NOASSERTION | [
"cli",
"general-purpose",
"luau",
"luau-lang",
"runtime",
"scripting",
"zig",
"ziglang"
] | 798 | false | 2025-05-19T17:18:31Z | true | true | 0.14.0 | github | [
{
"commit": null,
"name": "json",
"tar_url": null,
"type": "remote",
"url": "https://codeload.github.com/Scythe-Technology/zig-json/tar.gz/169d325128b76b2bb79456357871f42ff339b98e"
},
{
"commit": null,
"name": "yaml",
"tar_url": null,
"type": "remote",
"url": "https://cod... |
Zune
<a target="_blank">
</a>
Zune is a <a>Luau</a> runtime, inspired by <a>Lune</a>, similar to <a>Node</a>, or <a>Bun</a>.
Features
<ul>
<li><strong>Comprehensive API</strong>: Includes fully featured APIs for filesystem operations, networking, and standard I/O.</li>
<li><strong>Rich Standard Library</strong>: A rich standard library with utilities for basic needs, reducing the need for external dependencies.</li>
<li><strong>Cross-Platform Compatibility</strong>: Fully compatible with <strong>Linux</strong>, <strong>macOS</strong>, and <strong>Windows</strong>, ensuring broad usability across different operating systems.</li>
<li><strong>Inspired by Lune</strong>: Inspiration from Lune, providing a familiar environment for developers who have used Lune before.</li>
</ul>
Installation
You can get started with Zune by installing it via a package manager, releases, or by building it from source.
From Package Manager
<ul>
<li><strong>None, yet.</strong></li>
</ul>
From Releases
<ol>
<li>Head over to <a>Releases</a>.</li>
<li>Download for your system's architecture and os.</li>
<li>Unzip.</li>
<li>Run.</li>
</ol>
From Source
Requirements:
- <a>Zig</a>.
To build Zune from source:
1. Clone the repository:
<code>sh
git clone https://github.com/Scythe-Technology/Zune.git
cd zune</code>
2. Compile
<code>sh
zig build -Doptimize=ReleaseFast</code>
3. Use
<code>sh
./zig-out/bin/zune version</code>
From this point, you can add the binary to your path.
Roadmap
For more information on the future of Zune, check out the milestones
Help and Support
To get support or to chat, check out the <a>Discord</a>. And look for the "zune".
Contributing
Read <a>CONTRIBUTING.md</a>. | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.