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/96076981?v=4 | ZigMold | JohanRimez/ZigMold | 2024-08-21T10:44:42Z | Graphic demonstration featuring ZIG & SDL2 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/JohanRimez/ZigMold/tags | MIT | [
"sdl2",
"zig"
] | 9 | false | 2024-09-18T11:34:02Z | true | true | 0.13.0 | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/93116510?v=4 | clig | Klus3kk/clig | 2024-12-16T20:09:19Z | A lightweight CLI tool for file compression and decompression, written in Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Klus3kk/clig/tags | - | [
"cli",
"compression",
"decompression",
"zig"
] | 8 | false | 2024-12-17T22:36:19Z | true | false | unknown | github | [] | clig
<strong>CLIG</strong> is a command-line tool for compressing and decompressing text files using a combination of <strong>Run-Length Encoding (RLE)</strong> and <strong>dictionary-based compression</strong>. It efficiently reduces file size for repetitive and common text patterns.
<strong>Features</strong>
<ol>
<li><strong>Run-Length Encoding (RLE):</strong> Compresses consecutive repeated characters.</li>
<li><strong>Dictionary-based Compression:</strong> Replaces common sequences like <code>the</code>, <code>and</code>, and spaces with tokens to save space.</li>
<li><strong>Command-Line Interface (CLI):</strong> Intuitive and easy-to-use text-based interface.</li>
<li><strong>Decompression:</strong> Reverses the compression to recover the original file.</li>
</ol>
<strong>Build Instructions</strong>
<ol>
<li>
Clone the repository:
<code>bash
git clone https://github.com/yourusername/clig.git
cd clig</code>
</li>
<li>
Build the project:
<code>bash
zig build</code>
</li>
<li>
The executable will be generated in <code>zig-out/bin/</code>:
<code>bash
./zig-out/bin/clig</code>
</li>
</ol>
<strong>Usage</strong>
<strong>Compress a File</strong>
To compress a file, use:
<code>bash
./zig-out/bin/clig compress <input_file> <output_file></code>
<strong>Example:</strong>
<code>bash
./zig-out/bin/clig compress input.txt output.clig</code>
<strong>Decompress a File</strong>
To decompress a file, use:
<code>bash
./zig-out/bin/clig decompress <input_file> <output_file></code>
<strong>Example:</strong>
<code>bash
./zig-out/bin/clig decompress output.clig decompressed.txt</code>
<strong>Example</strong>
Command
<code>bash
./zig-out/bin/clig compress input.txt output.clig
./zig-out/bin/clig decompress output.clig decompressed.txt</code>
Output
<ul>
<li>
<strong>Compression:</strong>
<code>Compressed input.txt to output.clig
Original size: 242 bytes
Compressed size: 234 bytes
Compression Ratio: 96.69%</code>
</li>
<li>
<strong>Decompression:</strong>
<code>Decompressed output.clig to decompressed.txt
Original size: 234 bytes
Decompressed size: 242 bytes</code>
</li>
</ul>
<strong>Testing</strong>
Run all tests using:
<code>bash
zig build test</code> | [] |
https://avatars.githubusercontent.com/u/20323081?v=4 | ringbuffer | ngynkvn/ringbuffer | 2024-10-25T19:28:14Z | Simply std.RingBuffer but generic | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/ngynkvn/ringbuffer/tags | MIT | [
"zig"
] | 9 | false | 2024-11-02T20:41:19Z | true | true | unknown | github | [] | ringbuffer
This is just a direct rip of <a>RingBuffer</a> but with a generic type parameter so I can use it for floats
<em>I would not use this</em>, RingBuffer is small enough you can / should just copy the code instead of pulling this as a dependency. | [] |
https://avatars.githubusercontent.com/u/89275?v=4 | zOS | dgv/zOS | 2025-01-08T23:12:40Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/dgv/zOS/tags | MIT | [
"learning-exercise",
"riscv",
"unikernel",
"zig"
] | 4 | false | 2025-01-10T23:58:16Z | true | false | unknown | github | [] | zOS
<a></a>
<a></a>
<a></a>
just reimplementation of <a>OS in 1k lines</a>
setup
<strong>linux</strong>
<code>sh
sudo apt update && sudo apt install -y snapd qemu-system-misc curl
sudo snap install zig --beta --classic
git clone https://github.com/dgv/zOS; cd zOS
curl -LO https://github.com/qemu/qemu/raw/v8.0.4/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin
zig build run</code>
<strong>macos</strong>
<code>sh
brew install zig qemu
git clone https://github.com/dgv/zOS; cd zOS
zig build run</code> | [] |
https://avatars.githubusercontent.com/u/36482619?v=4 | xpose | jkoop/xpose | 2024-11-01T05:11:25Z | Configures an X output to compensate for a dim picture | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/jkoop/xpose/tags | MIT | [
"autoexposure",
"ffmpeg",
"stupid-shit",
"x11",
"zig"
] | 5 | false | 2025-02-03T02:27:47Z | true | true | 0.13.0 | github | [] | Xpose
Xpose is a tool that captures the screen, sorts the pixel values, and then configures the output to compensate for a dim picture.
Installation
Download the deb package from the releases page and install it.
Usage
<code>xpose <output> [<framerate>] [<smoothing>] [<percentile>] [<width>] [<height>]</code> | [] |
https://avatars.githubusercontent.com/u/24510271?v=4 | ipcalc | andreiyard/ipcalc | 2024-12-28T10:59:18Z | Simple command line utility that takes network CIDR (in prefix format or netmask format) and prints information about this network. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/andreiyard/ipcalc/tags | GPL-3.0 | [
"networking",
"zig"
] | 25 | false | 2025-01-28T16:31:10Z | true | true | unknown | github | [] | What is "ipcalc"?
"ipcalc" is a simple command line utility that takes network CIDR (in prefix format or netmask format) and prints information about this network.
Informaiton include:
- Address
- Netmask
- Wildcard netmask
- Broadcast
- First available host
- Last available host
- Possible number of hosts | [] |
https://avatars.githubusercontent.com/u/24943868?v=4 | SDL.zig | jethrodaniel/SDL.zig | 2024-09-04T16:24:32Z | SDL + SDL_ttf, built with Zig | main | 1 | 0 | 2 | 0 | https://api.github.com/repos/jethrodaniel/SDL.zig/tags | - | [
"sdl",
"sdl-ttf",
"sdl3",
"sdl3-ttf",
"zig"
] | 130 | false | 2025-02-03T11:14:51Z | true | true | unknown | github | [
{
"commit": "master",
"name": "sdl",
"tar_url": "https://github.com/libsdl-org/SDL/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/libsdl-org/SDL"
},
{
"commit": "master",
"name": "sdl_ttf",
"tar_url": "https://github.com/libsdl-org/SDL_ttf/archive/master.tar... |
SDL.zig
Build <a>SDL</a> using <a>zig</a> (version 0.13.0).
Also includes
<ul>
<li><a>SDL_ttf</a></li>
</ul>
Usage
TODO
Tests
Build all of SDL's test programs:
<code>zig build sdl-test</code>
Build and run a specific SDL test:
<code>zig build sdl-test-testaudiohotplug
zig build sdl-test-testcamera -- --camera 'Razer Kiyo'</code>
Examples
Build all of SDL's example programs:
<code>zig build sdl-examples</code>
Build and run a specific SDL example:
<code>zig build sdl-examples-woodeneye
zig build sdl-examples-snake</code>
Build all Zig examples:
<code>zig build zig-examples</code>
Build and run a specific Zig example:
<code>zig build zig-examples-ttf
zig build zig-examples-minimal</code>
License
<a>Zlib</a>, same as <a>SDL</a>. | [] |
https://avatars.githubusercontent.com/u/145479366?v=4 | fuizon | hiegz/fuizon | 2025-01-26T09:14:01Z | A cross-platform TUI library for Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/hiegz/fuizon/tags | MIT | [
"crossterm",
"terminal",
"tui",
"zig"
] | 125 | false | 2025-03-30T21:05:44Z | true | true | unknown | github | [
{
"commit": "2d7e60552bc59a6743714c78313f8199b1e7b888.zip",
"name": "kiwi",
"tar_url": "https://github.com/nucleic/kiwi/archive/2d7e60552bc59a6743714c78313f8199b1e7b888.zip.tar.gz",
"type": "remote",
"url": "https://github.com/nucleic/kiwi"
},
{
"commit": "94ed6af7b2aaaeab987fbf87fcee410... |
Fuizon
A cross-platform TUI library for Zig
Requirements
<ul>
<li>Zig 0.14.0</li>
<li>Rust/Cargo</li>
</ul>
Installation
<ol>
<li>Fetch:</li>
</ol>
<code>sh
zig fetch --save https://github.com/byut/fuizon/archive/<git-ref-here>.tar.gz</code>
<ol>
<li>Link to your executable or module:</li>
</ol>
<code>zig
const fuizon = b.dependency("fuizon", .{ .target = target, .optimize = optimize });
exe.root_module.addImport("fuizon", fuizon.module("fuizon"));</code>
<ol>
<li>Import:</li>
</ol>
<code>zig
const fuizon = @import("fuizon");</code>
What you can build
https://github.com/user-attachments/assets/e1e4189d-2b1c-481f-a519-0430aa619ace
Discover more examples <a>here</a> | [] |
https://avatars.githubusercontent.com/u/442455?v=4 | cimspinner | dinau/cimspinner | 2025-02-08T12:11:01Z | ImSpinner bindings for C language | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/dinau/cimspinner/tags | MIT | [
"bindings",
"cimgui",
"cimspinner",
"dear-imgui",
"imgui",
"imspinner",
"nelua",
"nim",
"spinner",
"wrapper",
"zig"
] | 8,803 | false | 2025-05-16T09:30:26Z | false | false | unknown | github | [] |
<ul>
<li><a>CImSpinner</a></li>
<li><a>Prerequisites</a></li>
<li><a>Build and run demo</a></li>
<li><a>Similar project ImGui / CImGui</a></li>
<li><a>SDL Game tutorial Platfromer</a></li>
</ul>
CImSpinner
Amazing <a>ImSpinner</a> !
CImSpinner is C language bindings for ImSpinner.
Prerequisites
<ul>
<li>Windows10 or later
<a>MSys2/MinGW</a> command line tools (Unix tools), make, gcc, g++, cp, rm, git, ...etc</li>
<li>Linux : Debian / Ubuntu family </li>
</ul>
<code>sh
$ sudo apt install gcc g++ make git
$ sudo apt install xorg-dev lib{opengl-dev,gl1-mesa-dev,glfw3,glfw3-dev,libsdl2-dev}</code>
Build and run demo
<code>sh
git clone --recursive https://github.com/dinau/cimspinner</code>
<ul>
<li>Run simple demo and ImSpinner original demo in C language </li>
</ul>
<code>sh
cd demo/c
make run</code>
<ul>
<li>Run C++ language demo
This is original <a>ImSpinner</a> demo.</li>
</ul>
<code>sh
cd demo/cpp
make run</code>
Similar project ImGui / CImGui
| Language | | Project |
| -------------------: | :---: | :----------------------------------------------------------------: |
| <strong>Nim</strong> | Compiler | <a>ImGuin</a>, <a>Nimgl_test</a>, <a>Nim_implot</a> |
| <strong>Lua</strong> | Script | <a>LuaJITImGui</a> |
| <strong>Zig</strong>, C lang. | Compiler | <a>Dear_Bindings_Build</a> |
| <strong>Zig</strong> | Compiler | <a>ImGuinZ</a> |
| <strong>NeLua</strong> | Compiler | <a>NeLuaImGui</a> |
| <strong>Python</strong> | Script | <a>DearPyGui for 32bit WindowsOS Binary</a> |
SDL Game tutorial Platfromer
| Language [^order] | | SDL | Project |
| -------------------: | :---: | :---: | :----------------------------------------------------------------: |
| <strong>LuaJIT</strong> | Script | SDL2 | <a>LuaJIT-Platformer</a>
| <strong>Nelua</strong> | Compiler | SDL2 | <a>NeLua-Platformer</a>
| <strong>Nim</strong> | Compiler | SDL3 / SDL2 | <a>Nim-Platformer-sdl2</a>/ <a>Nim-Platformer-sdl3</a> |
| <strong>Ruby</strong> | Script | SDL3 | <a>Ruby-Platformer</a> |
| <strong>Zig</strong> | Compiler | SDL2 | <a>Zig-Platformer</a> |
[^order]: Alphabectial order | [] |
https://avatars.githubusercontent.com/u/28966224?v=4 | inez | weskoerber/inez | 2024-11-23T00:28:40Z | Inez - A fast INI parser | main | 3 | 0 | 0 | 0 | https://api.github.com/repos/weskoerber/inez/tags | MIT | [
"tools",
"zig",
"zig-package"
] | 20 | false | 2024-12-28T22:24:26Z | true | true | unknown | github | [] | <a></a>
<a></a>
Inez - A fast INI parser
Quickstart
<ol>
<li>
Fetch <em>inez</em> using Zig's package manager
<code>shell
zig fetch --save git+https://github.com/weskoerber/inez#main</code>
</li>
<li>
Add <em>inez</em> to your artifacts in <code>build.zig</code>
```zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
<code>const inez = b.dependency("inez", .{
.target = target,
.optimize = optimize,
}).module("inez");
const my_exe = b.addExecutable(.{
.name = "my_exe",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
my_exe.root_module.addImport(inez);
</code>
}
```
</li>
</ol>
Usage
To use <em>inez</em>, there are 4 main steps:
1. Initialize <em>inez</em>
2. Load a document
3. Parse the document
4. Use parsed document
See the <code>examples/</code> directory for some examples. You can run them by using the
<code>example</code> step (where <code>name</code> is the name of the example):
<code>shell
zig build example -Dexample=<name></code> | [] |
https://avatars.githubusercontent.com/u/14016375?v=4 | haiya | thislight/haiya | 2024-09-09T10:45:56Z | Experimental HTTP server with Config-as-code and low-cost scripting. | master | 2 | 0 | 0 | 0 | https://api.github.com/repos/thislight/haiya/tags | - | [
"http",
"http-server",
"library",
"zig"
] | 123 | false | 2024-10-04T17:13:35Z | true | true | unknown | github | [
{
"commit": null,
"name": "parkinglot",
"tar_url": null,
"type": "relative",
"url": "parkinglot"
},
{
"commit": null,
"name": "typetool",
"tar_url": null,
"type": "relative",
"url": "typetool"
},
{
"commit": null,
"name": "rio",
"tar_url": null,
"type"... | Haiya - Extendable HTTP Server
Haiya is a extendable HTTP server inspired by Web frameworks - with full-speed running and development.
<ul>
<li>Improve you application as you needed. No need to be "correct" at the first try.</li>
<li>Simple execution model and guided APIs. Use the default as you pleased, and drive at you own when you needed.</li>
<li>Designed as a library.</li>
</ul>
What we have done?
<ul>
<li>A usable HTTP/1.x server.</li>
<li>Router with comptime-resolved dependency injection.</li>
</ul>
Usage
See <a>this "Hello World" example</a> and <a>the build script</a>.
You can build the API reference with <code>zig build</code>. Note that the reference must be served
at a HTTP server. You could do that with tools like <code>python -mhttp.server -d zig-out/docs</code>.
License
The Apache License, version 2. | [] |
https://avatars.githubusercontent.com/u/6032168?v=4 | n_queens_problem_zig | andreashdez/n_queens_problem_zig | 2024-08-12T22:15:24Z | N-Queens problem with genetic algorithm in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/andreashdez/n_queens_problem_zig/tags | MIT | [
"genetic-algorithm",
"zig"
] | 8 | false | 2024-08-12T23:15:43Z | true | true | unknown | github | [] | N-Queens Problem in Zig
~~~text
╔════╤════╤════╤════╤════╤════╤════╤════╗
║ │ │ │ │ │ 01 │ │ ║
╟────┼────┼────┼────┼────┼────┼────┼────╢
║ │ │ │ │ │ │ │ 00 ║
╟────┼────┼────┼────┼────┼────┼────┼────╢
║ │ │ 02 │ │ │ │ │ ║
╟────┼────┼────┼────┼────┼────┼────┼────╢
║ │ │ │ 02 │ │ │ │ ║
╟────┼────┼────┼────┼────┼────┼────┼────╢
║ │ 01 │ │ │ │ │ │ ║
╟────┼────┼────┼────┼────┼────┼────┼────╢
║ │ │ │ │ 00 │ │ │ ║
╟────┼────┼────┼────┼────┼────┼────┼────╢
║ │ │ │ │ │ │ 02 │ ║
╟────┼────┼────┼────┼────┼────┼────┼────╢
║ 00 │ │ │ │ │ │ │ ║
╚════╧════╧════╧════╧════╧════╧════╧════╝
~~~ | [] |
https://avatars.githubusercontent.com/u/6756180?v=4 | kassane.github.io | kassane/kassane.github.io | 2025-01-19T19:25:53Z | Personal website | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/kassane/kassane.github.io/tags | - | [
"static-site",
"zig",
"zine-ssg"
] | 26 | false | 2025-01-20T18:37:54Z | true | true | 0.13.0 | github | [
{
"commit": "7feb9e2389f015f56fc86cc90ab581b9ba3a21c6",
"name": "zine",
"tar_url": "https://github.com/kristoff-it/zine/archive/7feb9e2389f015f56fc86cc90ab581b9ba3a21c6.tar.gz",
"type": "remote",
"url": "https://github.com/kristoff-it/zine"
}
] | kassane.github.io | [] |
https://avatars.githubusercontent.com/u/11700503?v=4 | underfire | braheezy/underfire | 2025-01-14T07:24:40Z | 🔥🔥🔥 your desktop never stood a chance | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/braheezy/underfire/tags | - | [
"doom-fire-effect",
"go",
"zig"
] | 66,523 | false | 2025-05-16T04:46:39Z | false | false | unknown | github | [] | underfire
Put your desktop on fire and overheat your computer, all at the same time!
https://github.com/user-attachments/assets/d6a745b2-11c3-4a3e-8666-4b2ab4058cf5
<em>Your CPU cycles are not important</em>
Install
I did it twice, choose one.
The Zig is faster I think and produces a smaller binary, probably cause it uses shared libraries.
Go
Clone the repo and run with <code>go</code>:
<code>git clone https://github.com/braheezy/underfire
cd underfire/go
go run main.go
</code>
To exit, click/focus the fire and press <code>Esc</code>.
Zig
Clone the repo and run with <code>zig</code>:
<code>git clone https://github.com/braheezy/underfire
cd underfire/zig
zig build run
</code>
| [] |
https://avatars.githubusercontent.com/u/96076981?v=4 | ZigConway | JohanRimez/ZigConway | 2024-09-12T08:10:28Z | Graphic demonstration featuring ZIG & SDL2 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/JohanRimez/ZigConway/tags | MIT | [
"sdl2",
"sdl2-ttf",
"zig"
] | 12 | false | 2024-09-18T11:33:28Z | true | true | 0.13.0 | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/96076981?v=4 | ZigFlowers | JohanRimez/ZigFlowers | 2024-08-20T13:23:35Z | Graphic demonstration featuring ZIG & SDL2 | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/JohanRimez/ZigFlowers/tags | MIT | [
"sdl2",
"zig"
] | 13 | false | 2024-09-18T11:33:40Z | true | true | 0.13.0 | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/90490253?v=4 | ziglings | aroramrinaal/ziglings | 2024-10-04T06:46:50Z | Learn the ⚡Zig programming language by fixing tiny broken programs. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/aroramrinaal/ziglings/tags | - | [
"zig",
"ziglings"
] | 14,281 | false | 2024-10-16T18:35:37Z | true | true | unknown | github | [] | [] | |
https://avatars.githubusercontent.com/u/179981696?v=4 | zigstone-grpc | ziglana/zigstone-grpc | 2024-10-24T23:00:25Z | ⚡️blazigly fast⚡️ gayser zig Dragon's Mouth service (zig rewrite WIP) | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/ziglana/zigstone-grpc/tags | AGPL-3.0 | [
"blazigly",
"geyser",
"zig",
"ziglana"
] | 2,227 | true | 2024-10-25T00:21:23Z | false | false | unknown | github | [] | Yellowstone Dragon's Mouth - a Geyser based gRPC interface for Solana
This repo contains a fully functional gRPC interface for Solana. It is built around Solana's Geyser interface. In this repo we have the plugin as well as sample clients for multiple languages.
It provides the ability to get slots, blocks, transactions, and account update notifications over a standardised path.
For additional documentation, please see: https://docs.triton.one/rpc-pool/grpc-subscriptions
Known bugs
Block reconstruction inside gRPC plugin based on information provided by BlockMeta, unfortunately number of entries for blocks generated on validators always equal to zero. These blocks always will have zero entries. See issue on GitHub: https://github.com/solana-labs/solana/issues/33823
Validator
<code>bash
$ solana-validator --geyser-plugin-config yellowstone-grpc-geyser/config.json</code>
Plugin config check
<code>cargo-fmt && cargo run --bin config-check -- --config yellowstone-grpc-geyser/config.json</code>
Block reconstruction
Geyser interface on block update do not provide detailed information about transactions and accounts updates. To provide this information with block message we need to collect all messages and expect specified order. By default if we failed to reconstruct full block we log error message and increase <code>invalid_full_blocks_total</code> counter in prometheus metrics. If you want to panic on invalid reconstruction you can change option <code>block_fail_action</code> in config to <code>panic</code> (default value is <code>log</code>).
Filters for streamed data
Please check <a>yellowstone-grpc-proto/proto/geyser.proto</a> for details.
<ul>
<li><code>commitment</code> — commitment level: <code>processed</code> / <code>confirmed</code> / <code>finalized</code></li>
<li><code>accounts_data_slice</code> — array of objects <code>{ offset: uint64, length: uint64 }</code>, allow to receive only required data from accounts</li>
<li><code>ping</code> — optional boolean field. Some cloud providers (like Cloudflare, Fly.io) close the stream if client doesn't send anything during some time. As workaroud you can send same filter every N seconds, but this would be not optimal since you need to keep this filter. Instead, you can send subscribe request with <code>ping</code> field set to <code>true</code> and ignore rest of the fields in the request. Since we sent <code>Ping</code> message every 15s from the server, you can send subscribe request with <code>ping</code> as reply and receive <code>Pong</code> message.</li>
</ul>
Slots
<ul>
<li><code>filter_by_commitment</code> — by default slots sent for all commitment levels, but with this filter you can receive only selected commitment level</li>
</ul>
Account
Accounts can be filtered by:
<ul>
<li><code>account</code> — acount Pubkey, match to any Pubkey from the array</li>
<li><code>owner</code> — account owner Pubkey, match to any Pubkey from the array</li>
<li><code>filters</code> — same as <code>getProgramAccounts</code> filters, array of <code>dataSize</code> or <code>Memcmp</code> (bytes, base58, base64 are supported)</li>
</ul>
If all fields are empty then all accounts are broadcasted. Otherwise fields works as logical <code>AND</code> and values in arrays as logical <code>OR</code> (except values in <code>filters</code> that works as logical <code>AND</code>).
Transactions
<ul>
<li><code>vote</code> — enable/disable broadcast <code>vote</code> transactions</li>
<li><code>failed</code> — enable/disable broadcast <code>failed</code> transactions</li>
<li><code>signature</code> — match only specified transaction</li>
<li><code>account_include</code> — filter transactions that use any account from the list</li>
<li><code>account_exclude</code> — opposite to <code>account_include</code></li>
<li><code>account_required</code> — require all accounts from the list to be used in transaction</li>
</ul>
If all fields are empty then all transactions are broadcasted. Otherwise fields works as logical <code>AND</code> and values in arrays as logical <code>OR</code>.
Entries
Currently we do not have filters for the entries, all entries broadcasted.
Blocks
<ul>
<li><code>account_include</code> — filter transactions and accounts that use any account from the list</li>
<li><code>include_transactions</code> — include all transactions</li>
<li><code>include_accounts</code> — include all accounts updates</li>
<li><code>include_entries</code> — include all entries</li>
</ul>
Blocks meta
Same as <code>Blocks</code> but without <code>transactions</code>, <code>accounts</code> and entries. Currently we do not have filters for block meta, all messages are broadcasted.
Limit filters
It's possible to add limits for filters in the config. If <code>filters</code> field is omitted then filters doesn't have any limits.
<code>json
"grpc": {
"filters": {
"accounts": {
"max": 1,
"any": false,
"account_max": 10,
"account_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"owner_max": 10,
"owner_reject": ["11111111111111111111111111111111"]
},
"slots": {
"max": 1
},
"transactions": {
"max": 1,
"any": false,
"account_include_max": 10,
"account_include_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"account_exclude_max": 10,
"account_required_max": 10
},
"blocks": {
"max": 1,
"account_include_max": 10,
"account_include_any": false,
"account_include_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"include_transactions": true,
"include_accounts" : false,
"include_entries" : false
},
"blocks_meta": {
"max": 1
},
"entry": {
"max": 1
}
}
}</code>
Unary gRPC methods
Ping
GetLatestBlockhash
GetBlockHeight
GetSlot
IsBlockhashValid
GetVersion
Examples
<ul>
<li><a>Go</a></li>
<li><a>Rust</a></li>
<li><a>TypeScript</a></li>
</ul>
<strong>NOTE</strong>: Some load balancers will terminate gRPC connections if there are no messages sent from the client for a period of time.
In order to mitigate this you need to send a message periodically. The <code>ping</code> field in the SubscribeRequest is used for this purpose.
The gRPC server already sends pings to the client, so you can simply reply with a ping and your connection will remain open.
You can see in the rust example how to reply to the ping from the server with the client.
Projects based on Geyser gRPC
<ul>
<li>https://github.com/rpcpool/yellowstone-grpc-kafka — forward gRPC stream to Kafka, dedup, read stream from Kafka with gRPC server</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/124390044?v=4 | zig-regex-parser | sweiglbosker/zig-regex-parser | 2025-01-06T18:04:19Z | regex parser coded live on twitch | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/sweiglbosker/zig-regex-parser/tags | ISC | [
"parser",
"parsing",
"zig"
] | 12 | false | 2025-03-14T00:54:40Z | true | true | unknown | github | [] | toy regex parser written live on <a>twitch</a>
<ol>
<li><a>vod 1</a>: quickstart</li>
<li><a>vod 2</a>: writing the code</li>
<li><a>vod 3</a>: fixing errors</li>
</ol> | [] |
https://avatars.githubusercontent.com/u/2828351?v=4 | Amosis | bcrist/Amosis | 2024-08-17T06:34:23Z | 40% Keywell Keyboard | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/bcrist/Amosis/tags | MIT | [
"keyboard",
"zig"
] | 808 | false | 2024-08-27T04:53:42Z | true | true | 0.13.0 | github | [
{
"commit": "756c52e3bc64a120d192fb826c5557436ecf5dc3",
"name": "microbe",
"tar_url": "https://github.com/bcrist/microbe/archive/756c52e3bc64a120d192fb826c5557436ecf5dc3.tar.gz",
"type": "remote",
"url": "https://github.com/bcrist/microbe"
},
{
"commit": "54fc547bdbf3c04fdd497793a936dd6d... | Amosis Keyboard
The Amosis is a 40% split keywell board with a Cirque trackpad built into each side. The case is 3D printed, and features a keywell shape similar to Kinesis or Dactyl keyboards, except with only three rows.
Controller
This keyboard uses custom controller firmware written from scratch in Zig, and running on an RP2040.
It does not have runtime-swappable layouts or configuration. Instead, the keyboard layout, layer switching logic, mouse sensitivity, etc. is baked into the firmware, but updating the firmware is just a matter of holding the BOOT button while pressing the RESET button, then dragging a UF2 file to the RPI USB drive.
All of interesting configuration/layout stuff is handed in the <a>logic.zig</a> file. It should be relatively easy to customize the layout, though if you want to make behavioral changes, you will likely need to know some Zig.
The default layout is based on <a>Hands Down Gold</a>. The exact details can be found <a>here</a>.
It would probably be possible to use something like QMK with Amosis controllers, but please don't ask me to help with that; I have no interest and little experience with QMK, ZMK, etc.
Trackpad
Each side of the keyboard integrates a 40mm Cirque GlidePoint trackpad from a Steam Controller. While Valve stopped producing Steam Controllers years ago, you can still purchase the trackpads from <a>Mouser</a>, but you will likely need to make some modifications to make this work:
<ul>
<li>There are several sizes available; the Steam Controller uses the largest 40mm size (TM40040), but you could use a smaller one if you adjust the case design.</li>
<li>The retail Circues offer several options for plastic overlays, but the Steam Controller used custom overlays, so you may need to adjust the case design for your chosen overlay style.</li>
<li>There are (or were) both SPI and I2C versions available. The Steam Controller only uses SPI, so you'll need to adjust the firmware if you want to use an I2C version (though I think you can change it just by adding/removing a resistor on the Cirque board). The SPI versions have part numbers TMxx0xx-2024 while the I2C versions have part numbers TMxx0xx-2023. At time of writing, it appears Mouser no longer carries the I2C version.</li>
<li>The Steam Controller uses a customized connector pinout that's different than what's documented in the datasheet for the retail version. You'll need to adjust the schematic board layout to accomodate this.</li>
<li>An <a>Alps Haptic Reactor</a> force-feedback element is glued to the back of the Steam Controller version and its power is routed through the same FFC cable. If you buy this separately, you'll have to figure out how you want to connect it to the board.</li>
</ul>
Building
Have the controller boards manufactured using the files in the <code>kicad/gerbers/left/</code> and <code>kicad/gerbers/right</code> folders.
Ensure dependencies are available on your path:
* <a>Zig</a>
* <a>OpenSCAD</a> (2023.03.18 or newer; scroll down to "Development Snapshots")
Adjust the keymapping and layer logic as you like, then run <code>zig build</code>.
3D print a case using <code>zig-out/bin/left.stl</code> and <code>zig-out/bin/right.stl</code>.
Flash the <code>zig-out/bin/firmware.uf2</code> and to both controllers (the same file can be used for both sides because the firmware will detect which side it is at boot).
Wiring
The 3 row signals are driven to 3.3V when scanning a row, and 0V when not scanning that row.
The 7 column signals are read as inputs with weak pull-downs, and treat a high value as indicating that a switch is pressed.
Therefore, there are 2 possible ways to wire the diode/switch matrix that will work:
* Diodes between the row signals and the switches, with a common anode for each row.
* Diodes between the column signals and the switches, with a common cathode for each column.
Note the line on diode packages indicates the cathode side.
Also note while the schematics list a schottky diode part number, any general purpose diodes will work fine for the matrix, e.g. 1N914/1N4148, 1N4001, etc. | [] |
https://avatars.githubusercontent.com/u/147030074?v=4 | example-zig | noprd/example-zig | 2024-08-23T10:20:51Z | A hello world example project in zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/noprd/example-zig/tags | - | [
"hello-world",
"zig"
] | 29 | false | 2024-08-23T15:22:37Z | false | false | unknown | github | [] | <a></a>
<a></a>
<a></a>
<a></a>
<a></a>
Example Zig
This repository provides a simple Hello-World example for the <a>zig</a> language,
which in recent times has become quite a hot option
as a simpler alternative to Rust and C++.
Installation of Zig
<ul>
<li>
Unpack an appropriate distribution from <a>https://ziglang.org/download</a> to an appropriate location on your machine.
</li>
<li>
Add the directory in which the zig-binary lies to your system <code>PATH</code>:
<code>bash
touch ${HOME}/.bash_profile # ensures this exists
echo "# path for zig" >> ${HOME}/.bash_profile
echo "export PATH=\"/path/to/your zig binaries:\${PATH}\";" >> ${HOME}/.bash_profile</code>
for linux.
Or edit the file directly, adding the lines
```bash
...
path for zig
export PATH="/path/to/your zig binaries:${PATH}";
```
For windows, do this via the system environment variables (which requires admin access);
or just install <a>bash for windows</a>
and simply perform the above.
</li>
<li>
Clone the <strong>ZLS</strong> (<em>zig langauge server</em>) repository <a>https://github.com/zigtools/zls</a> and run
<code>bash
zig build</code>
</li>
</ul>
This will generate a folder <strong>zig-out/bin</strong>.
Copy just the binary from here to the same path where your zig-compiler binary is stored.
(Otherwise choose your own location and add this to <code>PATH</code>.)
Intellisense
If you are using VSCode, install the <a>Zig Language</a> extension.
For this to work, it needs to detect your <strong>ZLS</strong> binary.
Open the <em>User Settings JSON</em> (e.g. via command palette)
and add the following attributes to the dictionary:
<code>js
{
...
// NOTE: remove the .exe extension for windows
"zig.path": "/path/to/your zig binaries/zig.exe",
"zig.zls.zigLibPath": "/path/to/your zig binaries/lib",
"zig.zls.path": "/path/to/your ZLS binaries/zls.exe",
// optional
"zig.zls.buildOnSaveStep": "",
"zig.checkForUpdate": false,
"zig.zls.checkForUpdate": false,
}</code>
Build and run
Install the <a>justfile</a> tool.
Run
<code>bash
just setup # only needed once - then adjust the created .env file
just build # compiles the binary
just run {args} # runs without the compiled binary
just run-exe {args} # runs the compiled binary</code>
NOTE: The hello-world example was taken from <a>https://zig-by-example.com/hello-world</a> | [] |
https://avatars.githubusercontent.com/u/51777148?v=4 | scratchapixel-code-zig | fautore/scratchapixel-code-zig | 2024-11-04T23:43:48Z | WIP Unofficial Scratchapixel website's code repo ported to the Zig programming language. | main | 1 | 0 | 0 | 0 | https://api.github.com/repos/fautore/scratchapixel-code-zig/tags | - | [
"graphics-programming",
"scratchapixel",
"zig",
"zig-build",
"ziglang"
] | 44,387 | false | 2024-11-21T19:02:07Z | false | false | unknown | github | [] | ⚡⚡ scratchaplixel-code-zig ⚡⚡
Unofficial <a>Scratchapixel</a> website's <a>code repo</a> ported to the <a>Zig programming language</a>.
<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>
I am in no way affiliated to <a>scratchapixel.com</a> and this repository's primary function is to learn graphics programming and the Zig programming language.
</blockquote>
Status
Please refer to https://github.com/fautore/scratchapixel-code-zig/issues/1 for the status of the various ports
Project structure
This repo is divided in three directories:
- original, for the original code, untouched
- zig-build-system, for the cpp code but with the zig build system
- zig, for the zig ports | [] |
https://avatars.githubusercontent.com/u/30575805?v=4 | zig-rest-api | Ashu11-A/zig-rest-api | 2024-11-22T18:50:21Z | Basic implementation of a rest api with zig endpoints | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/Ashu11-A/zig-rest-api/tags | AGPL-3.0 | [
"basic-api",
"rest",
"rest-api",
"zap",
"zig"
] | 23 | false | 2024-11-24T06:55:34Z | true | true | unknown | github | [
{
"commit": "master",
"name": "zap",
"tar_url": "https://github.com/zigzap/zap/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/zigzap/zap"
}
] |
# Zig REST API





## 📃 | Descrição
Este repositório contém uma API REST simples desenvolvida utilizando a linguagem **Zig**. A API tem como objetivo demonstrar o uso de Zig para criar um servidor HTTP básico com rotas e processamento de dados JSON. A API é projetada para ser eficiente e fácil de entender.
Funcionalidades:
- Criação de servidores HTTP.
- Manipulação de requisições e respostas JSON.
- Roteamento básico de endpoints.
Os endpoints são simples, mas demonstram a capacidade de Zig para criar servidores e manipular dados de maneira eficiente.
Gostou do projeto? Então, deixe uma 🌟 para ajudar no crescimento!
# Endpoints
<code>GET /</code>
<ul>
<li><strong>Resposta</strong>:</li>
<li><strong>Status</strong>: 200 OK</li>
<li><strong>Body</strong>: <code>{"hello": "World!"}</code></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/119787571?v=4 | numple | B1nus/numple | 2024-09-29T17:02:37Z | A simple number oriented programming language. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/B1nus/numple/tags | - | [
"basic-funcionality",
"concise",
"math",
"mathematics",
"programming-language",
"proof-of-concept",
"rudimentary",
"simple",
"zig"
] | 151 | false | 2024-10-10T21:56:14Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/4337696?v=4 | jolt | nikneym/jolt | 2025-01-01T19:42:12Z | [WIP] Asynchronous I/O for Zig ⚡ | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/nikneym/jolt/tags | - | [
"async",
"asynchronous",
"io",
"nonblocking",
"zig",
"ziglang"
] | 164 | false | 2025-03-03T11:46:20Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/21039159?v=4 | JZlog | johmaru/JZlog | 2024-11-28T16:22:49Z | No dependent Simple zig logging library | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/johmaru/JZlog/tags | - | [
"library",
"logging",
"zig",
"zig-package",
"ziglang"
] | 19 | false | 2024-12-24T12:31:11Z | true | true | unknown | github | [] | JZlog
No dependent Simple zig logging library
library v 0.0.3 on zig version 0.13.0
※Version 0.0.3 linux supported
how to install
<code>zig fetch --save https://github.com/johmaru/JZlog/archive/refs/tags/v0.0.3.zip</code>
edit build.zig
```zig
const jzlog_dep = b.dependency("JZlog", .{});
const jzlog_module = jzlog_dep.module("JZlog");
<code>//Under
//const exe = b.addExecutable(.{
// .name = "test_log",
// .root_source_file = b.path("src/main.zig"),
// .target = target,
// .optimize = optimize,
// });
exe.root_module.addImport("JZlog", jzlog_module);
</code>
```
main.zig
<code>zig
const jz_log = @import("JZlog");</code>
how to use
```zig
const JZlog = @import("JZlog");
<code>// all default
try JZlog.init(null,.{});
// If you want to choose time format (Y-M-D or Y-M-D-H-M-S), you can use LogTime enum types.
try logger.init(.y_m_d,.{});
// Include hsms
try logger.init(.Include_h_s_m_s,{});
// also you can chose any settings your like
try logger.init(null,.{ .min_level = logger.LogLevel.Warning });
// this is log write function
try JZlog.log("Hello!", JZlog.LogLevel.Info); // This library supports various LogLevel types
// this library have async function
try logger.asyncLog("async!!", logger.LogLevel.Info);
defer logger.shutdown();
</code>
``` | [] |
https://avatars.githubusercontent.com/u/5885545?v=4 | doczy | JacobCrabill/doczy | 2024-11-26T02:40:14Z | Doczy: Markdown Documentation Browser | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/JacobCrabill/doczy/tags | - | [
"zig",
"zig-package"
] | 59 | false | 2025-02-06T00:11:05Z | true | true | 0.13.0 | github | [
{
"commit": "ae70fa8119e9f8ef3d090a85552edb726040d7cd.tar.gz",
"name": "zigdown",
"tar_url": "https://github.com/jacobcrabill/zigdown/archive/ae70fa8119e9f8ef3d090a85552edb726040d7cd.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/jacobcrabill/zigdown"
}
] | Doczy: Markdown Documentation Browser
<blockquote>
Instantly view your Markdown docs in the browser!
</blockquote>
Looking for a better way to browse your Markdown docs quickly and easily without jumping through the
hoops of setting up <a>mdBook</a>,
<a>Sphinx</a>, or some other toolchain?
Use <strong>Doczy!</strong>
Navigate to the <a>test documentation index</a> for an example.
Powered by Zig
Usage Example
<code>bash
zig build -Doptimize=ReleaseSmall
./zig-out/bin/doczy -f README.md</code> | [] |
https://avatars.githubusercontent.com/u/61393936?v=4 | Zapped | Sudo-Ivan/Zapped | 2025-01-01T06:36:12Z | A secure and fast Zig-Zap web server with HTTPS, I2P, Tor. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Sudo-Ivan/Zapped/tags | MIT | [
"http",
"i2p",
"server",
"tor",
"web",
"zap",
"zig"
] | 404 | false | 2025-02-16T21:33:12Z | true | true | unknown | github | [
{
"commit": "master",
"name": "zap",
"tar_url": "https://github.com/zigzap/zap/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/zigzap/zap"
}
] | Zapped
A secure and fast <a>Zig Zap</a> web server with built-in privacy features.
<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>
Still early development and security testing, Use at your own risk.
</blockquote>
Zapped Features
<ul>
<li>🔥 Hot Reloading</li>
<li>🚀 Performance Optimized</li>
<li>🔒 Security Features</li>
<li>CORS protection</li>
<li>Rate limiting</li>
<li>CSRF protection</li>
<li>Security headers</li>
<li>IP blacklisting</li>
<li>🕶️ Privacy Features</li>
<li>Tor hidden services (.onion) (Onion-Location Header)</li>
<li>I2P network support (.i2p)</li>
<li>SAM bridge integration</li>
<li>Private networking</li>
<li>📦 Asset Optimization</li>
<li>Compression (Gzip/Brotli)</li>
<li>Cache control</li>
<li>MIME type handling</li>
<li>📊 Monitoring</li>
<li>Metrics endpoint</li>
<li>Memory stats</li>
<li>Request tracking</li>
<li>🐋 Containers</li>
<li>Docker</li>
<li>Podman</li>
<li>Rootless</li>
</ul>
Quick Start
<ol>
<li>Install dependencies:</li>
<li><a>Zig</a></li>
<li><a>Zap</a></li>
<li><a>Docker</a> or <a>Podman</a></li>
<li><a>Tor</a> (optional)</li>
<li>
<a>I2P</a> (optional)
</li>
<li>
Drop your website into the <code>public</code> directory.
</li>
<li>
Edit <code>zapped.json</code> to your liking.
</li>
<li>
Run the following commands:
</li>
</ol>
<blockquote>
Replace docker with podman to use Podman instead of Docker.
</blockquote>
<code>bash
make docker
make docker-run</code>
or with Tor:
<code>bash
make docker-privacy
make docker-run-privacy USE_I2P=false # change to true to use I2P</code>
<code>bash
git clone https://github.com/Sudo-Ivan/zapped.git
cd zapped</code>
Privacy Features
Tor Hidden Services
<ul>
<li>Automatic .onion address generation</li>
<li>Hidden service configuration</li>
<li>Onion-Location Header</li>
</ul>
I2P Integration
<ul>
<li>SAM bridge support</li>
<li>I2P network tunnels</li>
</ul>
Configuration
Edit <code>zapped.json</code> to customize:
- Server settings
- Security options
- Tor configuration
- I2P settings
- Compression settings
- Cache control
- CORS settings
- Rate limiting | [] |
https://avatars.githubusercontent.com/u/88252053?v=4 | zig-master-netbsd | hellium6/zig-master-netbsd | 2025-02-07T09:59:19Z | NetBSD pkgsrc collection to run Zig master (0.14.0 and up to 0.15.0-dev.77 tested) and ZLS when it's not in official repos | main | 3 | 0 | 0 | 0 | https://api.github.com/repos/hellium6/zig-master-netbsd/tags | - | [
"lsp",
"lsp-server",
"makefile",
"netbsd",
"netbsd-pkgsrc",
"packages",
"unix-like",
"zig",
"ziglang"
] | 663 | false | 2025-03-27T22:57:18Z | false | false | unknown | github | [] | Zig master for NetBSD
<code>pkgsrc</code> packages to run Zig master on NetBSD. Tested on NetBSD 10.1.
<blockquote>
/!\ WARNING: This repo deals with bleeding edge software that might affect the stability of your system.
Avoid using this repo if it is not absolutely necessary. This is meant for tinkerers. There is no guarantee of any kind that this will work perfectly. Using this repo might break your system or do unexpected things to packages collection. You have been warned. Keeping a backup is recommended before installing any package from sources. If you find any issues, please post an issue.
</blockquote>
If you are ok with slightly outdated versions, then the version available on the NetBSD official repos might be adequate for you and this repo might not be necessary.
However, if you know what you are doing, the choice is yours.
History
This was prepared at the beginning of February 2025 when LLVM 19.x was needed to build Zig 0.14.0 dev version (master) which was still not available in NetBSD 10.0 repos at that time. So I had to prepare these packages. I didn't even use different names for the packages. So official packages of zig and llvm family of packages would have to be uninstalled or replaced.
This has changed since then. Packages in this repo should be able to live with official packages without file conflicts.
This repo now uses packages with different names than NetBSD official repos. This allows packages of this repo to live with official <code>llvm</code>, <code>clang</code>, <code>lld</code> and <code>zig</code> packages. e.g. You can have Zig stable and Zig master on the same system now. This is good for testing code in both I suppose. If you want the old behavior, meaning keeping the original package names (which is discouraged), check the <code>v20250207</code> release or tag.
Packages here are named differently and installed in different directories. e.g. The package <code>lang/llvm19</code> installs files in <code>/usr/pkg/llvm19</code> and links executables to <code>/usr/pkg/bin</code> with LLVM version suffixed, like <code>llvm-config19</code>, <code>llvm-link19</code> etc. So <code>llvm-config</code> would be from <code>lang/llvm</code> and <code>llvm-config19</code> would be from <code>lang/llvm19</code> of this repo. This style is somewhat akin to <a>FreeBSD's <code>lang/llvm19</code> port</a>.
Check
In case you reached here check the following:
<ul>
<li>Run <code>pkgin se zig</code> to see if the Zig version you want (e.g. 0.15.0) is available in NetBSD official repos. If it is available then probably it is not necessary to use this repo at all.</li>
<li>If you want to skip building, you might <a>find releases</a> with binary packages which you can install in this order - llvm, lld, clang, zig-master - with something like: <code>doas pkg_add /path/to/some-package.tgz</code></li>
<li>If you want to build from source, follow the instructions below.</li>
<li>Building from source might require some hours or days (depending on your hardware) to finish as some packages have big codebases. Megabytes of sources producing gigabytes of outputs.</li>
<li><a>There are</a> WIP LLVM packages (<a>https://pkgsrc.se/wip/llvm</a>, <a>https://pkgsrc.se/wip/lld</a>, <a>https://pkgsrc.se/wip/clang</a>). I haven't tried them but I expect them to be better than mine. But the <code>zig-master</code> package in this repo doesn't use them. If you want to use them you might have to make some edits. e.g. Replacing <code>lang/llvm19</code> with <code>wip/llvm</code>, <code>devel/lld19</code> with <code>wip/lld</code> etc. And I'm not sure if you'd be able to have anything LLVM 18.x based on the system.</li>
</ul>
Usage
<ul>
<li><a>Populate <code>/usr/pkgsrc</code></a></li>
<li>Optionally <code>chown -R yournonrootusername:users /usr/pkgsrc</code> so that editing files is easier</li>
<li>Then:</li>
</ul>
```sh
cp -r pkgsrc/* /usr/pkgsrc/
cd /usr/pkgsrc/lang/llvm19
make install
cd /usr/pkgsrc/devel/lld19
make install
cd /usr/pkgsrc/lang/clang19
make install
cd /usr/pkgsrc/lang/zig-master
For 0.14.0 stable:
cd /usr/pkgsrc/lang/zig-0.14.0
update DISTNAME in Makefile according to download URL
read comment in the file for details
to get latest master or dev download:
ZIGF=$(curl -s https://ziglang.org/download/ | grep '-dev' | head -n1 | sed -ne 's|.<em>>(zig.</em>).tar.xz<\/a.*|\1|p')
put the fetched value in previous command as DISTNAME
sed -i -e "s/^DISTNAME=.*/DISTNAME= $ZIGF/" Makefile
or enter manually
sed -i -e 's/^DISTNAME=.*/DISTNAME= zig-0.15.0-dev.56+d0911786c/' Makefile
optionally change MASTER_SITES to use a mirror
sed -i -e 's/^MASTER_SITES=.*/MASTER_SITES= https:\/\/zig.linus.dev\/zig\//' Makefile
make makesum # update checksums according to new DISTNAME
make install
```
If it complains about some files not existing or not listed in PLIST etc. this usually takes care of it:
<code>sh
make print-PLIST > PLIST
make install-clean
make install</code>
If you already have the package installed, you might have to do <code>make update</code> or <code>make replace</code> instead of <code>make install</code> in above commands. <a>Check here</a> for more info on which one to use when.
Alternatively to generate package files but not install it, run this instead of <code>make install</code>:
<code>sh
make package # or make repackage</code>
You can keep a backup of the generated package files in <code>/usr/pkgsrc/packages/</code> so that you can install them on future clean installs of NetBSD without building them again saving you lots of time. To install from package file:
```sh
doas pkg_add /usr/pkgsrc/packages/All/package-filename-here.tgz
or
doas pkg_add /path/to/package-filename-here.tgz
```
Example output after install:
<code>sh
$ llvm-config19 --version
19.1.7
$ /usr/pkg/llvm19/bin/ld.lld --version
LLD 19.1.7 (compatible with GNU linkers)
$ clang++19 --version
clang version 19.1.7
Target: x86_64-unknown-netbsd10.0
Thread model: posix
InstalledDir: /usr/pkg/llvm19/bin
$ zig-master version
0.15.0-dev.77+aa8aa6625
$ pkg_info -a | grep ^zig
zig-master-0.15.0-dev.77+aa8aa6625 Programming language designed for robustness and clarity</code>
Example of working with both Zig and Zig master on the same system:
```sh
$ echo $SHELL
/usr/pkg/bin/bash
$ doas pkgin in zig
$ zig version
0.13.0
$ zig-master version
0.15.0-dev.77+aa8aa6625
For lang/zig-0.14.0 you'd have to run zig-0.14.0 or
if you've changed DISTNAME, type "zig" and press tab twice for hint.
Example:
$ zig-0.14.0-dev.3462 version
0.14.0-dev.3462+edabcf619
typing zig-master every time is boring, so...
$ alias zig=zig-master
above can be added in ~/.bashrc to do this automatically on startup
$ zig version
0.15.0-dev.77+aa8aa6625
$ cd <code>mktemp -d</code>
$ zig init
info: created build.zig
info: created build.zig.zon
info: created src/main.zig
info: created src/root.zig
info: see <code>zig build --help</code> for a menu of options
$ zig build
easy to undo...
$ unalias zig
$ zig version
0.13.0
```
Example of uninstalling a package:
```sh
$ pkg_info -a | grep ^zig
zig-master-0.15.0-dev.77+aa8aa6625 Programming language designed for robustness and clarity
For lang/zig-0.14.0 the output might be something like:
zig-isolated0140-0.14.0 Programming language designed for robustness and clarity (prefix isolated)
$ doas pkg_delete zig-master-0.15.0-dev.77+aa8aa6625
```
ZLS
If you want to use <a>Zig Language Server (ZLS)</a> for <a>text editor autocomplete and other features</a>, you'd preferably need the zls version matching your installed Zig version.
Multiple versions of zls can live in the same NetBSD system. e.g. You can keep <code>devel/zls</code> from official pkgsrc, <code>devel/zls-master</code> and <code>devel/zls-0.14.0</code> together. Just make sure to use the appropriate binary path in the configuration of the text editor.
Installation:
```sh
For zig-master you need devel/zls-master
$ cd /usr/pkgsrc/devel/zls-master
$ make makesum # update checksum according to latest master archive
$ make install
$ zls-master --version
0.15.0-dev
$ which zls-master
/usr/pkg/bin/zls-master
Use the above path in your text editor config to use this zls
For zig-0.14.0 (dev or stable) you need devel/zls-0.14.0
$ cd /usr/pkgsrc/devel/zls-0.14.0
$ make install
$ zls-0.14.0 --version
0.14.0
$ which zls-0.14.0
/usr/pkg/bin/zls-0.14.0
Use the above path in your text editor config to use this zls
```
Configuration example with vim:
```sh
$ doas pkgin in vim
$ vim --version | head -1
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Feb 27 2025 03:36:34)
install plugin
$ mkdir -p $HOME/.vim/pack/downloads/opt
$ cd $HOME/.vim/pack/downloads/opt
$ git clone https://github.com/yegappan/lsp
$ vim -u NONE -c "helptags $HOME/.vim/pack/downloads/opt/lsp/doc" -c q
$ echo 'packadd lsp' >> $HOME/.vimrc
```
Append below to <code>~/.vimrc</code> (don't forget to change <code>path</code> if needed):
```vim
" detect .zig files as zig code automatically
autocmd BufNewFile,BufRead *.zig set filetype=zig
" Zig language server
call LspAddServer([#{
\ name: 'zls',
\ filetype: ['zig'],
\ path: '/usr/pkg/bin/zls-master',
\ args: [],
\ }])
```
To test:
<code>sh
$ echo 'const std = @import("std")' >> test.zig
$ vim test.zig</code>
<ul>
<li>Optionally, type <code>:LspShowAllServers</code> and enter to show status. It should show something like:</li>
</ul>
```
Filetype Information
====================
Filetype: 'zig'
Server Name: 'zls'
Server Path: '/usr/pkg/bin/zls-master'
Status: Running
Buffer Information
Buffer: 'test.zig'
Server Path: '/usr/pkg/bin/zls-master'
```
<code>:q</code> to get back to buffer.
<ul>
<li>To test definitions <code>fi</code> to get cursor over <code>@import</code>, <code>:LspHover</code> to show definition and information about <code>@import</code>. <code><esc></code> to hide.</li>
<li>Buffer should show an <code>E></code> on the left gutter of the line because there is no <code>;</code> at the end of the line (intentionally left out). Type <code><shift>a;<esc></code> to fix it.</li>
<li>To try autocomplete suggestions, press <code>o</code> (lowercase letter O) to create new line, then try typing <code>std.d</code> and it should show options <code>debug</code> and <code>dwarf</code>. Press <code><down><enter></code> to select <code>debug</code>.</li>
<li>To save and exit <code>:wq<enter></code></li>
</ul>
If you want to use this on Geany instead, <a>there is a way</a>.
For other text editors, please refer to <a>this LSP clients list</a>.
License: Anything added by me in this repo (not what is based on another project) is public domain or CC0 1.0 Universal. For things taken from other projects, refer to those projects, such as <a>pkgsrc</a>. | [] |
https://avatars.githubusercontent.com/u/48999343?v=4 | camellia-zig | sorairolake/camellia-zig | 2024-12-16T23:35:15Z | Camellia block cipher written in pure Zig | develop | 0 | 0 | 1 | 0 | https://api.github.com/repos/sorairolake/camellia-zig/tags | Apache-2.0 | [
"block-cipher",
"camellia",
"cipher",
"cryptography",
"zig",
"zig-library",
"ziglang"
] | 640 | false | 2025-05-14T11:01:14Z | true | true | 0.14.0 | github | [] |
camellia-zig
<a></a>
<strong>camellia-zig</strong> is an implementation of the <a>Camellia</a> block cipher written in
pure <a>Zig</a>.
Usage
Add this package to your <code>build.zig.zon</code>:
<code>sh
zig fetch --save git+https://github.com/sorairolake/camellia-zig.git</code>
Add the following to your <code>build.zig</code>:
<code>zig
const camellia = b.dependency("camellia", .{});
exe.root_module.addImport("camellia", camellia.module("camellia"));</code>
Documentation
To build the documentation:
<code>sh
zig build doc</code>
The result is generated in <code>zig-out/doc/camellia</code>.
If you want to preview this, run a HTTP server locally. For example:
<code>sh
python -m http.server -d zig-out/doc/camellia</code>
Then open <code>http://localhost:8000/</code> in your browser.
Zig version
This library is compatible with Zig version 0.14.0.
Source code
The upstream repository is available at
<a>https://github.com/sorairolake/camellia-zig.git</a>.
Changelog
Please see <a>CHANGELOG.adoc</a>.
Contributing
Please see <a>CONTRIBUTING.adoc</a>.
License
Copyright (C) 2024 Shun Sakai (see <a>AUTHORS.adoc</a>)
This library is distributed under the terms of either the <em>Apache License 2.0</em>
or the <em>MIT License</em>.
This project is compliant with version 3.3 of the <a><em>REUSE Specification</em></a>. See
copyright notices of individual files for more details on copyright and
licensing information. | [] |
https://avatars.githubusercontent.com/u/67513038?v=4 | zig-snippets | YoungHaKim7/zig-snippets | 2024-11-24T06:05:26Z | zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/YoungHaKim7/zig-snippets/tags | - | [
"debugging",
"zig"
] | 24 | false | 2024-11-24T12:18:38Z | false | false | unknown | github | [] |
link
<ul>
<li>
<a>.gitignore</a>
</li>
<li>
<a>justfile(Debugging auto input (VSCode))</a>
</li>
</ul>
<ul>
<li>https://github.com/YoungHaKim7/zig_lang_exercises</li>
</ul>
gitignore<a>|🔝|</a>
```git
https://github.com/ziglang/zig/blob/master/.gitignore
.DS_Store
This file is for zig-specific build artifacts.
If you have OS-specific or editor-specific files to ignore,
such as *.swp or .DS_Store, put those in your global
~/.gitignore and put this in your ~/.gitconfig:
[core]
excludesfile = ~/.gitignore
Cheers!
-andrewrk
.zig-cache/
zig-out/
/release/
/debug/
/build/
/build-*/
/docgen_tmp/
```
justfile<a>|🔝|</a>
```justfile
Debugging(VSCode)
vscode:
rm -rf .vscode
mkdir -p .vscode
echo '{' > .vscode/launch.json
echo ' "version": "0.2.0",' >> .vscode/launch.json
echo ' "configurations": [' >> .vscode/launch.json
echo ' {' >> .vscode/launch.json
echo ' "type": "lldb",' >> .vscode/launch.json
echo ' "request": "launch",' >> .vscode/launch.json
echo ' "name": "Launch",' >> .vscode/launch.json
echo ' "program": "${workspaceFolder}/zig-out/bin/${workspaceFolderBasename}",' >> .vscode/launch.json
echo ' "args": [],' >> .vscode/launch.json
echo ' "cwd": "${workspaceFolder}",' >> .vscode/launch.json
echo ' }' >> .vscode/launch.json
echo ' ]' >> .vscode/launch.json
echo '}' >> .vscode/launch.json
echo '{' > .vscode/tasks.json
echo ' "version": "2.0.0",' >> .vscode/tasks.json
echo ' "tasks": [' >> .vscode/tasks.json
echo ' {' >> .vscode/tasks.json
echo ' "label": "build",' >> .vscode/tasks.json
echo ' "type": "shell",' >> .vscode/tasks.json
echo ' "command": "zig build",' >> .vscode/tasks.json
echo ' "group": "build",' >> .vscode/tasks.json
echo ' "problemMatcher: [' >> .vscode/tasks.json
echo ' " "$gcc"' >> .vscode/tasks.json
echo ' ]' >> .vscode/tasks.json
echo ' }' >> .vscode/tasks.json
echo ' ]' >> .vscode/tasks.json
echo '},' >> .vscode/tasks.json
```
| [] |
https://avatars.githubusercontent.com/u/40872910?v=4 | Boo | Wordluc/Boo | 2025-01-20T19:34:57Z | Stuff to learn SDL2 and Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/Wordluc/Boo/tags | - | [
"sdl2",
"snake",
"zig"
] | 4,954 | false | 2025-02-01T09:37:57Z | true | true | unknown | github | [
{
"commit": "refs",
"name": "SDL",
"tar_url": "https://github.com/allyourcodebase/SDL/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/allyourcodebase/SDL"
}
] | 404 | [] |
https://avatars.githubusercontent.com/u/68057?v=4 | zigltf | ousttrue/zigltf | 2024-09-22T01:05:56Z | zig gltf | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/ousttrue/zigltf/tags | MIT | [
"gltf",
"sokol",
"zig"
] | 239 | false | 2025-01-22T05:28:16Z | true | true | unknown | github | [
{
"commit": null,
"name": "zigltf",
"tar_url": null,
"type": "relative",
"url": "deps/zigltf"
},
{
"commit": null,
"name": "sokol_samples",
"tar_url": null,
"type": "relative",
"url": "deps/sokol_samples"
},
{
"commit": "149035fc555ba520b07f40fbad6a884ad09494a2",
... | zigltf
zig gltf library.
build
<code>zig-0.13.0</code>
```sh
<blockquote>
zig build -Dsokol run-minimal
```
</blockquote>
wasm build.
```sh
<blockquote>
zig build -Dsokol -Dtarget=wasm32-emscripten
```
</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> <a>minimal</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> <a>glb</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> node
<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> texture
<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> animation
<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> glTF
<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> draco
<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> basisu
- [WIP] vrm-0.x
<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> vrm-1.0 | [
"https://github.com/ousttrue/zigltf"
] |
https://avatars.githubusercontent.com/u/54745129?v=4 | caps2esc | krish-r/caps2esc | 2024-10-23T17:16:33Z | Remap `CAPS LOCK` to `ESC` in Linux systems. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/krish-r/caps2esc/tags | MIT | [
"zig"
] | 17 | false | 2025-04-27T09:57:15Z | true | true | 0.14.0 | github | [
{
"commit": "fe8c7599157e6c2530b60d32a1756549af502d53",
"name": "libevdev",
"tar_url": "https://github.com/krish-r/libevdev/archive/fe8c7599157e6c2530b60d32a1756549af502d53.tar.gz",
"type": "remote",
"url": "https://github.com/krish-r/libevdev"
}
] | caps2esc
Remap <code>CAPS LOCK</code> to <code>ESC</code> in Linux systems.
Overview
This is inspired by / based on <a>evremap</a> by <a>wez</a>.
Uses <a><code>libevdev</code></a> to grab exclusive access to the input device, reads input events, remaps <code>CAPS LOCK</code> to <code>ESC</code> and writes them back to a virtual output device.
Example Usage
List devices
<code>shell
sudo zig-out/bin/caps2esc --list-devices</code>
Remap key
<code>shell
sudo zig-out/bin/caps2esc --device 'device-name'</code>
Building from Source
Dependencies
<ul>
<li><a>Zig master</a></li>
</ul>
<code>shell
zig build -Doptimize=ReleaseSafe</code>
Adding service to <code>systemd</code>
<strong>Note</strong>: Update the path and device name in the example service file (<code>caps2esc.service</code>) and the below command.
<code>shell
sudo cp ~/example-path/caps2esc/caps2esc.service /usr/lib/systemd/system/
sudo systemctl enable caps2esc.service
sudo systemctl start caps2esc.service
systemctl status caps2esc.service</code>
Credits
<ul>
<li><a>evremap</a> by <a>@wez</a></li>
<li><a>Performance Optimizer Observation Platform</a> by <a>@andrewrk</a>.</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/151991041?v=4 | candie | yashtajne/candie | 2025-01-14T10:52:28Z | a simple c/c++ build tool | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/yashtajne/candie/tags | Apache-2.0 | [
"build-tool",
"c",
"cpp",
"zig"
] | 83 | false | 2025-03-21T13:57:42Z | false | false | unknown | github | [] | Candie.kit
A Simple C/C++ Build tool. which uses Zig as a drop-in compiler for compiling .c and .cpp files.
No Build system needed, Does not generate Makefiles.
List of contents
<ul>
<li><a>Installation</a></li>
<li><a>Getting started</a></li>
<li><a>Documentation</a></li>
</ul>
Installation
Candie.kit is is available on <a>PyPI</a> so it can be installed with this command.
<code>sh
pip install candie.kit</code>
candie CLI
After installation you can run this command to get help.
or verify that its successfully installed.
<code>candie --help</code>
Getting started
Every project must contain a Build Instruction file, Named <code>Candiefile</code> and this file should always be placed in the project root directory.
project/
├── main.c
├── greet.c
└── Candiefile
So create this file for your project.
The <code>Candiefile</code> file can contain sections of code.
A Section can be created like this [SECTION_NAME]
using square brackets,
section name must be UPPERCASE.
[SETUP] is a required section.
Example <strong>Candiefile</strong> 👇️
```py
[SETUP]
PROJ_NAME = 'your_project_name'
project(
name = PROJ_NAME,
language = C,
)
[BUILD]
executable(
PROJ_NAME,
'./main.c',
'./greet.c'
).create()
```
You can either provide the source file paths manually or use the <code>grab_sources()</code> function
and provide the directory path of the src files.
Call the <code>create()</code> method to create the executable, You can provide <code>.create(debug = True)</code> to add debugging symbols to the executable.
finally, run this command to execute the build section.
<code>sh
candie build</code>
This will create a executable named <code>'your_project_name'</code>
Here, Example project <a>simple-exe</a>
Documentation
<ul>
<li><a>SETUP section</a></li>
<li><a>Generators</a></li>
<li><a>InBuilt functions</a></li>
</ul>
License
This project is licensed under the <a>Apache 2.0 License</a>.
Made with 🧡 by Yash Tajne | [] |
https://avatars.githubusercontent.com/u/82689821?v=4 | aoc2024 | benjuh/aoc2024 | 2025-02-05T08:49:09Z | 2024 Advent of Code [Zig] | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/benjuh/aoc2024/tags | - | [
"advent-of-code-2024",
"adventofcode",
"algorithms",
"data-structures",
"zig",
"ziglang"
] | 200 | false | 2025-02-26T22:18:52Z | false | false | unknown | github | [] | <a>Advent of Code [2024]</a>
This is my first year ever doing AoC and I chose to do it in <a>Zig</a>
Overall I had a ton of fun and learned a lot about the language as well as new algorithms.
The language has some areas that are a bit confusing or unintuitive but for a language not even
at its 1.0 release it was very enjoyable. I would recommend zig!
Some Solutions Inspired By
- <a>p88h</a>
- <a>erikwastaken</a>
Todo
<ul>
<li>Day 6 takes around 30 seconds to run. Want to speed that up eventually.</li>
</ul>
Resources:
<a>Ziggit AoC 2024</a> | [] |
https://avatars.githubusercontent.com/u/117574639?v=4 | todo | nidexingg/todo | 2024-10-13T10:56:16Z | To-Do List application implemented in various programming languages. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/nidexingg/todo/tags | MIT | [
"c",
"cpp",
"csharp",
"elixir",
"erlang",
"golang",
"java",
"javascript",
"js",
"programming-language",
"python",
"rust",
"starter",
"todo",
"todoapp",
"todolist",
"ts",
"typescript",
"zig"
] | 19 | false | 2024-12-05T09:32:17Z | false | false | unknown | github | [] | Nidexingg To-Do
Welcome to the To-Do List Application repository! This project showcases a simple yet effective To-Do List application implemented in various programming languages. The goal of this project is to demonstrate how similar functionality can be achieved using different programming paradigms and features offered by each language.
Various of Programming Languages Used
This repository contains implementations of the To-Do List application in the following programming languages:
<ul>
<li><strong>C</strong>: High performance and low-level control make it suitable for system-level programming.</li>
<li><strong>C++</strong>: Combines object-oriented features with performance, ideal for complex applications.</li>
<li><strong>C#</strong>: Rich framework support and cross-platform capabilities through .NET enhance development speed.</li>
<li><strong>Rust</strong>: Offers memory safety and concurrency without sacrificing performance.</li>
<li><strong>Go</strong>: Simple syntax with built-in support for concurrency, making it great for scalable applications.</li>
<li><strong>Java</strong>: Platform-independent with a robust ecosystem of libraries and frameworks.</li>
<li><strong>Python</strong>: Easy to learn with extensive libraries, perfect for rapid application development.</li>
<li><strong>JavaScript</strong>: Essential for web development, enabling dynamic user interfaces and asynchronous programming.</li>
<li><strong>TypeScript</strong>: Adds static typing to JavaScript, improving code quality and developer productivity.</li>
<li><strong>Zig</strong>: Low-level control with safety features, allowing for optimized performance at compile time.</li>
<li><strong>Elixir</strong>: Excellent concurrency support and fault tolerance, ideal for real-time applications.</li>
<li><strong>Erlang</strong>: Designed for distributed systems with high availability and fault tolerance.</li>
</ul>
Each implementation includes core features such as:
[x] Adding tasks
[x] Viewing tasks
[x] Removing tasks
[x] Clearing all tasks
[x] Persistent storage as txt files
Features
<ul>
<li><strong>Cross-Language Comparison</strong>: Explore how different programming languages handle similar tasks.</li>
<li><strong>File I/O</strong>: Each implementation demonstrates how to read from and write to files for task persistence.</li>
<li><strong>User Interaction</strong>: All lang versions provide a user-friendly command-line interface for user interaction.</li>
</ul>
Getting Started
To run any of the applications, follow these steps:
1. Clone this repository
<code>bash
git clone https://github.com/nidexingg/todo.git</code>
2. Open your favorite language directory and run the application
C
cd C
and run this command:
gcc app.c -o app && ./app
C++
cd C++
and run this command:
g++ app.cpp -o app
C
cd CSharp
and run this command:
dotnet run app.cs
Rust
cd Rust
and run this command:
cargo run --bin app
Go
cd Go
and run this command:
go run app.go
Java
cd Java
and run this command:
javac app.java && java app
Python
cd Python
and run this command:
python app.py
JavaScript
cd JavaScript
and run this command:
node app.js
TypeScript
cd TypeScript
and run this command:
tsc app.ts && node app.js
Zig
cd Zig
and run this command:
zig build-exe app.zig && ./app
Elixir
cd Elixir
and run this command:
elixir app.exs
Erlang
cd Erlang
and run this command:
erl -s app start -noshell -s init stop | [] |
https://avatars.githubusercontent.com/u/48649516?v=4 | Voxel | waaverecords/Voxel | 2024-08-09T19:29:15Z | Ray traced voxel engine. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/waaverecords/Voxel/tags | - | [
"opengl",
"ray-tracing",
"voxel-engine",
"zig"
] | 276 | false | 2025-01-29T14:11:15Z | true | true | 0.13.0 | github | [
{
"commit": "master",
"name": "zigglgen",
"tar_url": "https://github.com/castholm/zigglgen/releases/download/v0.2.3/zigglgen.tar.gz/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/castholm/zigglgen/releases/download/v0.2.3/zigglgen.tar.gz"
}
] | 404 | [] |
https://avatars.githubusercontent.com/u/38505104?v=4 | ztoml | strvdr/ztoml | 2025-01-27T04:38:56Z | A bad toml parser written in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/strvdr/ztoml/tags | - | [
"toml-parser",
"toml-parsing",
"zig",
"ziglang"
] | 13 | false | 2025-01-29T13:40:08Z | true | false | unknown | github | [] | ztoml
It's bad right now, so don't use it if you can avoid it in any way possible. You will have to modify a bunch of things :)
Usage:
Move your toml file into the ztoml folder and from the project root:
<code>zig build
./zig-out/bin/ztoml yourfile.toml</code>
but don't use it | [] |
https://avatars.githubusercontent.com/u/290647?v=4 | zzbox | mark-rushakoff/zzbox | 2024-11-06T04:32:56Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/mark-rushakoff/zzbox/tags | MIT | [
"unix",
"zig"
] | 7 | false | 2024-11-06T04:34:00Z | true | true | unknown | github | [] | zzbox
zzbox is intended to be a core collection of Unix utilities that pedantically follow
<a>POSIX.1-2024</a>.
What do we mean by pedantic?
For one example, check the
<a>Exit Status section of the specification for <code>false</code></a>:
<blockquote>
The false utility shall always exit with a value between 1 and 125, inclusive.
</blockquote>
Most implementations of <code>false</code> will always exit 1.
<code>zzbox</code>'s false interprets the specification literally,
and it returns a random value in that range.
How do I use it?
Build it from source for now (<code>zig build</code> with the current <code>master</code> branch of Zig).
Use it like <a>BusyBox</a>
or <a>toybox</a>:
if the basename matches a supported utility,
it is as though you executed that utility directly.
That is, if the <code>zzbox</code> binary is <code>/bin/cat</code>
or if <code>/bin/cat</code> is a symlink to the <code>zzbox</code> binary,
then the executable acts like <code>cat</code>.
Otherwise, the first positional argument is treated as the name of the utility to execute.
Why?
<ol>
<li>I have, for a long time, thought it would be interesting to write several Unix utilities from scratch.</li>
<li>This looked like a good excuse to try out <a>Zig</a>.</li>
</ol>
Status
| Command | Status | Notes |
|---------|----------|-------------------------|
| cat | Partial | No argument support yet |
| true | Complete | |
| false | Complete | | | [] |
https://avatars.githubusercontent.com/u/4637356?v=4 | ZiPID | CreoOne/ZiPID | 2024-12-17T20:08:46Z | PID controller in ZIG. Driven by discrete time series. Protected from integral part run-out and overflow. Tested. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/CreoOne/ZiPID/tags | MIT | [
"pid",
"pid-controller",
"zig",
"ziglang"
] | 5 | false | 2025-01-02T13:11:06Z | false | false | unknown | github | [] | ZiPID
PID controller implementation in ZIG
<em>Supports integral clamping and overflow protection</em>
Usage
<code>zig
var pid: ziPID = .{ .proportional = 1.0, .integral = 0.1, .derivative = 1.0 };
const deviation = -0.4; // control value -4/10th measurement units away from target/setpoint
const delta = 16e-3; // ~60 times per time unit
const output = pid.advance(deviation, delta);</code>
Testing
Go to <a>sources/zipid.tests.zig</a> | [] |
https://avatars.githubusercontent.com/u/35458851?v=4 | aoc-2024-zig | BrandonHowe/aoc-2024-zig | 2024-11-25T15:31:15Z | My solutions for Advent of Code in 2024, written in Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/BrandonHowe/aoc-2024-zig/tags | MIT | [
"advent-of-code",
"zig"
] | 76 | false | 2024-12-25T11:33:35Z | true | true | unknown | github | [] | Advent Of Code Zig Template
This repo provides a template for Advent of Code participants using Zig. It contains a main file for each day, a build.zig file set up with targets for each day, and Visual Studio Code files for debugging.
This template has been tested with Zig <code>0.13.0</code> and <code>0.14.0-dev.2198+e5f5229fd</code>. It may not work with other versions.
How to use this template:
The src/ directory contains a main file for each day. Put your code there. The build command <code>zig build dayXX [target and mode options] -- [program args]</code> will build and run the specified day. You can also use <code>zig build install_dayXX [target and mode options]</code> to build the executable for a day and put it into <code>zig-out/bin</code> without executing it. By default this template does not link libc, but you can set <code>should_link_libc</code> to <code>true</code> in build.zig to change that. If you add new files with tests, add those files to the list of test files in test_all.zig. The command <code>zig build test</code> will run tests in all of these files. You can also use <code>zig build test_dayXX</code> to run tests in a specific day, or <code>zig build install_tests_dayXX</code> to create a debuggable test executable in <code>zig-out/bin</code>.
Each day contains a decl like this:
<code>zig
const data = @embedFile("data/day05.txt");</code>
To use this system, save your input for a day in the src/data/ directory with the appropriate name. Reference this decl to load the contents of that file as a compile time constant. If a day has no input, or you prefer not to embed it in this form, simply don't reference this decl. If <code>data</code> is unused, the compiler will not try to load the file, and it won't error if the file does not exist.
This repo also contains Visual Studio Code project files for debugging. These are meant to work with the C/C++ plugin. There is a debug configuration for each day. By default all days are built in debug mode, but this can be changed by editing <code>.vscode/tasks.json</code> if you have a need for speed.
If you would like to contribute project files for other development environments, please send a PR.
Modifying the template
You can modify the template to add your own changes across all days. To do so, modify template/template.zig and then run <code>zig build generate</code>. The <code>$</code> character in the template will be replaced by the two-digit day number (e.g. 04 or 17). This step will only overwrite files which have not been modified, so you will not lose work if you update the template after implementing several days. After updating the template and generating, you should commit the changes to template/hashes.bin in addition to the updated template and source files. This will ensure that the newly generated files are not considered modified if you update the template again.
Setting up ZLS
Zig has a reasonably robust language server, which can provide autocomplete for VSCode and many other editors. It can help significantly with exploring the std lib and suggesting parameter completions. The VSCode extension (augusterame.zls-vscode) will automatically install the language server in the background. If you are using a different editor, follow their <a>install instructions</a>. If you want to install a specific version of the language server (for example for maximum compatibility with 0.10.0), <a>check their releases page</a> or <a>follow their instructions to build from source</a>. Note that ZLS tracks master, so if you are using Zig 0.10.0 you may need to download a newer version to build ZLS. | [] |
https://avatars.githubusercontent.com/u/177735651?v=4 | learning-zig-ukr | sonicfromnewyoke/learning-zig-ukr | 2024-08-17T10:24:54Z | Ukrainian translation of "Learning Zig" blog series by Karl Seguin | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/sonicfromnewyoke/learning-zig-ukr/tags | CC-BY-SA-4.0 | [
"learning",
"ukrainian",
"zig",
"zine"
] | 1,208 | false | 2025-04-27T11:24:53Z | true | true | unknown | github | [
{
"commit": "7feb9e2389f015f56fc86cc90ab581b9ba3a21c6",
"name": "zine",
"tar_url": "https://github.com/kristoff-it/zine/archive/7feb9e2389f015f56fc86cc90ab581b9ba3a21c6.tar.gz",
"type": "remote",
"url": "https://github.com/kristoff-it/zine"
}
] | Вивчаємо Zig
Цей репозиторій містить файли перекладу книги "Вивчаємо Zig", написаної <a>Карлом Сегуїном</a>
<blockquote>
This repository contains the translation files of the book "Learning Zig" written by Karl Seguin
</blockquote>
Оригінальна версія
Серія публікацій «Learning Zig» спочатку була створена Карлом Сегіном і представлена в його особистому блозі.
Ці видання відрізняються унікальним дидактичним підходом, є цінним джерелом знань як для початківців, які роблять перші кроки в Zig, так і для тих, хто хоче закріпити фундаментальні поняття, якими користуються щодня. Якість контенту, запропонованого автором, не тільки дозволяє послідовне читання для повного розуміння, але й дозволяє використовувати його як практичний довідник під час заглиблення в більш глибокі знання.
Нижче наведено деякі інші відомі публікації автора:
<ul>
<li><a>The Little Go Book</a></li>
<li><a>The Little Redis Book</a></li>
<li><a>The Little MongoDB Book</a></li>
</ul>
Внесок
Переклад, виконаний у цій роботі, повністю безкоштовний. Тому, якщо ви помітили будь-які орфографічні помилки, незрозумілі пояснення чи погано перекладені концепції програмування, я запрошую вас зробити свій внесок, написавши PR і допоможіть нам покращити цей переклад матеріалу Zig українською мовою.
Головною метою цього перекладу є надання високоякісного вмісту українською мовою для спільноти Zig і, перш за все, допомога тим, хто починає у величезному світі програмування (переважно на системному рівні).
Ліцензія
<a>CC-BY-SA-4.0</a> | [] |
https://avatars.githubusercontent.com/u/111590258?v=4 | rufus | mubashir1osmani/rufus | 2025-01-31T04:56:08Z | custom operating system for an embedded systems device | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/mubashir1osmani/rufus/tags | MIT | [
"embedded-systems",
"ipodtouch",
"systems-programming",
"zig"
] | 6,917 | false | 2025-05-12T05:14:04Z | true | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/179981696?v=4 | zolt | ziglana/zolt | 2024-10-29T02:26:51Z | Zigged[WIP] High-performance, Composable framework for Fully On Chain Games and Autonomous Worlds | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/ziglana/zolt/tags | MIT | [
"bolt",
"ecs",
"gamedev",
"solana",
"uwu",
"zig",
"ziglana",
"zolt"
] | 7,688 | true | 2024-10-29T03:05:16Z | false | false | unknown | github | [] |
Bolt
<strong>A high-performance and composable SVM-based framework for Fully On-chain games and Autonomous Worlds. </strong>
<a></a>
<a></a>
<a></a>
<a></a>
Bolt is a high-performance, scalable SVM-based framework designed for Fully On Chain (FOC) Games and Autonomous Worlds.
With Bolt, you can create games that live forever on the blockchain. These games are platform-centric by default, empowering users to extend and modify both game content and logic. The framework incorporates an Entity Component System (ECS) architecture, streamlining the game structuring and assembly process and providing ready-to-use components. Developers can reuse and contribute modules and logic deployed on the blockchain.
Packages
| Package | Description | Version | Docs |
|:----------------------------|:---------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------|
| <code>bolt-lang</code> | Rust primitives for creating components, systems and writing programs on Solana | <a></a> | <a></a> |
| <code>@magicblock-labs/bolt-sdk</code> | TypeScript client for Anchor programs | <a></a> | <a></a> |
| <code>@magicblock-labs/bolt-cli</code> | CLI to support building and managing a Bolt workspace | <a></a> | <a></a> |
⚡️ Installing the bolt-cli
<code>bash
npm install -g @magicblock-labs/bolt-cli</code>
🔩️ Getting Started
Create a project with the bolt-cli:
<code>bash
bolt init new-project</code>
Run the tests for the generated example project:
<code>bash
cd new-project
bolt test</code>
📘 Bolt docs
Read the Bolt <a>docs</a>
🚧 Under construction
Bolt is in active development, so all APIs are subject to change.
This code is unaudited. Use at your own risk.
💚 Open Source
Open Source is at the heart of what we do at Magicblock. We believe building software in the open, with thriving communities, helps leave the world a little better than we found it.
✨ Contributors & Community
Thank you for your interest in contributing to Bolt!
Please see the <a>CONTRIBUTING.md</a> to learn how. | [] |
https://avatars.githubusercontent.com/u/157028493?v=4 | Programming-Language-Benchmark | YeonguChoe/Programming-Language-Benchmark | 2024-08-30T08:53:23Z | I conducted a benchmark on multiple programming languages. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/YeonguChoe/Programming-Language-Benchmark/tags | - | [
"c",
"cpp",
"csharp",
"go",
"java",
"kotlin",
"nodejs",
"python",
"rust",
"swift",
"zig"
] | 120 | false | 2024-10-22T21:23:30Z | true | false | unknown | github | [] | Programming Language Benchmark
<ul>
<li>Tester: Yeongu Choe</li>
<li>Enviroment</li>
</ul>
| Programming Language | Environment |
| -------------------- | ----------- |
| C | clang |
| C++ | clang++ |
| Java | openjdk |
| C# | dotnet |
| Go | go |
| Kotlin | kotlinc |
| Swift | swift |
| Rust | rustc |
| Zig | zig |
| Python | python3 |
| Node.js | node |
<ul>
<li>Algorithm used.</li>
<li>Time compleixty: $O({(n!)}^4)$</li>
</ul>
<code>python
def main(n):
for i in range(n):
for j in range(n):
for k in range(n):
for m in range(n):
factorial(n)</code>
Result
<ul>
<li>Runtime speed: C > C++ > Zig > Rust > Swift >> Kotlin > Java > C# > Go > Node.js >>> Python 3</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/193609885?v=4 | directed-graph | frej-dahlin/directed-graph | 2025-01-03T14:16:44Z | A generic directed graph structure for Zig with edge weight and node values. | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/frej-dahlin/directed-graph/tags | - | [
"graph",
"zig"
] | 23 | false | 2025-05-01T12:26:45Z | false | false | unknown | github | [] | Introduction
A generic directed graph structure for Zig.
It is intended for in-memory dynamic usage and supports O(1) node insertions, edge insertions, and edge removal; node removal is O(|E|) where
|E| is the number of edges from and to the node being removed. In addition graph reversal is O(|V|), where |V| is the number of vertices of the graph.
The main interface is provided as:
<code>zig
AutoDirectedGraph(N: type, V: type, W: type).init(allocator)</code>
where <code>N</code>, <code>V</code>, and <code>W</code> are the node, node value, and edge value types, respectively. <code>N</code> has to be automatically hashable (see below otherwise), for graphs of strings we have:
<code>zig
StringDirectedGraph(N: type, V: type, W: type).init(allocator)</code>
If more control is required, then just as Zig's standard library, one can provide a <code>HashContext</code> (see Zig's <code>HashMap</code>)
<code>zig
DirectedGraph(N: type, V: type, W: type, HashContext: type, comptime store_hash: bool).init(allocator)</code>
This structure uses the terminology <em>targets</em> and <em>sources</em> for the respective two types of neighbors of a node. A slice of all targets can be obtained
using <code>digraph.targets(node)</code> and similarly <code>digraph.sources(node)</code>.
Traversal through iterators
Graph traversal is provided through iterators.
DFS and BFS
<code>zig
var dfs = try digraph.dfsIterator(.{.start = start});
var bfs = try digraph.bfsIterator(.{.start = start});</code>
One can also specify the traversal direction as <code>.targetwards</code> or <code>.sourcewards</code> defaulting to <code>.targetwards</code>. As well as an allocator used for the
underlying stack/queue and set used by the iterators, otherwise the graph's allocator is used.
The following obtains a BFS iterator that traverses from <code>start</code> in reverse allocating seen nodes and queueing future ones using a custom allocator.
<code>zig
var bfs = try digraph.bfsIterator(.{.start = start, .direction = .sourcewards, .allocator = allocator});</code>
Dijkstra
Dijkstra's algorithm is encoded as an iterator that returns an entry of the next nearest node and its distance to the starting node.
A distance type has to be provided and must be able to contain the edge weight type <code>W</code> if it either an integer or floating point number type.
If <code>W</code> is not an arithmetic type, then each edge is assumed to have weight <code>1</code>.
<code>zig
digraph.dijkstraIterator(Distance: type, options)</code>
The following code prints all nodes of distance equal to 1337
to the starting node.
<code>zig
var dijkstra = digraph.dijkstraIterator(u64, .{.start = start});
while (try dijkstra.next()) |entry| {
if (entry.distance == 1337) std.debug.print("{any}\n", .{entry.node});
if (entry.distance > 1337) break;
}</code>
A*
An experimental iterator using a heuristic function. See the source for details. | [] |
https://avatars.githubusercontent.com/u/54745129?v=4 | proximity-sort | krish-r/proximity-sort | 2024-09-17T19:27:10Z | Zig implementation of @jonhoo's proximity-sort. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/krish-r/proximity-sort/tags | Apache-2.0 | [
"zig"
] | 14 | false | 2025-05-17T14:28:04Z | true | true | unknown | github | [] | proximity-sort
Zig implementation of <a>@jonhoo</a>'s <a>proximity-sort</a>.
Why?
I just started learning Zig. And, proximity-sort felt like a good first project.
Overview
The command-line utility sorts the inputs (from stdin) by their path proximity (number of shared leading path components) to a given path.
Example Usage
<code>shell
fd -t f | zig-out/bin/proximity-sort /path/to/file | fzf --reverse --tiebreak=index</code>
Building from Source
If you have <a>zig master</a> installed, you can build this with -
<code>shell
zig build -Doptimize=ReleaseSafe</code>
Credits & References
<ul>
<li><a>proximity-sort</a> by <a>@jonhoo</a></li>
<li><a>Performance Optimizer Observation Platform</a> by <a>@andrewrk</a>.</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/109687654?v=4 | testing-xtp-plugins | dylibso/testing-xtp-plugins | 2024-08-20T17:35:53Z | An end-to-end example of testing XTP plugins which call host functions + example mocked host functions. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/dylibso/testing-xtp-plugins/tags | BSD-3-Clause | [
"example",
"golang",
"host",
"mock",
"testing",
"typescript",
"wasm",
"xtp",
"zig"
] | 22 | false | 2025-02-26T05:46:26Z | false | false | unknown | github | [] | Testing XTP Plugins with Host Functions
Repository Overview
<code>mock</code>
This directory contains the implementation of the mocked host functions. Note
that these functions are Extism plugin exports, which become imports to the
plugin that calls the host functions.
<code>plugin</code>
This directory contains an example XTP plugin, based on the <code>schema.yaml</code>
schema. It calls the host functions from its export <code>handleLogEvent</code> and
aggregates the count of events per event source. We test this plugin's behavior
and the host function integration by running it several times with different
inputs to see that the KV data and plugin aggregation of that data is correct.
<code>test</code>
This directory contains the test code that calls into the code in <code>plugin</code> to
test various aspects of it.
Building
Before compiling the contents, please ensure that you have the following
installed:
<ul>
<li><a><code>xtp</code></a> (any recent
version)</li>
<li><a><code>tinygo</code></a> (>= 0.31.2)</li>
<li><a><code>zig</code></a> (>= 0.13.0)</li>
<li><a><code>extism-js</code></a>
(>= 1.0.0-rc11)</li>
<li><a><code>npm</code></a> (>= 10.2.4)</li>
</ul>
With all of the above installed, you can now run:
<code>sh
make build</code>
Testing
After you've built the <code>mock</code>, <code>plugin</code> and <code>test</code> modules, you can run:
<code>sh
make test</code>
or:
<code>sh
cd plugin
xtp plugin test # note: the plugin/xtp.toml [[test]] configuration</code>
Questions or need help?
File <a>an issue</a> on this
repository, or reach out to us on the
<a>Extism Discord</a> and we can provide assistance. | [] |
https://avatars.githubusercontent.com/u/2675542?v=4 | izig.c | golddranks/izig.c | 2024-11-13T12:49:09Z | izig.c: A Zig interpreter written in ISO C99 | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/golddranks/izig.c/tags | - | [
"bootstrapping",
"c",
"interpreter",
"zig"
] | 35 | false | 2024-11-28T06:58:17Z | false | false | unknown | github | [] | izig.c: A Zig interpreter written in ISO C99
Work in progress.
Progress:
<ul>
<li>2024-11-13 Project started.</li>
<li>2024-11-18 Hello world (<a>test/hello.zig</a>) works.</li>
</ul>
Plans:
<ul>
<li>Continue adding test cases and make them pass.</li>
<li>Continue learning Zig & C...</li>
<li>Bootstrap Zig compiler?</li>
</ul>
Non-plans:
<ul>
<li>Type checking</li>
<li>Good error handling</li>
<li>Good performance</li>
<li>Full conformance</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/78207109?v=4 | xxz | walltime1/xxz | 2025-01-15T06:00:30Z | My learn-by-doing attempt to get into Zig by creating a hexdump utility. STD library only. Many thanks to ziglings project. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/walltime1/xxz/tags | Apache-2.0 | [
"zig"
] | 26 | false | 2025-02-04T20:54:05Z | true | true | unknown | github | [] | My learn-by-doing attempt to get into Zig by creating a hexdump utility.;
STD library only.
Many thanks to ziglings project.
Milestones:
- [] Implement basic functions;
<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> Basic hexdump formatter;
<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> Read command line params;
<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> Handle errors when suppiled params are missing/broken;
<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> Read data directly from stdin;
- if there is a valid filename a file will be read;
- if there is none and there is a data piped the data will be read;
- otherwise program will be stuck vaiting for an input;
- [] Going deeper;
- [] Learn zig build system;
- [] Note: for now this seems pretty straingtforward so I will try to move some function to external zig file and then import it back to the original code (Most likely I will try to implement my own args reading and parsing module);
- [] Coloured output;
- [] Final steps;
- [] Support for both -p val amd -p=val command line param formats;
- [] Code revision, maybe I will know how to redo already implemented stuff in a better way by that moment;
- [] Add comptime where it is possible; | [] |
https://avatars.githubusercontent.com/u/100683661?v=4 | Lean | ANDRVV/Lean | 2024-11-28T18:56:43Z | ⚡ Blazing fast scientific computing library for Zig | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/ANDRVV/Lean/tags | MIT | [
"computing",
"linear-algebra",
"math",
"thread",
"zig",
"zig-package",
"ziglang"
] | 53 | false | 2025-04-07T18:22:34Z | true | true | 0.0.1 | github | [] | Documentation coming soon, you can use this version from self-reading.
Consider using <code>test.zig</code> to understand how to use <strong>Lean</strong>. | [] |
https://avatars.githubusercontent.com/u/6793008?v=4 | zig-assembly-test | ndrean/zig-assembly-test | 2024-11-24T22:25:19Z | Zig compiled to WebAssembly rendered in Phoenix Liveview | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/ndrean/zig-assembly-test/tags | MIT | [
"mandelbrot-viewer",
"phoenix",
"phoenix-liveview",
"webassembly",
"zig"
] | 344 | false | 2024-11-28T05:02:34Z | false | false | unknown | github | [] | Zig-assembly-test
Zig code compiled to WebAssembly and rendered in Phoenix Liveview and as a standalone app.
The Zig code will compute some RGBA values for each point of a quantitized area of the 2D-plan. We have a canvas whose pixels <code>(i,j)</code> are in correspondance with a point <code>(x,y)</code> of the 2D-plane.
<ul>
<li>Build the <code>WebAssembly</code> code:</li>
</ul>
<code>sh
cd zoomzig
zig build</code>
<ul>
<li>Render in Phoenix LiveView:</li>
</ul>
<code>sh
cd mandelbrot
mix copy && mix phx.server</code>
<ul>
<li>Render by GitHub pages as a standalone app:</li>
</ul>
<a>https://ndrean.github.io/zig-assembly-test/</a>
Zig
The code will return a slice that corresponds to the RGBA values of each pixel.
In the "build.zig", we set <code>.max_memory = std.wasm.page_size * 128</code>.
We set a variable <code>global_colours</code>. The <code>Zig</code> will populate this slice.
To compile to <code>WebAssembly</code>, we:
- use <code>export fn ...</code>
- pass only numbers as arguments
- can't return error union, thus no <code>try</code>. Use <code>catch unreached</code>.
- function returns <code>void</code> or <code>numbers</code>.
- to return the "colours slice", we build a function to return the address of the first element of this memory block with <code>getColoursPointer</code>, and another one with its length with <code>getColoursSize</code>.
```wasm
var global_colours: ?[]u8 = null;
const allocator = std.heap.wasm_allocator;
export fn allocMemory(len: usize) ?[*]u8 {
return if (allocator.alloc(u8, len)) |slice|
slice.ptr
else |_|
null;
}
export fn getColoursPointer() *u8 {
// Expose the colours array to the host
return &global_colours.?.ptr[0];
}
export fn getColoursSize() usize {
return global_colours.?.len;
}
```
Elixir
Run a Mix task to copy the "zoom.wasm" file into the assets folder.
The call <code>WebAssembly.instantiateStreaming</code> asks for a content-type "application/wasm".
Serve the "wasm" file to the client
We serve the <em>wasm</em> file with an endpoint defined in the router.
```elixir
pipeline :api do
plug :accepts, ["wasm"]
end
scope "/", MandelzoomWeb do
pipe_through :api
get "/wasm", WasmController, :load
end
```
<code>Phoenix</code> appends by default sets "charset=utf8" to the Content-Type and <code>WebAssembly</code> does not want this.
We overwrite the <code>resp_headers</code>:
(<a>https://elixirforum.com/t/content-type-for-custom-binary-format/60452</a>)
<code>elixir
conn =
%Plug.Conn{conn | resp_headers: [{"content-type", "application/wasm"} | conn.resp_headers]}</code>
Javascript - WebAssembly
The code is call via a hook, <code>MandelbrotViewer</code>.
The key points:
- instantiate a "memory" for WebAssembly,
- we let Javascript pass the quantity of memory to allocate to WebAssembly as we provided a function in Zig to allocate memory for the slice (with <code>std.heap.wasm_alloator</code>).
- fetch the wasm file (Phoenix will serve it)
- we called the WebAssembly module "instance" here". Call the WebAssembly functions with <code>instance.exports.<function_name></code>
- pass only numbers (integers, floats) to <code>WebAssembly</code>. We named our main <code>Zig</code> function "initilize" which receives only numbers and return <code>void</code>.
```js
const WASM_PAGE_SIZE = 65536; // 64kB
const MAXIMUM_PAGES = 150;
const INITAIL_PAGES = 60;
const cols = this.canvas.width,
rows = this.canvas.height,
bytesNeeded = cols * rows * 4;
const pagesNeeded = Math.ceil(bytesNeeded / WASM_PAGE_SIZE);
this.memSize = pagesNeeded;
const initialPages = Math.max(pagesNeeded, INITIAL_PAGES);
memory = new WebAssembly.Memory({initial: initialPages, maximum: MAXIMUM_PAGES});
const {instance } = await WebAssembly.instantiateStreaming(fetch("/wasm"), { env: {memory}});
instance.exports.allocMemory(this.memSize);
instance.exports.initilize(eows, cols...);
```
To fill in the canvas, we:
- instanttiate a Javascript <code>new Uint8ClampedArray</code> that will receive the WebAssembly data from the memory address with a given length.
- create an <code>ImageData</code> from this data
- draw into the Canvas with <code>createImageBitmap</code>
Related
The <code>Elixir</code> library <a>Orb</a> can produce a WAT (text).
To compile to WASM binary, use <a>WABT</a>.
<a>Wasmex</a> can run Wasi in Elixir.
Create a Github pages from a subfolder
<ul>
<li>Create a folder, "pages" here.</li>
<li>create an "index.html" which calls a (eg) "scriptjs"</li>
<li>put your JS in it</li>
<li>copy "zoom.wasm" in the same folder or keep it sync with:</li>
</ul>
```sh
/pages
ln -s ../zoomzig/zig-out/bin/zoom.wasm
```
Then:
<code>sh
git subtree push --prefix pages origin gh-pages</code>
et voilà:
<a>https://ndrean.github.io/zig-assembly-test/</a> | [] |
https://avatars.githubusercontent.com/u/93522910?v=4 | zig-package-manager-example | 42LM/zig-package-manager-example | 2025-01-18T15:16:07Z | Zig ⚡️ - Package Manager Example | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/42LM/zig-package-manager-example/tags | MIT | [
"build-zig",
"dependecy",
"package-manager",
"zig",
"zig-fetch",
"zig-zon",
"ziglang",
"zon"
] | 37 | false | 2025-05-12T08:58:13Z | true | true | 0.14.0 | github | [] | <a></a> <a></a> <a></a>
<a></a> <a></a>
zig-package-manager-example
This is a small and simple example/demonstration of the zig package manager aka <code>zig.zon</code>.
It provides an example on how to provide a zig ligrary and how to use it in a different project.
<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>
🛟 Does <strong>not work</strong> on <strong>zig versions below <code>< v0.14.0</code></strong>!
[!TIP]
If you are looking for minimal setup of a zig library please check out the <a>minimal</a> branch.
</blockquote>
Using it
Create a new zig project:
<code>sh
mkdir zig-package-manager-example
cd zig-package-manager-example
zig init</code>
In your zig project folder (where <code>build.zig</code> is located), run:
<code>sh
zig fetch --save "git+https://github.com/42LM/zig-package-manager-example"</code>
<blockquote>
[!TIP]
You can also fetch the lib/repo via tag/release. Check out the <a>v0.0.0 release</a>.
</blockquote>
Then, in your <code>build.zig</code>'s <code>build</code> function, add the following before
<code>b.installArtifact(exe)</code>:
<code>zig
const hello = b.dependency("hello", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("hello", hello.module("hello"));</code>
In your projects <code>main.zig</code> file import the hello module:
```zig
const std = @import("std");
const hello = @import("hello");
pub fn main() !void {
std.debug.print("{s}\n", .{hello.world()});
}
```
Run the project:
<code>sh
zig build run</code>
<blockquote>
Does not do much, only prints out <code>no operations</code>
</blockquote>
Run the tests:
<code>sh
zig build test</code>
<blockquote>
Run the tests of the lib
</blockquote>
Troubleshoot
<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>
Handle with care: Delete the cache of zig:
<code>rm -rf ~/.cache/zig</code>
</blockquote> | [] |
https://avatars.githubusercontent.com/u/3405876?v=4 | veclib-zig | ymd-h/veclib-zig | 2024-10-08T14:21:23Z | SIMD based Vector Library for Zig | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/ymd-h/veclib-zig/tags | MIT | [
"simd",
"zig"
] | 193 | false | 2024-10-23T10:31:42Z | true | true | unknown | github | [] | veclib.zig: SIMD based Vector Computing Library
<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 still under development.
</blockquote>
veclib utilizes Zig standard SIMD vector calculation.
Aside from the standard, veclib supports scalar-vector mixed calculation
and runtime-known length slice handling.
Features
<ul>
<li>Nullary Function</li>
<li><code>iota</code></li>
<li>Element-wise Unary Function (<code>f(comptime T: type, arg: anytype, out: []T) void</code>)</li>
<li><code>copy</code></li>
<li><code>sqrt</code></li>
<li><code>sin</code>, <code>cos</code>, <code>tan</code></li>
<li><code>exp</code>, <code>exp2</code>, <code>exp1m</code></li>
<li><code>log</code>, <code>log2</code>, <code>log10</code>, <code>log1p</code></li>
<li><code>abs</code></li>
<li><code>floor</code>, <code>ceil</code>, <code>trunc</code>, <code>round</code></li>
<li><code>byteSwap</code>, <code>bitReverse</code></li>
<li><code>countLeadingZeros</code>, <code>countTrailingZeros</code>, <code>popCount</code></li>
<li>Element-wise Binary Function (<code>f(comptime T: type, arg1: anytype, arg2: anytype, out: []T) void</code>)</li>
<li><code>add</code>, <code>wrapAdd</code>, <code>saturateAdd</code></li>
<li><code>sub</code>, <code>wrapSub</code>, <code>saturateSub</code></li>
<li><code>mul</code>, <code>wrapMul</code>, <code>saturateMul</code>,</li>
<li><code>div</code>, <code>divFloor</code>, <code>divTrunc</code>, <code>rem</code>, <code>mod</code></li>
<li><code>bitAnd</code>, <code>bitOr</code>, <code>bitXor</code></li>
<li><code>min</code>, <code>max</code></li>
<li>Element-wise Binary Comparison (<code>f(comptime T: type, arg1: anytype, arg2: anytype, out: [] bool) void</code>)</li>
<li><code>eq</code>, <code>neq</code>, <code>gt</code>, <code>gte</code>, <code>lt</code>, <code>lte</code>,</li>
<li>Ternary Function (<code>f(comptime T: type, arg1: anytype, arg2: anytype, arg3: anytype, out: []T)</code>)</li>
<li><code>mulAdd</code></li>
<li><code>clip</code></li>
<li>Reduction Function (<code>f(comptime T: type, arg: []const T) T</code>)</li>
<li><code>sum</code>, <code>wrapSum</code>, <code>saturateSum</code>,</li>
<li><code>prod</code>, <code>wrapProd</code>, <code>saturateProd</code>,</li>
<li><code>smallest</code>, <code>largest</code>,</li>
<li><code>all</code>, <code>any</code></li>
</ul>
We use <code>anytype</code> for type inference, however, there some limitations.
- <code>arg</code> at element-wise functions can be scalar or slice.
- scalar value will be broadcsted (not to slice size, but to SIMD vector size)
- Not all types are supported at some functions.
- e.g. Bit-wise operations are only supported for integer types. | [] |
https://avatars.githubusercontent.com/u/12107095?v=4 | zig-8 | mattkolega/zig-8 | 2024-08-27T08:28:05Z | 🕹️ CHIP-8 interpreter written in Zig | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/mattkolega/zig-8/tags | MIT | [
"chip-8",
"chip8",
"emulator",
"retro",
"sokol",
"zig"
] | 96 | false | 2025-01-30T11:25:47Z | true | true | 0.13.0 | github | [
{
"commit": "e190830fd57293addc64019ca61d7fcf38dcdf5f",
"name": "sokol",
"tar_url": "https://github.com/floooh/sokol-zig/archive/e190830fd57293addc64019ca61d7fcf38dcdf5f.tar.gz",
"type": "remote",
"url": "https://github.com/floooh/sokol-zig"
},
{
"commit": "ad81729d33da30d5f4fd23718debec... | ZIG-8
A rewrite of my CHIP-8 interpreter using Zig.
In 2023, I wrote a CHIP-8 interpreter in C. I recently had another look at the code and thought it would a cool exercise to rewrite it in a different language. Zig was chosen to be used because it's fairly similar to C and I thought this project would provide a good opportunity to learn it.
<strong>CHIP-8</strong> (COSMAC VIP) and <strong>SCHIP</strong> (SUPER-CHIP 1.1) behaviours are implemented.
Sokol is used for graphics and input, and miniaudio is used for audio.
Build
Requires version 0.13 of the Zig compiler. Tested on macOS, but it should work on any OS supported by Zig.
```bash
Clone the repo along with submodules
git clone --recursive https://github.com/mattkolega/zig-8.git
Navigate to the repo directory
cd zig-8
Build and run executable
The executable will be located in the zig-out folder
zig build run
```
Usage
Either run <code>zig build run</code> at the root directory, or navigate to the output directory (default is <em>zig-out</em>) and run <code>./zig-8</code>.
Launching the interpreter will open a file dialog to load <code>.ch8</code> ROM files.
Program Arguments
Command line arguments can optionally be given to the interpreter to alter its execution.
```
-h, --help
Display this help message and exit.
-c, --cycles
Set the number of cycles per second for the interpreter.
-m, --machine
Set the interpreter type. Possible values: chip8 | schip
```
Controls
Original CHIP-8 computers supported hexadecimal keypads for input. This interpreter maps those keys to the left side of a QWERTY keyboard.
The keys needed to be pressed during execution depend on the ROM file.
<code>1 2 3 C 1 2 3 4
4 5 6 D -> Q W E R
7 8 9 E A S D F
A 0 B F Z X C V</code>
Acknowledgements
<ul>
<li><a>Tobias V. Langhoff</a> for his overview and guide on implementing a CHIP-8 interpreter.</li>
<li><a>Timendus</a> for his test ROM collection, which greatly helped with getting all the opcodes working properly.</li>
<li><a>Gulrak's CHIP-8 Variant Opcode Table</a> for aiding with identifying quirks associated with different CHIP-8 implementations.</li>
<li><a>CHIP-8 Extensions</a> for providing valuable insight into the different CHIP-8 extension variations.</li>
<li>John Earnest's <a>Octo</a> IDE for serving as a reference which I could compare my interpreter's behaviour to.</li>
</ul>
Licence
<a>MIT</a> | [] |
https://avatars.githubusercontent.com/u/89778787?v=4 | voxel-engine | Selveris/voxel-engine | 2024-09-13T22:39:34Z | Voxel-engine written in Zig with Vulkan and SDL2 | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/Selveris/voxel-engine/tags | MIT | [
"sdl2",
"voxel-engine",
"vulkan",
"zig"
] | 152 | false | 2024-10-22T14:40:30Z | true | true | 0.13.0 | github | [
{
"commit": "vulkan-sdk-1.3.290.0.tar.gz",
"name": "vulkan_headers",
"tar_url": "https://github.com/KhronosGroup/Vulkan-Headers/archive/vulkan-sdk-1.3.290.0.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/KhronosGroup/Vulkan-Headers"
},
{
"commit": "zig-0.13-compat.tar.gz",
... | <em>Disclaimer: this is a personal project which main goal is to learn Zig and graphics programming</em>
Dependencies
<ul>
<li><a>Zig v.0.13</a></li>
<li><a>vulkan-zig wrapper</a></li>
<li><a>sdl2 zig wrapper</a></li>
<li>libsdl2 and libvulkan</li>
</ul>
Roadmap
Features
<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> 🚧 Render meshes
<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> Basic voxel generation
<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> advanced voxel generation
<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> models and animation
<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> basic physic
Platform
<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> 🚧 Linux
<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> Windows
<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> MacOs
🚧 work in progress | [] |
https://avatars.githubusercontent.com/u/61390950?v=4 | whisper.zig | thewh1teagle/whisper.zig | 2024-11-16T02:33:07Z | Transcribe audio with whisper in zig | main | 1 | 1 | 1 | 1 | https://api.github.com/repos/thewh1teagle/whisper.zig/tags | - | [
"asr",
"openai",
"whisper",
"zig"
] | 15 | false | 2024-11-18T08:57:54Z | true | true | unknown | github | [
{
"commit": "01d3bd7d5ccd1956a7ddf1b57ee92d69f35aad93",
"name": "whisper",
"tar_url": "https://github.com/ggerganov/whisper.cpp/archive/01d3bd7d5ccd1956a7ddf1b57ee92d69f35aad93.tar.gz",
"type": "remote",
"url": "https://github.com/ggerganov/whisper.cpp"
},
{
"commit": "0d3f80b7394368623d... | whisper.zig
Transcribe audio with whisper in Zig
Building
See <a>Building.md</a> | [] |
https://avatars.githubusercontent.com/u/30439029?v=4 | zig-book | EinoPlasma/zig-book | 2024-12-22T14:54:07Z | 【中文翻译】一本开源的 Zig 语言入门书 | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/EinoPlasma/zig-book/tags | NOASSERTION | [
"programming-language",
"programming-languages",
"translation",
"zig"
] | 27,680 | true | 2025-01-04T03:29:54Z | false | false | unknown | github | [] | 《Zig语言入门》(Introduction to Zig)
正在翻译中
<a></a>
嘿!这是Pedro Duarte Faria写的《Zig语言入门:一本基于项目的书》的官方仓库(的非官方中文翻译)。
想知道更多关于这本书的事儿吗?往下看看<a>关于本书</a>这部分就行。
你可以在浏览器里直接阅读本书的最新版:<a>https://pedropark99.github.io/zig-book/</a>。
本书用的是<a>Quarto</a>出版系统,还加了一点R代码(<code>zig_engine.R</code>),负责调用Zig编译器来编译和运行那些Zig代码例子。
支持这个项目!
如果你觉得这个项目不错,想支持一波,可以去Amazon上买电子书或者实体书:
<a>https://www.amazon.com/dp/B0DJYMDRLP</a>
直接给作者打钱
你还可以通过以下方式直接向作者捐点小费:
<ul>
<li>通过PayPal捐赠。</li>
<li>通过Revolut转账。</li>
</ul>
这些捐款能帮作者继续创作类似的内容,还能让他有精力为社区编写更多有用的工具和材料。
PayPal
<a></a>
Revolut
如果你想用Swift支付,可以用以下银行和Swift信息:
<code>收款人:Pedro Duarte Faria
BIC/SWIFT代码:REVOSGS2
账户号码:6124512226
银行名称和地址:Revolut Technologies Singapore Pte. Ltd, 6 Battery Road, Floor 6-01, 049909, Singapore, Singapore
对应BIC:CHASGB2L</code>
要是你有Revolut账户,扫下面的二维码就行:
关于本书
这是一本开源的入门向技术书籍,面向<a>Zig编程语言</a>。Zig是一种新的通用低级编程语言,专为打造最优且健壮的软件而生。
本书的官方仓库:<a>https://github.com/pedropark99/zig-book</a>。
无论你是萌新还是有经验的老手,这本书都适合你。它通过小项目(类似于Eric Matthes的《Python Crash Course》)带你走进Zig的精彩世界。这些项目包括:Base64编码器/解码器、HTTP服务器和图像滤镜。
通过这本书,你会学到:
<ul>
<li>Zig的语法,以及它与C、C++和Rust的区别。</li>
<li>数据结构、内存分配器、文件系统和I/O操作。</li>
<li>Optionals——一种处理空值的新范式。</li>
<li>如何测试和调试Zig应用程序。</li>
<li>把错误当作值来处理的方法。</li>
<li>使用嵌入在语言中的构建系统来编译C和Zig代码。</li>
<li>Zig与C的互操作。</li>
<li>利用多线程和SIMD实现并行计算。</li>
<li>还有很多其他内容。</li>
</ul>
如何构建本书
本书依赖三款主要软件:
<ol>
<li><a>Zig编译器</a>,用来编译书中大部分代码示例。</li>
<li><a>R编程语言</a>,提供一些有用的工具来收集代码示例,并将它们发送给Zig编译器进行编译和执行,同时收集结果以包含在书中。</li>
<li><a>Quarto出版系统</a>,用于编译本书,创建内部链接、引用、章节结构和HTML内容等。</li>
</ol>
所以,首先你需要在你的机器上安装这三款软件。
你可以通过点击上面的超链接找到如何安装这些软件的说明。
安装R包
在你搞定上面列出的三个软件后,下一步就是跑一下<code>dependencies.R</code>这个R脚本,来装上本书要用到的各种R包。只需要在你的终端里敲下下面这行命令就好,一切应该会顺利搞定。
注意:如果你用的是Linux或MacOS,这个过程可能会有点耗时,因为每个依赖项都得从源码构建。而在Windows上,这通常很快,因为一般有预构建的二进制文件可用。
<code>bash
Rscript dependencies.R</code>
渲染书籍
要是你在电脑上已经正确安好了Quarto,那接下来构建这本书就很简单了。只要在终端里执行下面这行命令就好。
<code>bash
quarto render</code>
脚本如何找到Zig编译器的路径
有些R代码(<code>zig_engine.R</code>)用来收集书中各个地方的Zig代码示例,并把它们送给Zig编译器去编译和执行。
但这之前,这段R代码得先找到你机器上装着的Zig编译器。这个搜索分两步走。首先,它会用<a><code>Sys.which()</code>函数</a>来找Zig编译器的路径,这其实就是<code>which</code>命令行工具的一个R接口。
这是个快速又简单的方法,但不是所有情况下都管用,特别是当你的Zig编译器没装在标准位置的时候。所以,就有了第二招:搜PATH环境变量。
它会获取你的PATH环境变量的值,然后挨个检查里面列出的目录,试着在里面找Zig编译器。虽然这种方法慢很多,但成功率高。
License
Copyright © 2024 Pedro Duarte Faria。本书采用CC-BY 4.0 Creative Commons Attribution 4.0 International Public License许可。
<a></a> | [] |
https://avatars.githubusercontent.com/u/54503497?v=4 | zigsay | RetroDev256/zigsay | 2024-10-07T22:21:34Z | zigsay - the zig version of cowsay | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/RetroDev256/zigsay/tags | MIT | [
"zig"
] | 6 | false | 2025-03-04T23:44:01Z | true | true | unknown | github | [] | zigsay
```
< All your text are belong to us >
<code>\ _
/"\
/o o\
</code>
<em>\/ \ / \/</em>
\,<em>\ _,//
'---. .-'
\ \
/ \ ^
| | |\
.__\ /__. | \
</em>//--. .---\_ / /
/\ \ \ /\ / /
\ .<strong><em>,/ /
.</em></strong>___,/
``` | [] |
https://avatars.githubusercontent.com/u/41264578?v=4 | zig-mpi-alogrithms | sinhaparth5/zig-mpi-alogrithms | 2025-01-14T18:51:53Z | MPI processing algorithms in Zig | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/sinhaparth5/zig-mpi-alogrithms/tags | - | [
"dsa",
"mpi",
"zig"
] | 6 | false | 2025-03-31T14:41:17Z | true | true | unknown | github | [] | MPI Algorithms in Zig
This project implements parallel algorithms using MPI (Message Passing Interface) in Zig. Currently, it includes a parallel merge sort implementation.
Prerequisites
<ul>
<li>Zig (0.11.0 or later)</li>
<li>OpenMPI or MPICH</li>
<li>C compiler (gcc/clang)</li>
</ul>
Installing Prerequisites
For Ubuntu/Debian:
<code>bash
sudo apt update
sudo apt install zig openmpi-bin libopenmpi-dev build-essential</code>
For macOS:
<code>bash
brew install zig open-mpi</code>
Project Structure
<code>mpi-algorithms/
├── build.zig # Build configuration
├── src/
│ ├── main.zig # Main entry point
│ ├── sort.zig # Sorting implementations
│ ├── utils.zig # Utility functions
│ └── types.zig # Type definitions
└── README.md # This file</code>
Building the Project
<ol>
<li>
Clone the repository:
<code>bash
git clone https://github.com/sinhaparth5/mpi-algorithms
cd mpi-algorithms</code>
</li>
<li>
Build the project:
<code>bash
zig build</code>
</li>
</ol>
Running the Program
To run the parallel merge sort with 4 processes:
<code>bash
mpirun -np 4 zig-out/bin/mpi-algorithms</code>
You can adjust the number of processes by changing the <code>-np</code> parameter.
Running Tests
To run the test suite:
<code>bash
zig build test</code>
Implementation Details
The parallel merge sort implementation:
1. Divides the input array into chunks
2. Distributes chunks to different MPI processes
3. Each process sorts its chunk using sequential merge sort
4. The root process (rank 0) collects and merges the sorted chunks
5. Verifies the final sorted array
Performance Considerations
<ul>
<li>The optimal number of processes depends on:</li>
<li>Input size</li>
<li>Available CPU cores</li>
<li>Memory bandwidth</li>
<li>Network speed (for distributed systems)</li>
<li>For small arrays, overhead from MPI communication might outweigh benefits</li>
<li>Best performance typically achieved when:</li>
<li>Input size is large</li>
<li>Data is evenly distributed</li>
<li>Number of processes matches available CPU cores</li>
</ul>
Contributing
<ol>
<li>Fork the repository</li>
<li>Create your feature branch</li>
<li>Commit your changes</li>
<li>Push to the branch</li>
<li>Create a Pull Request</li>
</ol>
License
This project is licensed under the MIT License - see the LICENSE file for details. | [] |
https://avatars.githubusercontent.com/u/105504350?v=4 | zig-evdev | futsuuu/zig-evdev | 2024-08-19T01:53:20Z | libevdev bindings for Zig | main | 0 | 1 | 1 | 1 | https://api.github.com/repos/futsuuu/zig-evdev/tags | MIT | [
"evdev",
"uinput",
"zig"
] | 65 | false | 2025-03-08T08:50:24Z | true | true | 0.14.0 | github | [
{
"commit": null,
"name": "libevdev",
"tar_url": null,
"type": "remote",
"url": "https://gitlab.freedesktop.org/libevdev/libevdev/-/archive/libevdev-1.13.3/libevdev-libevdev-1.13.3.tar.gz"
}
] | zig-evdev
A Zig wrapper for <a>libevdev</a> with High-Level API
Installation
Build dependencies
<ul>
<li>Zig</li>
<li>Python3</li>
</ul>
Python3 is used to run <a>libevdev/make-event-names.py</a>.
Status
<ul>
<li>Initialization and setup
<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> new
<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> new_from_fd
<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> free
<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> grab
<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> set_fd
<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> change_fd
<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> get_fd</li>
<li>Library logging facilities
<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> ...</li>
<li>Querying device capabilities
<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> get_name
<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> get_phys
<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> get_uniq
<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> get_id_product
<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> get_id_vendor
<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> get_id_bustype
<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> get_id_version
<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> get_driver_version
<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> has_property
<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> has_event_type
<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> has_event_code
<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> get_abs_info
<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> get_abs_minimum
<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> get_abs_maximum
<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> get_abs_fuzz
<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> get_abs_flat
<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> get_abs_resolution
<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> get_event_value
<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> fetch_event_value
<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> get_repeat</li>
<li>Multi-touch related functions
<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> get_slot_value
<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> fetch_slot_value
<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> get_num_slots
<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> get_current_slot</li>
<li>Modifying the appearance or capabilities of the device
<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> set_name
<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> set_phys
<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> set_uniq
<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> set_id_product
<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> set_id_vendor
<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> set_id_bustype
<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> set_id_version
<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> enable_property
<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> disable_property
<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> set_event_value
<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> set_slot_value
<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> set_abs_info
<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> set_abs_minimum
<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> set_abs_maximum
<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> set_abs_fuzz
<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> set_abs_flat
<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> set_abs_resolution
<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> enable_event_type
<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> disable_event_type
<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> enable_event_code
<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> disable_event_code
<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> kernel_set_abs_info
<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> kernel_set_led_value
<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> kernel_set_led_values
<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> set_clock_id</li>
<li>Miscellaneous helper functions
<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> event_is_type
<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> event_is_code
<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> event_type_get_name
<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> event_code_get_name
<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> event_value_get_name
<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> property_get_name
<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> event_type_get_max
<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> event_type_from_name
<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> event_type_from_name_n
<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> event_code_from_name
<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> event_code_from_name_n
<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> event_value_from_name
<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> event_type_from_code_name
<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> event_type_from_code_name_n
<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> event_code_from_code_name
<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> event_code_from_code_name_n
<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> event_value_from_name_n
<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> property_from_name
<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> property_from_name_n</li>
<li>Event handling
<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> next_event
<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> has_event_pending</li>
<li>uinput device creation
<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> uinput_create_from_device
<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> uinput_destroy
<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> get_fd
<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> get_syspath
<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> get_devnode
<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> get_write_event</li>
</ul>
License
This repository is licensed under the <a>MIT license</a>. | [] |
https://avatars.githubusercontent.com/u/576065?v=4 | minijinja.zig | thekorn/minijinja.zig | 2024-10-19T06:43:22Z | zig bindings for minijinja | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/thekorn/minijinja.zig/tags | Apache-2.0 | [
"bindings",
"zig",
"zig-package"
] | 82 | false | 2025-04-06T15:36:10Z | true | true | 0.14.0 | github | [
{
"commit": "master",
"name": "minijinja",
"tar_url": "https://github.com/mitsuhiko/minijinja/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/mitsuhiko/minijinja"
}
] | minijinja.zig
zig bindings for the amazing <a>minijinja</a> templating engine.
It's a thin wrapper around the C ABI of minijinja.
<strong>NOTE</strong>: this is a work in progress and mac only at the moment.
Requirements
<ul>
<li>zig >= 0.14</li>
<li>rustup (for building minijinja-capi) or</li>
<li>a nix environment (and then use <code>nix develop</code> to get a shell with all dependencies)</li>
</ul>
Usage
Add this package to your zig project:
<code>bash
$ zig fetch --save git+https://github.com/thekorn/minijinja.zig#main</code>
Add dependency and import to the <code>build.zig</code> file:
<code>zig
...
const minijinja = b.dependency("minijinja", .{
.target = target,
.optimize = optimize,
});
...
exe.root_module.addImport("minijinja", minijinja.module("minijinja"));</code>
And then, just use it in the code:
```zig
const std = @import("std");
const minijinja = @import("minijinja");
const Environment = minijinja.Environment;
const Context = minijinja.Context;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
const templ =
\<ul>
\{%- for user in users %}
\ <li>{{ user.name }}</li>
\{%- endfor %}
\</ul>
;
<code>var env = try Environment.init();
defer env.deinit();
env.set_debug(true);
try env.add_template("list", templ);
const User = struct {
name: []const u8,
};
const users = [_]User{
.{ .name = "Hans" },
.{ .name = "Wurst" },
};
const t = try env.render_template_struct(allocator, "list", .{ .users = users });
defer allocator.free(t);
std.debug.print("{s}\n", .{t});
</code>
}
```
Which results in
```
<ul>
<li>Hans</li>
<li>Wurst</li>
</ul>
```
Tests
Using <code>nix</code> tests can be run like
<code>bash
$ nix develop -c zig build test --summary all</code> | [] |
https://avatars.githubusercontent.com/u/191431411?v=4 | VidWeave | QubitSync/VidWeave | 2025-01-16T12:42:04Z | Efficient Zig-based backend for video processing, handling transcoding, quality chunking, and optimization for seamless streaming applications | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/QubitSync/VidWeave/tags | NOASSERTION | [
"ffmpeg",
"server",
"sqlite",
"zig"
] | 41 | false | 2025-03-18T05:29:12Z | true | true | unknown | github | [
{
"commit": "master",
"name": "zap",
"tar_url": "https://github.com/zigzap/zap/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/zigzap/zap"
},
{
"commit": "47a9c0d42ff5c083a9b04b04a5a1aeb0a777e153",
"name": "sqlite",
"tar_url": "https://github.com/vrischmann/z... | VidWeave
VidWeave is a lightweight, Zig-powered backend designed for efficient video processing. It handles tasks like transcoding, chunking videos into multiple quality levels, and saving metadata to an SQLite database. VidWeave also provides a REST API for seamless integration with other services.
Features
<ul>
<li><strong>Video Processing</strong>: Transcode videos into multiple quality chunks.</li>
<li><strong>SQLite Integration</strong>: Save video metadata and processing details in an SQLite database.</li>
<li><strong>REST API</strong>: Easily integrate with your frontend or other services.</li>
</ul>
Requirements
<ul>
<li>Zig (latest version)</li>
<li>FFmpeg (for video processing)</li>
<li>SQLite3</li>
<li>Zap</li>
</ul>
Installation
<ol>
<li>
Clone this repository:
<code>bash
git clone https://github.com/yourusername/VidWeave.git
cd VidWeave</code>
</li>
<li>
Install dependencies (ensure FFmpeg and SQLite are installed on your system).
</li>
<li>
Build the project:
<code>bash
zig build</code>
</li>
</ol>
Usage
Run the application:
<code>bash
zig build run</code>
API Endpoints
The provided API and database schema define a clear workflow for uploading, managing, and streaming videos. Below is a summary and clarification for ease of understanding:
<strong>API Overview</strong>
<strong>Upload Video</strong>
<ul>
<li><strong>Endpoint</strong>: <code>/api/upload</code></li>
<li><strong>Method</strong>: <code>POST</code></li>
<li><strong>Purpose</strong>: Allows uploading a video with metadata like name, description, quality, and a thumbnail.</li>
<li><strong>Required Fields</strong>: <code>name</code>, <code>description</code>, <code>quality</code>, <code>thumbname</code>, <code>video</code>.</li>
</ul>
<strong>Fetch Video</strong>
<ul>
<li><strong>Endpoint</strong>: <code>/api/video/{vid}</code></li>
<li><strong>Method</strong>: <code>GET</code></li>
<li><strong>Purpose</strong>: Retrieves video details using the video ID.</li>
<li><strong>Response Data</strong>:</li>
<li>Metadata (<code>name</code>, <code>description</code>, <code>quality</code>, etc.).</li>
<li>Video paths.</li>
</ul>
<strong>Delete Video</strong>
<ul>
<li><strong>Endpoint</strong>: <code>/api/video/{vid}</code></li>
<li><strong>Method</strong>: <code>DELETE</code></li>
<li><strong>Purpose</strong>: Deletes a specific video by its ID.</li>
<li><strong>Response</strong>: Success message.</li>
</ul>
<strong>Update Video</strong>
<ul>
<li><strong>Endpoint</strong>: <code>/api/video/{vid}</code></li>
<li><strong>Method</strong>: <code>PUT</code></li>
<li><strong>Purpose</strong>: Updates metadata and video files for a specific video.</li>
<li><strong>Request Fields</strong>: Similar to the upload endpoint.</li>
</ul>
<strong>Player Configuration</strong>
<ul>
<li><strong>Endpoint</strong>: <code>/api/player</code></li>
<li><strong>Method</strong>: <code>GET</code></li>
<li><strong>Purpose</strong>: Fetches player configuration settings, including video and audio files at different resolutions.</li>
</ul>
<strong>Database Schema</strong>
The <code>Video</code> table structure supports the following:
- Unique identifiers for users (<code>uid</code>) and videos (<code>vid</code>).
- Fields for metadata (<code>name</code>, <code>description</code>, <code>quality</code>).
- JSON structure for video paths, e.g., <code>{ "720p:1": "/path/to/part1", ... }</code>.
- Timestamps for creation and updates.
<strong>Player Features</strong>
<ul>
<li>Streams videos and handles buffering.</li>
<li>Synchronizes playback with client-side players.</li>
<li>Configuration is stored in a JSON-like structure.</li>
</ul>
Project Structure
<code>├── src/
│ ├── main.zig # Main application file
│ ├── api.zig # API endpoint handlers
│ ├── video_processor.zig # Video processing logic
│ ├── db.zig # SQLite database integration
├── build.zig # Build script
├── README.md # Project documentation</code>
Notes for Implementation
<ol>
<li><strong>Video Splitting</strong>: The server should handle segmenting videos into parts for efficient streaming (e.g., <code>320p:1</code>, <code>720p:1</code>).</li>
<li><strong>Buffer Management</strong>: Ensure the buffer size and synchronization intervals in <code>playerConfig</code> match the expected client performance.</li>
<li><strong>Security</strong>: Protect endpoints, especially upload and delete, with authentication/authorization.</li>
<li><strong>Error Handling</strong>: Define error responses for cases like invalid video IDs, incomplete uploads, or configuration mismatches.</li>
</ol>
Contributing
Contributions are welcome! Please open an issue or submit a pull request with your improvements.
License
This project is licensed under the MIT License. See <code>LICENSE</code> for details. | [] |
https://avatars.githubusercontent.com/u/184568612?v=4 | zlugify | zigzedd/zlugify | 2025-01-08T22:19:41Z | [MIRROR] Generate ASCII slugs from unicode strings. | main | 0 | 1 | 1 | 1 | https://api.github.com/repos/zigzedd/zlugify/tags | MIT | [
"ascii",
"emoji",
"normalization",
"slug",
"slugify",
"transliteration",
"unicode",
"unidecode",
"utf8",
"zig",
"zig-library",
"zig-package"
] | 10 | false | 2025-04-12T10:40:01Z | true | true | unknown | github | [
{
"commit": null,
"name": "anyascii",
"tar_url": null,
"type": "remote",
"url": "https://code.zeptotech.net/zedd/anyascii.zig/archive/v1.2.0.tar.gz"
}
] |
zlugify
Generate ASCII slugs from unicode strings
zlugify is part of <a><em>zedd</em></a>, a collection of useful libraries for zig.
zlugify
<em>zlugify</em> is a library to generate slugs from all types of UTF-8 encoded strings. It uses <a>anyascii.zig</a> to convert UTF-8 encoded strings into ASCII-only strings.
Versions
zlugify 1.1.0 is made and tested with zig 0.14.0.
How to use
Install
In your project directory:
<code>shell
$ zig fetch --save https://code.zeptotech.net/zedd/zlugify/archive/v1.1.0.tar.gz</code>
In <code>build.zig</code>:
<code>zig
// Add zlugify dependency.
const zlugify = b.dependency("zlugify", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("zlugify", zlugify.module("zlugify"));</code>
Examples
These examples are highly inspired from the test cases that you can find at the end of <a><code>lib.zig</code></a>.
trim and normalize
```zig
const slugify = @import("zlugify").slugify;
const slug = try slugify(allocator, " This is a test.\t\n");
defer allocator.free(slug);
try std.testing.expectEqualStrings("this-is-a-test", slug);
```
remove diacritics and unnecessary spaces
```zig
const slugify = @import("zlugify").slugify;
const slug = try slugify(allocator, "SôMÈThing \t ÉLSÈ");
defer allocator.free(slug);
try std.testing.expectEqualStrings("something-else", slug);
```
convert non-latin characters
```zig
const slugify = @import("zlugify").slugify;
const slug = try slugify(allocator, "埼玉 県");
defer allocator.free(slug);
try std.testing.expectEqualStrings("qiyu-xian", slug);
```
convert ascii-like characters
```zig
const slugify = @import("zlugify").slugify;
const slug = try slugify(allocator, "𝒔𝒍𝒖𝒈𝒊𝒇𝒚 𝒂 𝒔𝒕𝒓𝒊𝒏𝒈");
defer allocator.free(slug);
try std.testing.expectEqualStrings("slugify-a-string", slug);
```
convert emojis
```zig
const slugify = @import("zlugify").slugify;
const slug = try slugify(allocator, "hello 🦊");
defer allocator.free(slug);
try std.testing.expectEqualStrings("hello-fox", slug);
```
customized separator
```zig
const slugifySeparator = @import("zlugify").slugify;
const slug = try slugifySeparator(allocator, "tôi yêu những chú kỳ lân", '_');
defer allocator.free(slug);
try std.testing.expectEqualStrings("toi_yeu_nhung_chu_ky_lan", slug);
``` | [] |
https://avatars.githubusercontent.com/u/139875399?v=4 | zig-code-flow | gaskam/zig-code-flow | 2024-11-13T16:46:54Z | A comprehensive VS Code extension providing Zig language support with powerful snippets to enhance your Zig development experience. | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/gaskam/zig-code-flow/tags | MIT | [
"snippets",
"vscode-snippets",
"zig",
"ziglang"
] | 222 | false | 2025-05-16T11:28:43Z | false | false | unknown | github | [] | Zig Code Flow
A comprehensive VS Code extension providing Zig language support with powerful snippets to enhance your Zig development experience. As we all know, writing zig code can sometimes be tedious, as there are a lot of long common patterns. Who remembers how to properly create an allocator? This extension tries to cover your back by providing you with the most common patterns we experience while developing.
Features
📝 60+ Zig-specific code snippets covering all common patterns
Snippet Categories
<ul>
<li>🔧 Basic language constructs</li>
<li>🏗️ Functions and data structures</li>
<li>🔄 Control flow and error handling</li>
<li>📚 Memory management utilities</li>
<li>✅ Testing helpers</li>
<li>🛠️ Development tools</li>
</ul>
Learn more about available snippets in the sections below.
Table of Contents
<ul>
<li><a>Installation</a><ul>
<li><a>From the Marketplace</a></li>
<li><a>Manual Installation</a></li>
</ul>
</li>
<li><a>Snippets</a><ul>
<li><a>Basic Snippets</a></li>
<li><a>Functions</a></li>
<li><a>Debug</a></li>
<li><a>Variables</a></li>
<li><a>Data Structures</a></li>
<li><a>Loops</a></li>
<li><a>Array and Lists</a></li>
<li><a>Memory Management</a></li>
<li><a>Control Flow</a></li>
<li><a>Error Handling</a></li>
<li><a>Random</a></li>
<li><a>Testing</a></li>
<li><a>Assembly</a></li>
<li><a>File Information</a></li>
<li><a>Random values</a></li>
</ul>
</li>
<li><a>Contributing</a></li>
<li><a>Support</a></li>
<li><a>Acknowledgements</a></li>
<li><a>License</a></li>
<li><a>Author</a></li>
</ul>
Installation
From the Marketplace
<ol>
<li>Open VS Code</li>
<li>Go to Extensions (Ctrl+Shift+X)</li>
<li>Search for "Zig Code Flow"</li>
<li>Click Install</li>
<li>Rate 5 stars!</li>
</ol>
Manual Installation
<ol>
<li>Download the latest release from the <a>GitHub repository</a></li>
<li>Open VS Code</li>
<li>Go to Extensions (Ctrl+Shift+X)</li>
<li>Click on the three dots in the top right corner</li>
<li>Select "Install from VSIX..."</li>
<li>Choose the downloaded file</li>
<li>Rate 5 stars!</li>
</ol>
Snippets
Basic Snippets
| Prefix | Description |
|--------|-------------|
| <code>ziglove</code> | Prints 'I love ZIG!' to the console |
| <code>zighello</code>, <code>helloworld</code> | Prints 'Hello, World!' to the console |
| <code>launch</code>, <code>startup</code> | Initializes a main function |
| <code>project</code>, <code>template</code> | Creates a new project template |
| <code>import</code> | Import a module using @import |
| <code>import_std</code>, <code>imps</code> | Import the standard library |
| <code>import_builtin</code>, <code>impb</code> | Import the builtin module |
Functions
| Prefix | Description |
|--------|-------------|
| <code>fn</code> | Create a function with optional error union return type |
| <code>fn_generic</code> | Create a generic function with compile-time type parameter |
| <code>pub_fn</code> | Create a public function with optional error union return type |
| <code>inline_fn</code> | Create an inline function |
| <code>nested_fn</code> | Create a nested function inside a struct |
Debug
| Prefix | Description |
|--------|-------------|
| <code>debug</code> | Print debug output using std.debug.print |
| <code>stdout</code> | Get the standard output writer |
Variables
| Prefix | Description |
|--------|-------------|
| <code>comptime</code> | Define a compile-time variable |
| <code>var</code> | Declare a variable with explicit type |
| <code>const</code> | Declare a constant with inferred type |
| <code>const_type</code> | Declare a constant with explicit type |
Data Structures
| Prefix | Description |
|--------|-------------|
| <code>struct</code> | Create an anonymous struct |
| <code>const_struct</code> | Create a named struct type |
| <code>enum</code> | Create an enumeration with specified integer type |
| <code>union</code> | Create a tagged union type |
Loops
| Prefix | Description |
|--------|-------------|
| <code>for_value</code> | Create a for loop iterating over values |
| <code>for_value_index</code> | Create a for loop with both value and index |
| <code>for_inline</code> | Create an inline for loop |
| <code>for_label</code> | Create a labeled for loop |
| <code>for_else</code> | Create a for loop with else branch |
| <code>while</code> | Create a while loop |
| <code>while_else</code> | Create a while loop with else branch |
| <code>while?</code> | Create a while loop for optional values with error handling |
| <code>while_label</code> | Create a labeled while loop with nested break |
| <code>while_inline</code> | Create an inline while loop |
Array and Lists
| Prefix | Description |
|--------|-------------|
| <code>list</code> | Create an anonymous list literal |
| <code>array_init</code> | Initialize an array with optional sentinel |
| <code>array_list</code> | Create a dynamic array list |
| <code>fixed_array_list</code>, <code>array_list_length</code> | Create an array list with fixed capacity |
| <code>append</code> | Append an element to an array list |
| <code>append_assume_capacity</code> | Append an element to an array list assuming there is enough capacity |
| <code>to_owned_slice</code> | Convert ArrayList to owned slice |
| <code>string_hash_map</code> | Create a hash map with string keys |
| <code>sort</code> | Sort slice using std.sort |
Memory Management
| Prefix | Description |
|--------|-------------|
| <code>GPA</code>, <code>general_purpose_allocator</code> | Initialize a General Purpose Allocator (GPA) |
| <code>arena_allocator</code> | Initialize an Arena Allocator |
| <code>FBA</code>, <code>fixed_buffer_allocator</code> | Initialize a Fixed Buffer Allocator (FBA) |
Control Flow
| Prefix | Description |
|--------|-------------|
| <code>if</code> | Create an if statement |
| <code>if_else</code> | Create an if-else statement |
| <code>if_else?</code> | Create an if-else for optional values with error handling |
| <code>switch</code> | Create a switch statement |
| <code>orelse</code> | Handle null with orelse return |
Error Handling
| Prefix | Description |
|--------|-------------|
| <code>try</code> | Try an expression that may return an error |
| <code>catch</code> | Catch and handle errors from an expression |
| <code>defer</code> | Create a defer block |
| <code>errdefer</code> | Create an errdefer block |
| <code>error</code> | Create an error value |
| <code>error_set</code> | Define an error set |
Random
| Prefix | Description |
|--------|-------------|
| <code>randint</code> | Generate a random integer |
Testing
| Prefix | Description |
|--------|-------------|
| <code>test</code> | Create a test block |
| <code>expect</code> | Add a test expectation using std.testing |
Assembly
| Prefix | Description |
|--------|-------------|
| <code>asm</code> | Insert inline assembly code |
File Information
| Prefix | Description |
|--------|-------------|
| <code>filename</code> | Insert current file name with extension |
| <code>filenamebase</code> | Insert current file name without extension |
| <code>directory</code> | Insert current directory path |
| <code>abspath</code> | Insert absolute path of current file |
| <code>relpath</code> | Insert workspace-relative path of current file |
| <code>workspacename</code> | Insert current workspace name |
| <code>workspacefolder</code> | Insert current workspace root folder path |
Random values
| Prefix | Description |
|--------|-------------|
| <code>randomvalue</code> | Insert random number |
| <code>randomhex</code> | Insert random hexadecimal value |
| <code>uuid</code> | Insert a UUID (Universal Unique Identifier) |
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.
<ol>
<li>Fork the repository</li>
<li>Create your feature branch (<code>git checkout -b feature/amazing-feature</code>)</li>
<li>Commit your changes (<code>git commit -m 'Add some amazing feature'</code>)</li>
<li>Push to the branch (<code>git push origin feature/amazing-feature</code>)</li>
<li>Open a Pull Request</li>
</ol>
Support
If you find any bugs or have feature requests, please open an issue on the GitHub repository. If you find any secrity vulnerabilities, please contact me directly at <a>contact@gaskam.com</a>.
Acknowledgements
<ul>
<li>Thanks to the Zig team for creating such an amazing language.</li>
<li>Thanks to <a>Kamil Leys</a> for his friendly advice and support.</li>
<li>This extension is inspired by the <a>Zig Snippets</a> in some parts.</li>
</ul>
License
This project is licensed under the MIT License - see the <a>LICENSE</a> file for details.
Author
Coded with ❤️ by <a>Gaskam</a>
See other projects on our <a>GitHub</a> page.
You can also visit our personal GitHub profiles:
- <a>Kamil Leys</a>
- <a>Gaspard lebaube</a> | [] |
https://avatars.githubusercontent.com/u/115993332?v=4 | ziglings | vhyran/ziglings | 2024-12-21T16:56:18Z | Data Structures and Algorithms in Zig | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/vhyran/ziglings/tags | MIT | [
"dsa",
"learn-to-code",
"learning",
"learning-by-doing",
"markdown",
"markdown-documentation",
"markdown-zig",
"practice",
"zig",
"zig-learn",
"ziglang",
"ziglings"
] | 156 | false | 2025-04-16T15:21:02Z | false | false | unknown | github | [] | Data Structures and Algorithms in Zig
Welcome to the <strong>Data Structures and Algorithms (DSA)</strong> repository implemented in the Zig programming language! This repository serves as a resource for anyone interested in learning about fundamental DSA concepts and their implementations in Zig.
Introduction
This repository contains implementations of common data structures and algorithms in Zig. The goal is to provide clean, efficient, and well-documented code that serves as both a learning resource and a utility for developers.
Why Zig?
Zig is a modern programming language designed for simplicity, performance, and reliability. Its features include:
- Manual memory management with safety checks
- No hidden control flow or memory allocations
- Compile-time code execution
- Interoperability with C
These features make Zig a great choice for implementing efficient and predictable data structures and algorithms.
Getting Started
Version
<ul>
<li>0.13.0</li>
</ul>
Documentation
You can find the official Zig <a>documentation</a>. This documentation provides comprehensive information about the Zig programming language, including its syntax, features, and standard library.
Prerequisites
Install <a>Zig</a> on your system.
Compiling and Running Code
To compile and run an implementation:
<code>bash
zig build-exe <filename>.zig
./<filename></code>
Contributing
Contributions are welcome! If you’d like to add a new data structure, algorithm, or improve existing implementations, please follow these steps:
<ol>
<li>Fork this repository.</li>
<li>Create a new branch: <code>git checkout -b feature/<your-feature></code>.</li>
<li>Commit your changes: <code>git commit -m 'Add new feature'</code>.</li>
<li>Push to the branch: <code>git push origin feature/<your-feature></code>.</li>
<li>Submit a pull request.</li>
</ol>
Ensure your code follows the Zig coding standards and includes appropriate comments and test cases.
License
This repository is licensed under the MIT License. See the <a>LICENSE</a> file for details.
Feel free to explore, learn, and contribute! | [] |
https://avatars.githubusercontent.com/u/51416554?v=4 | size.zig | hendriknielaender/size.zig | 2024-12-25T19:47:46Z | null | main | 4 | 1 | 0 | 1 | https://api.github.com/repos/hendriknielaender/size.zig/tags | MIT | [
"analyzer",
"binary",
"size",
"symbol",
"treemap",
"zig",
"zig-package",
"ziglang"
] | 9 | false | 2025-02-18T21:09:52Z | true | true | unknown | github | [] | size.zig | [] |
https://avatars.githubusercontent.com/u/1387056?v=4 | c_with_zig | ewaldhorn/c_with_zig | 2024-09-29T16:05:10Z | Compiling C programs with Zig | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/ewaldhorn/c_with_zig/tags | MIT | [
"c",
"zig"
] | 7 | false | 2025-02-19T16:41:56Z | true | false | unknown | github | [] | Basic C Template
This is a simple C template I use for new projects. It assumes <a>Zig</a> and <a>Task</a> are installed.
Zig is used as the compiler / runner of the C code while Task is used instead of the traditional Make file. Why? Because I like Task, that's why!
Zig
I'm using Zig 0.13.0 as the C compiler in this project on a Mac, but it should work on just about any platform.
Task
Task is a brilliant tool written in Go that allows you to execute tasks defined in a simple YAML file. I put all the commands I use in there, since it just makes life easier.
Available tasks
Use <code>task</code> by itself in the terminal to get a list of available tasks. Some of the tasks are:
<ul>
<li><code>task</code> To see the list of tasks</li>
<li><code>task clean</code> to remove build artifacts</li>
<li><code>task build</code> To build the binaries to the 'bin' folder</li>
<li><code>task run</code> To run the 'main.c' file using Zig</li>
<li><code>task test</code> To run the C-based tests</li>
<li><code>task license</code> To display the license</li>
<li><code>task readme</code> To display the readme</li>
</ul>
Going further
If you are interested, you also look at <a>using the Zig build system</a> as a really nice replacement for traditional <code>make</code> files. Zig is a great toolchain and programming language, but you don't need to use Zig for your C projects if you don't want to. Instead, you can leverage the power of the toolchain with this project and keep using C as your favourite language.
I have included a sample <code>build.zig</code> file that handles basic build tasks for this C project.
Use <code>zig build</code> to build the <code>hello_from_zig_build</code> binary in the <code>zig-out/bin</code> directory. I have not yet been able to get Zig to place binaries anywhere else.
What about make
Of course, <code>make</code> is not going anywhere, so I've included an example <code>Makefile</code> as well, for those that prefer to keep using it, it is a well-known and powerful tool after all. | [] |
https://avatars.githubusercontent.com/u/5637842?v=4 | zigttp | mikkurogue/zigttp | 2025-01-05T15:19:49Z | A small tiny http server for my own use to host stuff on a vps at some point | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/mikkurogue/zigttp/tags | - | [
"cli-tool",
"http-server",
"zig",
"ziglang"
] | 21 | false | 2025-01-06T17:46:45Z | true | true | unknown | github | [] | Zigttp
A small HTTP Server that I'm building that I can use for static file serving that I can dump onto a VPS and serve my own static HTML files.
Essentially, this is a worse version of XAMPP or LAMPP or nginx, but written in Zig by me (a total idiot).
Current feature set:
Open a connection and open an index.html file from the <code>cwd/www/</code> directory and send that as a response for the <code>/</code> route.
Contributing
Because I am not exactly well versed in Zig as of yet, I wouldn't mind having help or pointers on how to proceed. I have no templates to contributing just having some fun while we write code in a cool language! | [] |
https://avatars.githubusercontent.com/u/99082612?v=4 | nand_to_tetris | theMyle/nand_to_tetris | 2024-09-15T11:26:10Z | Nand To Tetris - Building a general purpose computer starting from a NAND gate | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/theMyle/nand_to_tetris/tags | - | [
"hdl",
"logic-gates",
"nand2tetris",
"zig"
] | 1,146 | false | 2025-01-31T09:55:45Z | false | false | unknown | github | [] | Nand To Tetris Project Progression
Building a general purpose computer from the ground (from nand gates to jesus christ) up
Zig Implementation
<code>Recreating everything in ZIG just for fun. Also implementing
virtual logic gates, ALU, memory, etc.. from the ground up.</code>
<blockquote>
Elementary Logic Gates - All Tests Passing ✅
</blockquote>
<blockquote>
Arithmetic Logic Unit - Not yet implemented ❌
Memory - Not yet implemented ❌
</blockquote>
Nand To Tetris Progress
<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> => Implemented
<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> => Not yet implemented
Project 1 - Elementary Logic Gates
<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> Not
<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> And
<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> Or
<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> Xor
<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> Mux
<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> DMux
<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> Not16
<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> And16
<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> Or16
<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> Mux16
<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> Or8Way
<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> Mux4Way16
<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> Mux8Way16
<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> DMux4Way
<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> DMux8Way
Project 2 - Arithmetic Logic Unit
<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> HalfAdder
<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> FullAdder
<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> Add16
<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> Inc16
<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> ALU
Project 3 - Memory
<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> Bit
<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> Register
<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> RAM8
<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> RAM64
<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> RAM512
<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> RAM4K
<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> RAM16K
<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> PC | [] |
https://avatars.githubusercontent.com/u/51416554?v=4 | glaze | hendriknielaender/glaze | 2024-12-31T16:37:38Z | 🍩 cli kit | main | 3 | 1 | 0 | 1 | https://api.github.com/repos/hendriknielaender/glaze/tags | MIT | [
"ansi",
"ansi-escape-codes",
"cli",
"color",
"console",
"terminal",
"zig",
"zig-package"
] | 282 | false | 2025-01-09T21:04:57Z | false | false | unknown | github | [] | <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>
Still work in progress.
</blockquote>
Terminal string styling.
[](https://github.com/hendriknielaender/glaze/blob/HEAD/LICENSE)

[](https://github.com/hendriknielaender/glaze/blob/HEAD/CONTRIBUTING.md)
| [] |
https://avatars.githubusercontent.com/u/4970015?v=4 | homeforwarder | aw1875/homeforwarder | 2024-09-02T00:36:27Z | Expose homelab services to the web via SSH tunneling | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/aw1875/homeforwarder/tags | - | [
"homelab",
"homelab-automation",
"services",
"ssh",
"zig"
] | 1,924 | false | 2025-01-11T21:58:50Z | true | true | unknown | github | [] | Homeforwarder
Simple service to expose your homelab services to the internet using SSH tunnels.
https://github.com/user-attachments/assets/92c276bd-a600-4be3-8c53-32f9167b8c3e
Prerequisites
To use Homeforwarder at its current state, you need to have the following completed:
- Setup SSH so that connections are key-based (<a>guide</a>).
- Setup your SSH config file to include the necessary information for the servers you want to forward to (<a>guide</a>).
Things that may be nice to have:
- Hostnames for the servers you want to forward to updated in your <a>hosts file</a>.
Building
Pre-built binaries are available in the <a>releases</a> section. To build Homeforwarder from source, you need to have <a>Zig</a> installed.
This was built on Zig 0.14.0-dev but 0.13.0+ should work as well.
Once you have Zig installed, you can clone the repository using <code>git clone <repo></code> and then running the build script located in the scripts folder and passing in the desired architecture.
Currently only <code>arm64</code> and <code>amd64</code> are supported.
<code>sh
./scripts/build.sh arm64 # Build for arm64 such as Raspberry Pi
./scripts/build.sh amd64 # Build for x86_64</code>
This will create a debian package in the debs folder, for example <code>homeforwarder_0.0.1_amd64.deb</code>.
If you need to copy the package to another machine, you can use <code>scp</code> to copy it over.
<code>sh
scp debs/homeforwarder_0.0.1_amd64.deb user@remote:/path/to/destination</code>
Installation
Navigate to the folder containing the package and run the following command to install the package.
<code>sh
sudo apt install ./<package-name>.deb # For example sudo apt install ./homeforwarder_0.0.1_amd64.deb</code>
After installation, you will need to setup your config file. See the <a>Config File</a> section for more information.
Config File
See the <a>config file example</a> for an reference on how to setup the config file.
The config file should be moved to /opt/homeforwarder (or you can update the empty config file located in that directory).
To understand the fields in the config file, see the following descriptions:
- <code>timeout</code>: The timeout for the SSH tunnel in seconds.
- <code>services</code>: An array of services that you want to forward.
- <code>name</code>: The name of the service. This is used to identify the service in logs.
- <code>hostname</code>: Hostname of service host system. If you have the hostname in your hosts file, you can use that. Otherwise, you can use the IP address.
- <code>connect_port</code>: Port of service running on host system
- <code>forward_port</code>: Port of service to forward to forwarded system
- <code>protocol</code>: Protocol of service - TCP(0) or UNIX(1). Currently only TCP is supported.
- <code>forward_host</code>: Hostname of the system you want to forward to. This is the system that the service will be forwarded to and should be the name that is setup in your SSH config file.
Running
To start the service, you can use the following command:
<code>sh
sudo systemctl start homeforwarder</code>
If you want to enable the service to start on boot, you can use the following command to enable and start the service:
<code>sh
sudo systemctl enable homeforwarder --now</code>
To verify that the service is running, you can use the following command:
<code>sh
sudo systemctl status homeforwarder</code>
If there are any issues, you can check the logs using the following command:
<code>sh
sudo journalctl -u homeforwarder</code>
Credits
This project was inspired by a video from <a>Hoff</a> (<a>GitHub</a>). The video is a great watch and I highly recommend it. | [] |
https://avatars.githubusercontent.com/u/56510805?v=4 | onixhttp | HalilFocic/onixhttp | 2024-12-30T09:05:55Z | My attemt to making full fledged HTTP server in zig | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/HalilFocic/onixhttp/tags | MIT | [
"http",
"parser",
"tcp",
"zig"
] | 18 | false | 2025-01-28T07:18:00Z | true | true | unknown | github | [] | 🚀 ZigHTTP: Building a HTTP Server in Zig
A learning project to build a HTTP server in Zig, focusing on understanding networking fundamentals and systems programming.
🎯 Learning Goals
<ul>
<li>Understand TCP/IP networking fundamentals</li>
<li>Learn about HTTP protocol implementation</li>
<li>Gain experience with async I/O and concurrency</li>
<li>Build practical systems programming skills</li>
</ul>
Core Features
TCP Server
<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> Implement basic TCP listener
<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> Add connection handling
<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> Implement connection pooling
<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> Add graceful shutdown
<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> Implement basic error handling
HTTP Protocol
<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> Implement request line parser
<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> Add headers parser
<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> Add body parser
<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> Implement response writer
<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> Add basic validation
Request Handler
<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> Implement basic router
<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> Add request context
<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> Implement middleware system
<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> Add static file serving | [] |
https://avatars.githubusercontent.com/u/113083639?v=4 | zpix | zig-gamedev/zpix | 2024-11-04T21:19:02Z | Performance markers for Microsoft's PIX profiler in Zig. | main | 0 | 1 | 3 | 1 | https://api.github.com/repos/zig-gamedev/zpix/tags | MIT | [
"gamedev",
"graphics",
"pix",
"profiling",
"zig"
] | 10 | false | 2025-03-25T20:49:42Z | true | true | unknown | github | [] | <a>zpix</a>
Performance markers for <a>Microsoft's PIX profiler</a> in Zig.
Getting started
Example <code>build.zig</code>:
```zig
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ ... });
<code>const zpix = b.dependency("zpix", .{
.enable = true,
.path = @as([]const u8, ...folder containing WinPixGpuCapturer.dll, typically directory under C:\Program Files\\Microsoft PIX),
});
exe.root_module.addImport("zpix", zpix.module("root"));
</code>
}
```
Load GPU capture library before making any D3D12 calls:
```zig
const zpix = @import("zpix");
pub fn main() !void {
const pix_library = try zpix.loadGpuCapturerLibrary();
defer pix_library.deinit();
...
}
```
Then using the PIX UI:
1. Under Select Target Process --> Attach
2. Select process
3. Select Attach
4. Under GPU Capture, click on camera icon
Advanced usage
For <a>programmic capture</a> use <code>beginCapture</code>/<code>endCapture</code>.
If process has multiple windows, target one for GPU capture using <code>setTargetWindow</code>.
<a>Full PIX documentation</a> | [] |
https://avatars.githubusercontent.com/u/104203130?v=4 | tulva | lratt/tulva | 2025-01-28T19:43:21Z | work-in-progress bittorrent client written in zig | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/lratt/tulva/tags | - | [
"bittorrent",
"zig"
] | 16 | false | 2025-02-18T18:13:53Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/733193?v=4 | zigup | prantlf/zigup | 2024-08-18T10:27:38Z | Upgrades to the latest version of Zig, or manages more versions of Zig on the same machine, supporting all platforms including RISC-V, as simple es rustup. | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/prantlf/zigup/tags | MIT | [
"bash",
"install",
"shell",
"version",
"version-manager",
"zig",
"zsh"
] | 64 | false | 2024-12-02T17:47:39Z | true | true | 0.13.0 | github | [] | Zig Upgrader and Version Manager
Upgrades to the latest version of Zig, or manages more versions of Zig on the same machine, supporting all platforms including RISC-V, as simple es <code>rustup</code>.
<ul>
<li>Small. Written in <code>bash</code>, easily extensible.</li>
<li>Fast. Downloads and unpacks pre-built binary builds.</li>
<li>Portable. Writes only to the user home directory.</li>
<li>Simple. Switches the version globally, no environment variable changes needed.</li>
<li>Efficient. Just run <code>zigup up</code>.</li>
</ul>
Platforms: <code>macos-x86_64</code>, <code>macos-aarch64</code>, <code>freebsd-x86_64</code>, <code>linux-x86</code>, <code>linux-x86_64</code>, <code>linux-aarch64</code>, <code>linux-armv7a</code>, <code>linux-powerpc64le</code>, <code>linux-riscv64</code>, <code>windows-x86</code>, <code>windows-x86_64</code>, <code>windows-aarch64</code>.
Getting Started
Make sure that you have <code>bash</code> 4 or newer and <code>curl</code> available, execute the following command:
<code>curl -fSs https://raw.githubusercontent.com/prantlf/zigup/master/install.sh | bash
</code>
Before you continue, make sure that you have the following tools available: <code>curl</code>, <code>grep</code>, <code>jq</code>, <code>ln</code>, <code>rm</code>, <code>rmdir</code>, <code>sed</code>, <code>tar</code> (non-Windows), <code>uname</code>, <code>unxz</code> (non-Windows), <code>unzip</code> (Windows). It's likely that <code>jq</code> will be missing. You can install it like this on Debian: <code>apt-get install -y jq</code>.
Install the latest version of Zig, if it hasn't been installed yet:
<code>zigup install latest
</code>
Upgrade both the installer script and the Zig language, if they're not the latest versions, and delete the previously active latest version from the disk too:
<code>zigup up
</code>
Installation
Make sure that you have <code>bash</code> 4 or newer and <code>curl</code> available, execute the following command:
<code>curl -fSs https://raw.githubusercontent.com/prantlf/zigup/master/install.sh | bash
</code>
Both the <code>zigup</code> and <code>zig</code> should be executable in any directory via the <code>PATH</code> environment variable. The installer script will modify the RC-file of the shell, from which you launched it. The following RC-files are supported:
<code>~/.bashrc
~/.zshrc
~/.config/fish/config.fish
</code>
If you use other shell or more shells, update the other RC-files by putting both the installer directory and the Zig binary directory to <code>PATH</code>, for example:
<code>$HOME/.zigup:$HOME/.zig:$PATH
</code>
Start a new shell after the installer finishes. Or extend the <code>PATH</code> in the current shell as the instructions on the console will tell you.
Locations
| Path | Description |
|:-----------|:--------------------------------------------------------|
| <code>~/.zigup</code> | directory with the installer script and versions of Zig |
| <code>~/.zig</code> | symbolic link to the currently active version of Zig |
For example, with the Zig 0.13.0 activated:
<code>/home/prantlf/.zigup
├── 0.12.0 (another version)
├── 0.13.0 (linked to /home/prantlf/.zig)
└── zigup (installer script)
</code>
Usage
<code>zigup <task> [version]
Tasks:
current print the currently selected version of Zig
latest print the latest version of Zig for download
local print versions of Zig ready to be selected
remote print versions of Zig available for download
update update this tool to the latest version
upgrade upgrade Zig to the latest and remove the current version
up perform both update and upgrade tasks
install <version> add the specified or the latest version of Zig
uninstall <version> remove the specified version of Zig
use <version> use the specified or the latest version of Zig
help print usage instructions for this tool
version print the version of this tool
</code>
You can enter just <code>MAJ</code> or <code>MAJ.MIN</code> as <code><version></code>, instead of the full <code>MAJ.MIN.PAT</code>. When using the <code>install</code> or <code>use</code> tasks, the <em>most</em> recent full version that starts by the entered partial version will be picked. When using the <code>uninstall</code> task, the <em>least</em> recent full version that starts by the entered partial version will be picked.
Debugging
If you enable <code>bash</code> debugging, every line of the script will be printed on the console. You'll be able to see values of local variables and follow the script execution:
<code>bash -x zigup ...
</code>
You can debug the installer too:
<code>curl -fSs https://raw.githubusercontent.com/prantlf/zigup/master/install.sh | bash -x
</code>
Platform Detection
Environment Variables
The following environment variables can be set before running <code>install.sh</code> or <code>zigup</code>, if you know what you're doing:
| Variable | Default value |
|:----------------|:----------------------------------------|
| <code>PLATFORM</code> | detected using <code>uname</code> |
| <code>OS</code> | part of <code>PLATFORM</code> before <code>-</code> |
| <code>ARCH</code> | part of <code>PLATFORM</code> after <code>-</code> |
| <code>TOOL_URL_LIST</code> | https://ziglang.org/download/index.json |
| <code>TOOL_URL_DIR</code> | https://ziglang.org/download |
| <code>INST_DIR</code> | <code>$HOME/.zigup</code> |
| <code>TOOL_DIR</code> | <code>$HOME/.zig</code> |
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.
License
Copyright (c) 2024 Ferdinand Prantl
Licensed under the MIT license. | [] |
https://avatars.githubusercontent.com/u/166631311?v=4 | ini5 | kdgonz7/ini5 | 2024-10-02T00:42:30Z | Zig INI library made for fun and stability. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/kdgonz7/ini5/tags | BSD-2-Clause | [
"ini",
"parser",
"zig"
] | 395 | false | 2024-10-18T23:08:55Z | true | false | unknown | github | [] |
INI5
An INI parser library written in Zig, for Zig. Optimizations and benchmarks
shall be provided soon. Converts INI into AST format, supports sections, section
breaks, and simple assignments and values. Comes with a eco-efficient, thread
and memory safe program "inivisitor", toview the trees and values generated by
the INI5 library.
Synopsis
<ul>
<li><strong>Secure</strong><ul>
<li>INI5 can handle bad inputs without any crashes, memory violations, or high memory consumption. Under
heavy loads, INI5 strikes the perfect balance between performance and memory-safety.</li>
</ul>
</li>
<li><strong>Battle-Tested and Memory Safe</strong><ul>
<li>INI5 is tested against the most random, unpredictable, and corrupted files, and survived each input
with low memory consumption and efficient error communication. Don't believe me? Try it for yourself!
Build the <code>inivisitor</code> program, and run it against <code>samples/overtly_corrupted_file.ini</code>. Not even the
standing man codepoint can penetrate INI5. All of the memory is still reachable even when an error
occurs. INI5 has full access to all of its memory at any time.</li>
</ul>
</li>
<li><strong>Easy-to-read codebase</strong><ul>
<li>Another goal of INI5 is to be easy to read for people reading the codebase with no experience in either
Parsing or in the Zig language.</li>
</ul>
</li>
<li><strong>Maintainable</strong><ul>
<li>With over <strong>20 tests</strong> and <strong>10+ sample files</strong> that are applicable to real-world applications,
INI5 is made to handle any inputs in a structured and realistic way, parsing the INI structure into
a syntax tree which can then be read raw or converted into sections automatically.</li>
</ul>
</li>
</ul>
Visitor
```zig
var c_alloc = std.heap.ArenaAllocator.init(std.heap.c_allocator);
defer c_alloc.deinit();
const arena = c_alloc.allocator();
const sections = parseFile(arena, "hello.ini") catch |err| {
std.log.err("Failed to read file: '{s}'", .{args[1]});
std.log.err("({any})", .{err});
std.process.exit(1);
};
var section_list = sections.iterator();
while (section_list.next()) |item| {
visit(item.key_ptr.<em>, item.value_ptr.</em>, 0);
}
fn visit(name: []const u8, section: INISection, indent: usize) {
for (0..indent) |_| {
std.log.info(" ", .{});
}
<code>std.log.info("section {s}", .{name});
var iterator = section.variables.iterator();
while (iterator.next()) |assignment| {
std.log.info(" | assignment {s}", .{assignment.key_ptr.*});
std.log.info(" | value type {any}", .{assignment.value_ptr.*});
}
</code>
}
``` | [] |
https://avatars.githubusercontent.com/u/68057?v=4 | rowmath | ousttrue/rowmath | 2024-08-14T13:45:18Z | zig math library for 3D graphics, row major | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/ousttrue/rowmath/tags | MIT | [
"raylib",
"sokol",
"wasm",
"zig"
] | 779 | false | 2025-05-21T01:32:24Z | true | true | unknown | github | [
{
"commit": null,
"name": "rowmath",
"tar_url": null,
"type": "relative",
"url": "deps/rowmath"
}
] | rowmath
zig math library for 3D graphics, row major
note
rowmath は <code>横vec</code> + <code>row major</code> です。
| mul order | memory layout | impl |
| ----------- | --------------------------- | ------------------------------------- |
| 横vec x mvp | row major(m00, m01, m02...) | rowmath, DirectXMath, System.Numerics |
| pvm x 縦vec | col major(m00, m10, m20...) | glm, UnityEngine |
<ul>
<li>一般的な数学書やOpenGLドキュメントは縦vec方式</li>
<li>書籍:実例で学ぶゲーム3D数学 は横vec + row 方式</li>
<li>4x3(3x4)行列を使う場合は transpose して最後の4要素を落とす</li>
</ul>
結果として Mat4 のメモリ上の内容は同じ(transpose の transpose は同じ)になる。
双方ともに <code>(m12, m13, m14)</code> に translation が格納される。
乗算順(local x parent x root x view x projection)の左右が異なる。
命名
<ul>
<li>fromVec3, makeRotation(static 関数)</li>
<li>toRotation, transformPoint(member 関数)</li>
<li>add, mul, sub, eq, dot, cross</li>
</ul>
examples
sokol
raylib | [
"https://github.com/ousttrue/rowmath"
] |
https://avatars.githubusercontent.com/u/128724547?v=4 | leetcode | gerzon05/leetcode | 2024-12-04T21:48:15Z | An environment with open source resources and exercises. | main | 2 | 1 | 0 | 1 | https://api.github.com/repos/gerzon05/leetcode/tags | MIT | [
"c",
"go",
"leetcode",
"typescript",
"zig"
] | 678 | false | 2025-05-22T02:31:02Z | false | false | unknown | github | [] | Leetcode
Leetcode exercises for programming skills.
Resources
<strong>CSS</strong>
<ul>
<li>https://www.shapedivider.app/ → Custom Shape Dividers</li>
<li>https://photogradient.com/ → gradient generator</li>
<li>https://fontjoy.com/ → Simplified font combination</li>
<li>https://colourpalettegenerator.com → Color Palette Generator</li>
<li>https://cssgradienttext.com → Gradient Text Generator</li>
<li>https://easingwizard.com → transition time </li>
</ul>
<strong>APIs</strong>
<ul>
<li>https://ipquery.io</li>
</ul>
<strong>NODE</strong>
<ul>
<li>Docs: https://github.com/goldbergyoni/nodebestpractices/blob/spanish-translation/README.spanish.md</li>
</ul>
<strong>JavaScript</strong>
<ul>
<li>https://perf.link → compare code</li>
</ul>
<strong>Learn Zig</strong>
<ul>
<li>Docs: https://github.com/zouyee/zig-learning → </li>
</ul>
<strong>React</strong>
- Hooks: http://usehooks.com
License
<a>MIT</a> | [] |
https://avatars.githubusercontent.com/u/231785?v=4 | ezcaper | mnemnion/ezcaper | 2024-11-22T23:17:19Z | ezcape z ztrings | trunk | 0 | 1 | 0 | 1 | https://api.github.com/repos/mnemnion/ezcaper/tags | MIT | [
"escaping",
"repr",
"strings",
"zig",
"zig-package"
] | 34 | false | 2025-05-22T02:26:05Z | true | true | 0.14.0 | github | [
{
"commit": "refs",
"name": "runerip",
"tar_url": "https://github.com/mnemnion/runerip/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/mnemnion/runerip"
}
] | Ezcaper
A simple library for escaping strings and codepoints in format printing.
Purpose
Debugging and logging, among other uses, often want to print a string in the style of a source-code string. Zig has <a>std.zig.stringEscape</a>, but this escapes all non-ASCII input using <code>\xXX</code>-style escape sequences, which is valid Zig, but not ideal for seeing what a multi-byte string actually consists of.
The <code>ezcaper</code> library has several functions which serve to print strings, and codepoints, in a way which is valid Zig source code, but more legible, more like one might write the string naturally.
Install
<code>sh
zig fetch --save https://github.com/mnemnion/ezcaper/archive/refs/tags/v0.2.0.tar.gz</code>
Design
The brains of the operation is the oddly-specific function <code>whichControlKind</code>, which answers with the enums <code>.control</code>, <code>.format</code>, and <code>.normal</code>. This allows for strings and codepoints to have different behavior for format characters: escaped as codepoints and printed directly as strings. This lets Farmer Bob "👨🏻🌾" print as a single grapheme, while the ZWJ in Farmer Bob, in isolation, becomes <code>'\u{200d}'</code>.
There's also the simpler <code>isControl</code>, which converts <code>.control</code> and <code>.format</code> to <code>true</code> and <code>.normal</code> to <code>false</code>. Both of these are public functions, on the off chance that one might find them independently useful.
The functions are code-generated from the Unicode Character Database data for version 16.0, and will be updated upon the occasion of subsequent versions of Unicode. It uses a master switch to separate codepoints by power-of-two, which generates superior object code to a single ginormous switch, but is likely somewhat less efficient than the lookup table employed by <code>zg</code>. With the compensating advantage that it's pure code with no allocations.
These are used to power a few structs, intended to be used in formatted printing. <code>EscChar</code> will print a single <code>u21</code>, using either <code>{}</code> or <code>{u}</code> as the format string. If it receives <code>u</code> it will print the character 'bare', otherwise it will surround it with a pair of quotes and write <code>'</code> as <code>\'</code>. This will throw an error if the codepoint is too large.
There are two structs for printing escaped strings: <code>EscStringExact</code> and <code>EscStringLossy</code>. <code>EscStringExact</code> will print <code>\x</code> codes for any invalid Unicode data, while <code>EscStringLossy</code> will print the Unicode Replacement Character <code>U+FFFD</code> for any invalid sequences, following the recommended approach to substitution in the Unicode Standard.
Both may be called with <code>{}</code> and <code>{s}</code>, with the same sort of outcome: <code>s</code> will print the string without quotes, while the bare option will print the string in double-quotes and escape a double quote as <code>\"</code> and a backslash as <code>\\</code>. Both use the escape sequences <code>\t</code>, <code>\r</code>, and <code>\n</code>, print ASCII C0 codes as <code>\xXX</code>, and all other escaped values in the <code>\u{XXXX}</code> format.
It is a bug if the string produced by <code>EscStringExact</code> does not read into Zig with a byte-identical result to the source string. It is <em>not</em> a bug if <code>zig fmt</code> formats the result string differently from <code>ezcaper</code>.
Note that <code>EscChar</code> will escape surrogate codepoints, which is not (currently) valid in Zig source code. The string printers will replace or byte-print surrogates, respectively, and this will change if and when escaped surrogates become valid in Zig strings, see issue <a>#20270</a>.
For convenient formatting, these structs can be created with helper functions <code>escChar</code>, <code>escStringExact</code>, and <code>escStringLossy</code>. Example use:
<code>zig
std.debug.print("a string: {} and a char {u}", .{escStringExact(str), escChar(c)});</code>
The mnemonic here is that <code>{s}</code> and <code>{u}</code> do the same thing which the standard library does, and <code>{}</code> does the fancier custom thing.
Plans
I don't expect changes to this library at any point, other than to update the generated code each time Unicode releases a new standard. If you see output which looks like a bug, and I agree, I'll fix that.
This module has <a>runerip</a> as a dependency, because the API makes handling both kinds of string print easier. This dependency may be removed at some future point. | [
"https://github.com/mnemnion/obelizmo"
] |
https://avatars.githubusercontent.com/u/200686?v=4 | CosmicInvaders | deckarep/CosmicInvaders | 2025-01-28T23:40:59Z | Future home for the re-creation of Cosmic Invaders originally in C++/Allegro, now in Zig/Raylib. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/deckarep/CosmicInvaders/tags | AGPL-3.0 | [
"allegro",
"raylib",
"zig",
"ziglang"
] | 2,924 | false | 2025-02-19T03:50:17Z | true | true | unknown | github | [
{
"commit": "9fca33434ed1dbc1d34ebaefcf046a8702f9b1cb.tar.gz",
"name": "zigimg",
"tar_url": "https://github.com/zigimg/zigimg/archive/9fca33434ed1dbc1d34ebaefcf046a8702f9b1cb.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/zigimg/zigimg"
}
] | Cosmic Invaders
These assets come from an old Allegro ~4.2 game and are in zlib compressed format. Two types of bitmap files
exist: <code>.mz</code> and <code>.sz</code> files. The <code>.mz</code> variant are just simple bitmap graphics usually containing no animation
frame data and are just meant to largely convey RGB24 static images, such as a game background.
The <code>.sz</code> variant is meant to utilize Allegro's <code>sub_bitmap</code> feature and treats the asset as having multiple
frames of data as an RGB24 animated/multi-frame set of images.
The good news is, both file types can be treated as a single bitmap at least for the purpose of viewing the
files and properly extracting them.
So far, this code will also knock out the two key colors that this particular collection of assets use.
In order to process these files <code>zlib</code> must be used to properly deal with the fact that they are compressed.
The way these assets were figured out is by reverse engineering the original game asset using Binary Ninja.
To decompress and generate the <code>.png</code> equivalent assets just do: <code>zig build run</code> or for zigup users:
<code>zigup run master build run</code>
Note and License
The original game was <strong>not</strong> built by me and was created circa 2006. If you are adept at coding and can
figure out how I extracted the assets then you'll have access to the original game assets! If not, don't ask.
Aside from the game assets, this version is a <strong>fully clean-room, developed implementation</strong> of how I think
the code behaves from observation of the original game. My version of this game, written in Zig is
protected by the <code>AGPL-3.0</code> license. Additionally, while I intend to create a close working clone, I will
not be so strict on details and am mostly concerned with capturing the spirit of the original game. I might
even diverge or change some aspects of the game such as the graphics, enemies, sound, music, etc.
Original
<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> Original game runs at: 320x240, this game should as well but default to 640x480 and then
magically scale up/down based on user doing some resizing of the window.
All pixel-art must remain sharp.
<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> On start game, player starts with 550 money, 25 health points
<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> Weapons:
<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> Lazer Canon Turret = 140 - simply fires projectile up
<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> Missle Battery = 350 - fires a heat seeking, exploding missle
<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> Spark Tower = 550 - emits a catastrophic spark of electricity
<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> On game over, show GAME OVER banner, WAVES DEFEATED:
<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> Max of 12 invaders per row
<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> Every level, a new set of invaders spawns in a symmetrical formation
<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> Upon hit of weapon station, screen shake
<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> Upon weapon station blowing up, longer screen shake
<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> On game over screen, everything is rendered in monochrome greyscale except banner
<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> Hit on invader makes it flash white, invader now becomes red
<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> Between waves, all player's buildings remain
<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> On building hit, show a single dust cloud
<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> On building collapse:
<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> Show a timed release of 3 to 5 fiery explosions
<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> Station becomes dead (removed) from scene
<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> End with exploding sharapenel that bounces a few times on ground
<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> When alien bullet hits weapon station, show a single smoke plume (just one).
<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> When building is below X percent, show repeated smoke plumes.
<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> Buildings cannot overlap on user placement, if overlapped render as red and don't allow placing it
<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> When an invader is hit, his framerate speeds up temporarily to illustrate injury (faster pulsating)
<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> Each new building costs more than the last (verify)
<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> BOSS FIGHT: Every 5 levels (confirm this), a boss shows up drops red balls, green bubble with
red eye. Invaders will fly in circular motion around it, protecting it
<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> Additional settings (from original game) and factors can be found here: <code>data/strings.txt</code> | [] |
https://avatars.githubusercontent.com/u/42398392?v=4 | shamir-zig | diegoandino/shamir-zig | 2024-11-07T01:03:47Z | A Zig implementation of Shamir's Secret Sharing Scheme | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/diegoandino/shamir-zig/tags | - | [
"secret-sharing",
"shamir",
"shamir-secret-sharing",
"shamirs-secret-sharing",
"sss",
"ssss",
"zig",
"ziglang"
] | 335 | false | 2024-12-31T05:01:04Z | true | true | unknown | github | [] | Shamir-Zig
A Shamir's Secret Sharing Scheme library written in Zig.
Notes
<ul>
<li>Not to be used in Production <code>yet</code> (as it's a research project).</li>
<li>Doesn't support full miller-rabin primality test (the prime selection is left up to the user)</li>
</ul>
Get Started
Basic Usage
```
const allocator = std.heap.c_allocator;
var secret = try Managed.init(allocator);
defer secret.deinit();
try secret.setString(10, "12345678901234567890");
var p = try Managed.init(allocator);
try p.setString(10, "2305843009213693951"); // 2^61 - 1 (Mersenne prime)
var ssss = ShamirsSecretSharingScheme.init(allocator, 3, 5, p);
defer ssss.deinit();
const shares = try ssss.compute_shares(secret);
defer allocator.free(shares);
const reconstructed = try ssss.reconstruct_secret(shares[0..3]);
defer reconstructed.deinit();
<code>``
For more usage, see</code>test/` directory
Basic Usage with httpz
See 'demo' branch
<code>git checkout demo --> server/src/server.zig (contains full httpz server implementation)</code> | [] |
https://avatars.githubusercontent.com/u/15544577?v=4 | tls-conformance | jacobly0/tls-conformance | 2024-11-01T00:44:22Z | Test Zig's std.crypto.tls against other implementations. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/jacobly0/tls-conformance/tags | - | [
"tls",
"zig"
] | 8 | false | 2024-11-06T06:12:43Z | true | true | unknown | github | [
{
"commit": "3.9.2+1",
"name": "libressl",
"tar_url": "https://github.com/allyourcodebase/libressl/archive/3.9.2+1.tar.gz",
"type": "remote",
"url": "https://github.com/allyourcodebase/libressl"
}
] | 404 | [] |
https://avatars.githubusercontent.com/u/194645670?v=4 | bx | InteractiveBin/bx | 2025-01-16T05:28:54Z | Base library used across multiple projects | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/InteractiveBin/bx/tags | BSD-2-Clause | [
"zig",
"zig-package"
] | 34,140 | true | 2025-01-20T08:43:12Z | true | true | unknown | github | [] | bx
Base X-platform library.
<a></a>
<a></a>
<a></a>
Goals:
<ul>
<li>Provide OS/runtime/compiler independent core functionality to be able to
write cross-platform applications.</li>
<li>Compile without C Runtime (CRT) and without C++ Standard Library (STL).</li>
</ul>
Contact
<a>@bkaradzic</a>
Project page
https://github.com/bkaradzic/bx
<a>License (BSD 2-clause)</a>
<a target="_blank">
</a>
<code>Copyright 2010-2025 Branimir Karadzic
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
</code> | [
"https://github.com/InteractiveBin/bgfx",
"https://github.com/InteractiveBin/bimg"
] |
https://avatars.githubusercontent.com/u/43641633?v=4 | xlang | sno2/xlang | 2024-10-16T19:18:52Z | Alternative implementation of a Scheme-like set of languages used in COM S 3420. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/sno2/xlang/tags | MIT | [
"interpreter",
"programming-language",
"zig",
"ziglang"
] | 4,600 | false | 2025-04-04T04:02:51Z | true | true | 0.14.0 | github | [] | xlang
Alternative implementation of the <a>ArithLang</a>,
<a>VarLang</a>, <a>DefineLang</a>,
<a>FuncLang</a>, <a>RefLang</a>,
and <a>TypeLang</a> languages used in COM S
3420 at Iowa State University. The languages are described in the textbook <em>An
Experiential Introduction to Principles of Programming Languages</em> by Hridesh
Rajan.
Implementation details
xlang is written using <a>Zig 0.14</a>. Zig allows xlang to
run on many different platforms such as the web via <a>WebAssembly</a>.
The tokenizer is piped directly into code generation and xlang compiles the
source code into a bytecode format on the fly. This technique is also used by
the <a>QuickJS JavaScript engine</a>
and avoids the cost of building a parse tree.
Values are efficiently stored in 64-bit floating point numbers using
<a>NaN boxing</a>. The NaN boxing
implementation used in xlang is adapted from the one I contributed to the
<a>Kiesel JavaScript engine</a>.
Locals are immutable memory but they must be allocated on the stack for every
function call. Defines are mutable memory so they are allocated as a list of
registers at the top of the stack. Captured variables, i.e. using an outer
function's local, are more complex and require attaching values to lambda
values.
The tail call optimization reuses the stack of the current call when returning
another function call. Note that this is not limited to self-recursive functions
but also works when returning any function call to efficiently support
<a>mutual recursion</a>.
Memory is managed via a simple garbage collector that maintains a free list
amongst a list of pages. I did not spend any time optimizing the garbage
collector, but more efficient methods such as generational garbage collection
would most likely improve its performance.
Playground
The web playground uses the <a>Monaco Editor</a>,
<a>xterm.js</a>, and a Wasm build of xlang to interpret
programs on the web. Build the playground using
```
zig build playground
--watch for build on save
-Doptimize=ReleaseFast for optimized Wasm
```
Testing
Test files are located in the <a>examples folder</a>. Run the tests
against xlang:
```
zig build test -Djava_compat
--fuzz to enable fuzz testing
```
Run the tests against RefLang and TypeLang:
<code>zig build test -Dreflang_source=../path/to/reflang -Dtypelang_source=../path/to/typelang</code>
License
<a>MIT</a> | [] |
https://avatars.githubusercontent.com/u/587972?v=4 | zig_sel4 | tw4452852/zig_sel4 | 2024-11-12T07:15:44Z | Writing Sel4 application in Zig | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/tw4452852/zig_sel4/tags | - | [
"sel4",
"sel4-microkernel",
"zig"
] | 9 | false | 2025-04-27T02:55:58Z | false | false | unknown | github | [] | Writing Sel4 application in Zig
Prerequisite
<ul>
<li>Follow instructions on https://docs.sel4.systems/projects/buildsystem/host-dependencies.html to install necessary building dependencies for Sel4.</li>
<li>Install Zig (https://ziglang.org/learn/getting-started/).</li>
</ul>
Building
<code>make</code>
Running
<code>make run</code> | [] |
https://avatars.githubusercontent.com/u/61841960?v=4 | pennant | Arnau478/pennant | 2025-01-19T13:06:21Z | Argument parser for Zig | master | 1 | 1 | 0 | 1 | https://api.github.com/repos/Arnau478/pennant/tags | GPL-3.0 | [
"argprase",
"zig",
"zig-package"
] | 40 | false | 2025-04-26T20:47:48Z | true | true | unknown | github | [] |
Pennant
Argument parser for Zig.
Features
<ul>
<li>Opposite flags (<code>--foo</code>/<code>--no-foo</code>, <code>--uppercase</code>/<code>--lowercase</code>), which act on a single variable and are mutually exclusive</li>
<li>Values with and without equals sign (<code>--foo bar</code> and <code>--foo=bar</code> are both valid and equivalent)</li>
<li>Bool flags never take a value, non-bool flags always do</li>
<li>Shorthands for bool flags</li>
<li>Everything is defined in a single struct, with the power of Zig's <code>comptime</code></li>
</ul>
Examples
Examples are available in the <code>examples</code> folder. They can also be run via <code>zig build example-[name]</code>. | [
"https://github.com/Arnau478/hevi"
] |
https://avatars.githubusercontent.com/u/47033578?v=4 | Enkel-Editor | ramsyana/Enkel-Editor | 2024-12-22T06:46:18Z | Ultra-minimalist terminal text editor for IoT devices, built with Zig. Unix-like environments only. | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/ramsyana/Enkel-Editor/tags | MIT | [
"iot-application",
"text-editor",
"zig"
] | 10 | false | 2025-01-02T05:08:13Z | false | false | unknown | github | [] | Enkel
Enkel is an Ultra-Minimalist Terminal Editor designed specifically for IoT Devices. The name "Enkel" comes from the Swedish word meaning "simple" or "straightforward", reflecting the editor's core philosophy.
About
Enkel is purpose-built for working in minimalist environments, particularly IoT terminals where resources are limited. Its lightweight design and efficient implementation make it ideal for editing text files in constrained systems.
Features
<ul>
<li>Minimalist interface</li>
<li>Low resource usage</li>
<li>Terminal-based operation</li>
<li>Basic text search</li>
<li>Built with Zig programming language</li>
</ul>
Requirements
<ul>
<li>Unix-like environment (Linux, macOS, BSD)</li>
<li>Windows is not supported due to terminal dependencies</li>
</ul>
Usage
<code>bash
enkel <filename></code>
Key Bindings
<ul>
<li><code>Ctrl-S</code>: Save file</li>
<li><code>Ctrl-Q</code>: Quit</li>
<li><code>Ctrl-F</code>: Find text</li>
</ul>
Building from Source
Requires latest Zig compiler. Build using:
<code>bash
zig build-exe enkel.zig</code>
License
MIT License - Copyright (c) 2024 Ramsyana - ramsyana[at]mac[dot]com | [] |
https://avatars.githubusercontent.com/u/442455?v=4 | zig-platformer | dinau/zig-platformer | 2024-12-07T05:11:12Z | Writing a 2D Platform Game in Zig language with SDL | main | 0 | 1 | 1 | 1 | https://api.github.com/repos/dinau/zig-platformer/tags | MIT | [
"build",
"dev",
"devel",
"game",
"image",
"learning",
"macos",
"platformer",
"sdl-ttf",
"sdl2",
"sdl3",
"stb",
"stb-image",
"ttf",
"tutorial",
"zig"
] | 22,068 | false | 2025-04-16T12:15:58Z | false | false | unknown | github | [] |
<ul>
<li><a>Zig-Platformer</a></li>
<li><a>Prerequisites</a></li>
<li><a>Zig version</a></li>
<li><a>Support OS</a></li>
<li><a>Build and run</a></li>
<li><a>Key operation</a></li>
<li><a>Tutorial sources</a></li>
<li><a>SDL librarys</a></li>
<li><a>Other SDL game tutorial platfromer project</a></li>
<li><a>Other project</a></li>
</ul>
Zig-Platformer
Tutorial: Writing a 2D Platform Game in <a>Zig language</a> with SDL2 / SDL3 / SDL_ttf.
This repository has been inherited from
<a>Nim-Platformer</a>, <a>LuaJIT-Platformer</a> and <a>Nelua-Platformer</a> project.
- Document
English: https://hookrace.net/blog/writing-a-2d-platform-game-in-nim-with-sdl2/
Japanese: https://postd.cc/writing-a-2d-platform-game-in-nim-with-sdl2/
Skin database <a>https://ddnet.org/skins</a>
Prerequisites
Zig version
<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> Windows: <a>zig-0.14.0.zip</a> (2025/03)
<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> Linux Debian families: <a>zig-0.14.0.tar.xz</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> <a>zig-0.15.0-dev</a>
Support OS
| | Windows | Linux | MacOS |
| --- | :---: | :---: | :---: |
| SDL2 | v | v | v |
| SDL3 | v | - | - |
<ul>
<li>Windows10 or later </li>
<li>MSys2/MinGW basic commands (make, rm, cp, strip ...)</li>
<li>Linux: Debian families</li>
</ul>
<code>sh
$ sudo apt install xorg-dev libopengl-dev libgl1-mesa-dev
$ sudo apt install libsdl2-dev libsdl2-ttf-dev</code>
- MacOS: <a>P.R.</a>
Build and run
<code>sh
git clone https://github.com/dinau/zig-platformer
cd zig-platformer/tutorial</code>
For instance,
<code>sh
cd sdl2/part3
make run</code>
or
<code>sh
cd sdl2/part3
zig build --release=fast
cd zig-out/bin
platformer_part3.exe</code>
You can build <a>SDL3</a> tutorials same as SDL2.
Key operation
| Key | Function |
| :---: | :--- |
| Up,Space, J, K | Jump |
| Left, A, H | Left |
| Right, D, L | Right |
| R | Restart |
| Q | Quit, Esc |
Tutorial sources
| | Part1 | Part2 | Part3 (Showing item) | Part4 | Part5 (Moving item) | Part6 | Part7 | Part8(Almost completed) | Part9 |
|------|-----------------|-----------------|--------------------------|-----------------|-------------------------|-----------------|-----------------|-----------------------------|-------|
| SDL2 | <a>part1</a> | <a>part2</a> | <a>part3</a> | <a>part4</a> | <a>part5</a> | <a>part6</a> | <a>part7</a> | <a>part8</a> | - |
| SDL3 | <a>part1</a> | <a>part2</a> | <a>part3</a> | <a>part4</a> | <a>part5</a> | <a>part6</a> | <a>part7</a> | <a>part8</a> | - |
SDL librarys
https://github.com/libsdl-org/SDL/releases
Other SDL game tutorial platfromer project
| Language | | Project |
| -------------------: | :---: | :----------------------------------------------------------------: |
| <strong>Nim</strong> | Compiler | <a>Nim-Platformer</a> / <a>sdl3_nim</a> |
| <strong>LuaJIT</strong> | Script | <a>LuaJIT-Platformer</a> |
| <strong>Nelua</strong> | Compiler | <a>NeLua-Platformer</a> |
| <strong>Zig</strong> | Compiler | <a>Zig-Platformer</a> |
| <strong>C3</strong> | Compiler | <a>C3-Platformer</a> WIP |
| <strong>Ruby</strong> | Script | <a>Ruby-Platformer</a> WIP |
Other project
| Language | | Project |
| -------------------: | :---: | :----------------------------------------------------------------: |
| <strong>Nim</strong> | Compiler | <a>ImGuin</a>, <a>Nimgl_test</a>, <a>Nim_implot</a> |
| <strong>Lua</strong> | Script | <a>LuaJITImGui</a> |
| <strong>Zig</strong>, C lang. | Compiler | <a>Dear_Bindings_Build</a> |
| <strong>Zig</strong> | Compiler | <a>ImGuinZ</a> |
| <strong>NeLua</strong> | Compiler | <a>NeLuaImGui</a> |
| <strong>Python</strong> | Script | <a>DearPyGui for 32bit WindowsOS Binary</a> |
| <strong>Ruby</strong> | Script | <a>IgRuby-Examples</a> | [] |
https://avatars.githubusercontent.com/u/163546630?v=4 | url | zon-dev/url | 2024-08-14T07:52:18Z | Zig URL package is a URI extension package | main | 0 | 1 | 1 | 1 | https://api.github.com/repos/zon-dev/url/tags | - | [
"http",
"parser",
"url",
"url-parser",
"zig"
] | 16 | false | 2024-11-25T02:20:18Z | true | true | unknown | github | [] | url
The URL features extension package is written in Zig.
Usage.
Adding to build.zig
<code>zig
const url = b.dependency("url", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("url", url.module("url"));</code>
Import it in your code:
<code>zig
const URL = @import("url");</code>
```zig
var url = URL.init(.{});
const text = "http://example.com/path?query=1&query2=2";
const result = url.parse(text) catch return;
try testing.expectEqualStrings("http", result.scheme());
try testing.expectEqualStrings(
"example.com",
result.host(),
);
try testing.expectEqualStrings(
"/path",
result.path(),
);
try testing.expectEqualStrings("query=1&query2=2", result.query());
<code>var querymap = result.queryMap();
try testing.expectEqualStrings("1", querymap.get("query").?);
try testing.expectEqualStrings("2", querymap.get("query2").?);
if (querymap.get("query3") != null) {
try testing.expect(false);
}
</code>
``` | [
"https://github.com/allyourcodebase/boost-libraries-zig",
"https://github.com/zon-dev/oauth2",
"https://github.com/zon-dev/zinc"
] |
https://avatars.githubusercontent.com/u/22221987?v=4 | kryptograzig | eltNEG/kryptograzig | 2024-11-08T16:56:57Z | Simple public key cryptography algorithms implemented in zig | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/eltNEG/kryptograzig/tags | - | [
"cryptography",
"encryption-decryption",
"zig"
] | 10 | false | 2024-12-10T04:48:12Z | true | true | unknown | github | [] | Cryptography
Simple public key cryptography algorithms implemented in zig. For educational purposes only.
Algorithms
<ul>
<li>RSA</li>
<li>ElGamal</li>
</ul>
Installation
Fetch this dependency by running the following command in your project:
<code>bash
zig fetch --save git+https://github.com/eltNEG/kryptograzig#master</code>
Then add the following to your <code>build.zig</code> file:
```zig
b.installArtifact(exe); // this line should already be in your build.zig file
const cryptography = b.dependency("kryptograzig", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("kryptograzig", cryptography.module("kryptograzig"));
```
Usage
Import the library and use the functions as shown below:
```zig
const std = @import("std");
const kryptograzig = @import("kryptograzig");
pub fn main() !void {
std.debug.print("Hello, world!\n", .{});
const r = kryptograzig.gcd(u8, 10, 5);
std.debug.print("gcd(10, 5) = {}\n", .{r});
<code>const alloc = std.heap.page_allocator;
const factors = try kryptograzig.factorise(u128, alloc, 2 * 2 * 17 * 17 * 19 * 19 * 29 * 29 * 97 * 97 * 101 * 101 * 103 * 103);
defer alloc.free(factors);
std.debug.print("factors = {any}\n", .{factors});
</code>
}
```
Tests
<code>bash
zig build test</code>
Dependencies
<ul>
<li><a>Zig v0.13.0</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/20770505?v=4 | zdsa | Jafagervik/zdsa | 2025-01-29T19:25:21Z | Data structures in zig | main | 2 | 1 | 0 | 1 | https://api.github.com/repos/Jafagervik/zdsa/tags | MIT | [
"dsa",
"zig",
"zig-package"
] | 26 | false | 2025-02-02T15:48:50Z | true | true | 0.13.0 | github | [] | ZDSA - Zig Data structures and algorithms
Goal
To create a simple collection of DSAs for further use
All should be generic
Usage
```zig
const std = @import("std");
const zdsa = @import("zdsa");
const Stack = zdsa.Stack;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
<code>var stack = Stack(i32).init(allocator);
defer stack.deinit();
try stack.push(1);
try stack.push(2);
try stack.push(3);
const popped = try stack.pop();
stack.clear();
</code>
}
```
For more, see tests or example folders
Road to 1.0
<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> Stack
<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> Queue
<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> Priority Queue
<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> Dequeue
<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> Singly Linked 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> LRU Cache
<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> Doubly Linked List
<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> Binary Tree
Install (Per 0.14 beta)
Run this command in the parent directory of your project
<code>sh
zig fetch --save https://github.com/Jafagervik/zdsa/tarball/v0.6.0</code>
Or alternatively use master or another version
Then add these lines to build.zig before b.installArtifact(exe)
```zig
const zdsa = b.dependency("zdsa", .{});
exe.root_module.addImport("zdsa", zdsa.module("zdsa"));
``` | [] |
https://avatars.githubusercontent.com/u/4097471?v=4 | exercism | pythoninthegrass/exercism | 2025-01-14T23:54:06Z | My exercisms 👻 | main | 1 | 1 | 0 | 1 | https://api.github.com/repos/pythoninthegrass/exercism/tags | - | [
"exercism",
"zig"
] | 5 | false | 2025-01-15T02:52:06Z | false | false | unknown | github | [] | exercism | [] |
https://avatars.githubusercontent.com/u/13835680?v=4 | fn | reykjalin/fn | 2025-02-02T06:10:24Z | Editor backend and TUI editor written in Zig | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/reykjalin/fn/tags | MIT | [
"editor",
"tui",
"zig",
"zig-package"
] | 264 | false | 2025-05-21T04:29:56Z | true | true | 0.14.0 | github | [] | ❄️ libfn
<a></a> <a></a>
If you're looking for the editor, you can find that in the <a>./tui</a> folder.
<code>libfn</code> is an editor engine that I'm working on for fun.
It's currently used to power my toy editor project <a>Fönn</a>.
If you're working on a Zig project and want to play around with the library itself you can do so by
installing fun with <code>zig fetch --save git+https://git.sr.ht/~reykjalin/fn</code>.
You can also try my toy editor by building the editor from the <a>./tui</a> folder.
My primary goal is to eventually have a modern, capable TUI code editor that's powered by a reusable
editing engine. The engine itself will eventually be exposed as a static library with a C API, but
made in Zig. If I can get this project that far that is :)
A secondary goal is for <code>fn</code> to eventually have both a GUI and a TUI powered by this same text
editing "engine".
libfn build instructions
```sh
Make sure libfn builds.
zig build check
Run tests.
zig build test
```
Usage
<code>sh
$ zig fetch --save git+https://git.sr.ht/~reykjalin/fn</code>
Then, in your <code>build.zig</code>:
```zig
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const libfn_dep = b.dependency("libfn", .{ .optimize = optimize, .target = target });
const exe = b.addExecutable(.{
.name = "example",
.root_source_file = root_source_file,
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("libfn", libfn_dep.module("libfn"));
b.installArtifact(exe);
```
and then you can import it in your code:
```zig
const libfn = @import("libfn");
// ...
const editor: libfn.Editor = .init(allocator);
``` | [] |
https://avatars.githubusercontent.com/u/2442833?v=4 | zig-collections | insolor/zig-collections | 2024-12-19T17:00:15Z | Implementation of some useful data structures in Zig. Inspired by Python's collections module. | main | 1 | 1 | 0 | 1 | https://api.github.com/repos/insolor/zig-collections/tags | MIT | [
"zig",
"zig-library",
"ziglang"
] | 26 | false | 2025-03-05T20:15:26Z | true | true | unknown | github | [] | Zig Collections
<a></a>
Implementation of some useful data structures in Zig. Inspired by Python's <code>collections</code> module.
Installation
<ol>
<li>
In the root directory of your project, run the following command to add <code>zig_collections</code> to your <code>build.zig.zon</code> file:
<code>bash
zig fetch --save https://github.com/insolor/zig-collections/archive/refs/heads/main.zip</code>
Replace <code>main</code> in the URL with the tag you want to use.
</li>
<li>
Add zig_collections as a dependency module in your <code>build.zig</code> file, example:
<code>zig
const zig_collections = b.dependency("zig_collections", .{});
exe.root_module.addImport("zig_collections", zig_collections.module("zig_collections"));</code>
</li>
</ol>
After that, you'll be able to import <code>zig_collections</code> namespace from your code:
<code>zig
const zig_collections = @import("zig_collections");
const Counter = zig_collections.Counter;
const DefaultHashMap = zig_collections.DefaultHashMap;</code>
Usage examples
Implemented so far:
<ul>
<li>✅ <code>Counter</code>:</li>
<li>a minimal functionality is implemented: increment of a value of a key, counting of duplicate values from a slice or an iterator</li>
<li>✅ <code>defaultdict</code> (<code>DefaultHashMap</code>)</li>
</ul>
<code>Counter</code> usage examples:
```zig
test "test add from slice" {
var counter = Counter(u8).init(allocator);
defer counter.deinit();
<code>const array = [_]u8{ 1, 2, 2, 3, 3, 3 };
try counter.addFromSlice(array[0..]);
try expectEqual(1, counter.get(1));
try expectEqual(2, counter.get(2));
try expectEqual(3, counter.get(3));
</code>
}
test "test add from iterator" {
var counter = Counter([]const u8).init(allocator);
defer counter.deinit();
<code>const text = "alice bob alice";
var iterator = std.mem.splitSequence(u8, text, " ");
try counter.addFromIterator(&iterator);
try expectEqual(2, counter.get("alice"));
try expectEqual(1, counter.get("bob"));
</code>
}
```
<code>DefaultHashMap</code> example:
```zig
test "test defaulthashmap list" {
const Factory = struct {
allocator: std.mem.Allocator,
<code> fn produce(self: @This()) ArrayList(u8) {
return ArrayList(u8).init(self.allocator);
}
};
var map = collections.DefaultHashMap(
u8,
ArrayList(u8),
Factory{ .allocator = allocator },
Factory.produce,
).init(allocator);
defer {
map.deinitValues();
map.deinit();
}
const array = [_]u8{ 3, 3, 1, 2, 3, 2 };
for (array, 0..) |item, i| {
map.get(item).append(@intCast(i)) catch unreachable;
}
try expectEqualDeep(&[_]u8{2}, map.get(1).items);
try expectEqualDeep(&[_]u8{ 3, 5 }, map.get(2).items);
try expectEqualDeep(&[_]u8{ 0, 1, 4 }, map.get(3).items);
</code>
}
``` | [] |
https://avatars.githubusercontent.com/u/121654029?v=4 | wasmex | EdamAme-x/wasmex | 2024-10-24T06:53:58Z | Run wasm in multiple environments with the same code (Browser, Node.js, Deno, Bun, etc.) | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/EdamAme-x/wasmex/tags | MIT | [
"bun",
"deno",
"go",
"javascript",
"jsr",
"nodejs",
"rust",
"typescript",
"wasm",
"zig"
] | 5 | false | 2024-10-25T00:57:15Z | false | false | unknown | github | [] | wasmex
Run wasm in multiple environments with the same code (Browser, Node.js, Deno,
Bun, etc.)
<code>bash
npx jsr add jsr:@evex/wasmex
bunx --bun jsr add jsr:@evex/wasmex
deno add jsr:@evex/wasmex</code>
```ts
import { Wasmex } from "@evex/wasmex";
// base64 or unit8array
const wasmSource = ...;
const wasm = await Wasmex(wasmSource); // or await Wasmex(wasmSource, importObject)
// 3
console.log(
wasm.instance.exports.addOne(2),
);
```
by <a>@EdamAme-x</a> & <a>@evex-dev</a> | [] |
https://avatars.githubusercontent.com/u/194645670?v=4 | JoltPhysics | InteractiveBin/JoltPhysics | 2025-01-15T23:26:38Z | A multi core friendly rigid body physics and collision detection library. Written in C++. Suitable for games and VR applications. Used by Horizon Forbidden West. | master | 0 | 1 | 0 | 1 | https://api.github.com/repos/InteractiveBin/JoltPhysics/tags | MIT | [
"zig",
"zig-package"
] | 22,187 | true | 2025-01-20T08:45:09Z | true | true | unknown | github | [] | <a></a>
<a></a>
<a></a>
<a></a>
<a></a>
<a></a>
Jolt Physics
A multi core friendly rigid body physics and collision detection library. Suitable for games and VR applications. Used by Horizon Forbidden West.
<a></a>
|<a></a>|
|:-|
|<em>A YouTube video showing a ragdoll pile simulated with Jolt Physics.</em>|
For more demos and <a>videos</a> go to the <a>Samples</a> section.
Design considerations
Why create yet another physics engine? Firstly, it has been a personal learning project. Secondly, I wanted to address some issues that I had with existing physics engines:
<ul>
<li>Games do more than simulating physics. These things happen across multiple threads. We emphasize on concurrently accessing physics data outside of the main simulation update:<ul>
<li>Sections of the simulation can be loaded / unloaded in the background. We prepare a batch of physics bodies on a background thread without locking or affecting the simulation. We insert the batch into the simulation with a minimal impact on performance.</li>
<li>Collision queries can run parallel to adding / removing or updating a body. If a change to a body happened on the same thread, the change will be immediately visible. If the change happened on another thread, the query will see a consistent before or after state. An alternative would be to have a read and write version of the world. This prevents changes from being visible immediately, so we avoid this.</li>
<li>Collision queries can run parallel to the main physics simulation. We do a coarse check (broad phase query) before the simulation step and do fine checks (narrow phase query) in the background. This way, long running processes (like navigation mesh generation) can be spread out across multiple frames.</li>
</ul>
</li>
<li>Accidental wake up of bodies cause performance problems when loading / unloading content. Therefore, bodies will not automatically wake up when created. Neighboring bodies will not be woken up when bodies are removed. This can be triggered manually if desired.</li>
<li>The simulation runs deterministically. You can replicate a simulation to a remote client by merely replicating the inputs to the simulation. Read the <a>Deterministic Simulation</a> section to understand the limits.</li>
<li>We try to simulate behavior of rigid bodies in the real world but make approximations. Therefore, this library should mainly be used for games or VR simulations.</li>
</ul>
Features
<ul>
<li>Simulation of rigid bodies of various shapes using continuous collision detection:<ul>
<li>Sphere</li>
<li>Box</li>
<li>Capsule</li>
<li>Tapered-capsule</li>
<li>Cylinder</li>
<li>Tapered-cylinder</li>
<li>Convex hull</li>
<li>Plane</li>
<li>Compound</li>
<li>Mesh (triangle)</li>
<li>Terrain (height field)</li>
</ul>
</li>
<li>Simulation of constraints between bodies:<ul>
<li>Fixed</li>
<li>Point</li>
<li>Distance (including springs)</li>
<li>Hinge</li>
<li>Slider (also called prismatic)</li>
<li>Cone</li>
<li>Rack and pinion</li>
<li>Gear</li>
<li>Pulley</li>
<li>Smooth spline paths</li>
<li>Swing-twist (for humanoid shoulders)</li>
<li>6 DOF</li>
</ul>
</li>
<li>Motors to drive the constraints.</li>
<li>Collision detection:<ul>
<li>Casting rays.</li>
<li>Testing shapes vs shapes.</li>
<li>Casting a shape vs another shape.</li>
<li>Broadphase only tests to quickly determine which objects may intersect.</li>
</ul>
</li>
<li>Sensors (trigger volumes).</li>
<li>Animated ragdolls:<ul>
<li>Hard keying (kinematic only rigid bodies).</li>
<li>Soft keying (setting velocities on dynamic rigid bodies).</li>
<li>Driving constraint motors to an animated pose.</li>
<li>Mapping a high detail (animation) skeleton onto a low detail (ragdoll) skeleton and vice versa.</li>
</ul>
</li>
<li>Game character simulation (capsule)<ul>
<li>Rigid body character. Moves during the physics simulation. Cheapest option and most accurate collision response between character and dynamic bodies.</li>
<li>Virtual character. Does not have a rigid body in the simulation but simulates one using collision checks. Updated outside of the physics update for more control. Less accurate interaction with dynamic bodies.</li>
</ul>
</li>
<li>Vehicles<ul>
<li>Wheeled vehicles.</li>
<li>Tracked vehicles.</li>
<li>Motorcycles.</li>
</ul>
</li>
<li>Soft body simulation (e.g. a soft ball or piece of cloth).<ul>
<li>Edge constraints.</li>
<li>Dihedral bend constraints.</li>
<li>Tetrahedron volume constraints.</li>
<li>Long range attachment constraints (also called tethers).</li>
<li>Limiting the simulation to stay within a certain range of a skinned vertex.</li>
<li>Internal pressure.</li>
<li>Collision with simulated rigid bodies.</li>
<li>Collision tests against soft bodies.</li>
</ul>
</li>
<li>Water buoyancy calculations.</li>
<li>An optional double precision mode that allows large worlds.</li>
</ul>
Supported platforms
<ul>
<li>Windows (Desktop or UWP) x86/x64/ARM32/ARM64</li>
<li>Linux (tested on Ubuntu) x86/x64/ARM32/ARM64/RISC-V64/LoongArch64/PowerPC64LE</li>
<li>FreeBSD</li>
<li>Android x86/x64/ARM32/ARM64</li>
<li>Platform Blue (a popular game console) x64</li>
<li>macOS x64/ARM64</li>
<li>iOS x64/ARM64</li>
<li>MSYS2 MinGW64</li>
<li>WebAssembly, see <a>this</a> separate project.</li>
</ul>
Required CPU features
<ul>
<li>On x86/x64 the minimal requirements are SSE2. The library can be compiled using SSE4.1, SSE4.2, AVX, AVX2, or AVX512.</li>
<li>On ARM64 the library uses NEON and FP16. On ARM32 it can be compiled without any special CPU instructions.</li>
</ul>
Documentation
To learn more about Jolt go to the latest <a>Architecture and API documentation</a>. Documentation for <a>a specific release is also available</a>.
To get started, look at the <a>HelloWorld</a> example. A <a>HelloWorld example using CMake FetchContent</a> is also available to show how you can integrate Jolt Physics in a CMake project.
Some algorithms used by Jolt are described in detail in my GDC 2022 talk: Architecting Jolt Physics for 'Horizon Forbidden West' (<a>slides</a>, <a>slides with speaker notes</a>, <a>video</a>).
Compiling
<ul>
<li>Compiles with Visual Studio 2019+, Clang 10+ or GCC 9+.</li>
<li>Uses C++ 17.</li>
<li>Depends only on the standard template library.</li>
<li>Doesn't use RTTI.</li>
<li>Doesn't use exceptions.</li>
</ul>
If you want to run on Platform Blue you'll need to provide your own build environment and PlatformBlue.h due to NDA requirements. This file is available on the Platform Blue developer forum.
For build instructions go to the <a>Build</a> section. When upgrading from an older version of the library go to the <a>Release Notes</a> or <a>API Changes</a> sections.
Performance
If you're interested in how Jolt scales with multiple CPUs and compares to other physics engines, take a look at <a>this document</a>.
Folder structure
<ul>
<li>Assets - This folder contains assets used by the TestFramework, Samples and JoltViewer.</li>
<li>Build - Contains everything needed to build the library, see the <a>Build</a> section.</li>
<li>Docs - Contains documentation for the library.</li>
<li>HelloWorld - A simple application demonstrating how to use the Jolt Physics library.</li>
<li>Jolt - All source code for the library is in this folder.</li>
<li>JoltViewer - It is possible to record the output of the physics engine using the DebugRendererRecorder class (a .jor file), this folder contains the source code to an application that can visualize a recording. This is useful for e.g. visualizing the output of the PerformanceTest from different platforms. Currently available on Windows, macOS and Linux.</li>
<li>PerformanceTest - Contains a simple application that runs a <a>performance test</a> and collects timing information.</li>
<li>Samples - This contains the sample application, see the <a>Samples</a> section. Currently available on Windows, macOS and Linux.</li>
<li>TestFramework - A rendering framework to visualize the results of the physics engine. Used by Samples and JoltViewer. Currently available on Windows, macOS and Linux.</li>
<li>UnitTests - A set of unit tests to validate the behavior of the physics engine.</li>
</ul>
Bindings for other languages
<ul>
<li>C <a>here</a> and <a>here</a></li>
<li><a>C#</a></li>
<li><a>Java</a></li>
<li><a>JavaScript</a></li>
<li><a>Zig</a></li>
</ul>
Integrations in other engines
<ul>
<li><a>Godot</a></li>
<li><a>Source Engine</a></li>
</ul>
See <a>a list of projects that use Jolt Physics here</a>.
License
The project is distributed under the <a>MIT license</a>.
Contributions
All contributions are welcome! If you intend to make larger changes, please discuss first in the GitHub Discussion section. For non-trivial changes, we require that you agree to a <a>Contributor Agreement</a>. When you create a PR, <a>CLA assistant</a> will prompt you to sign it.
Note that all PRs will be squashed before merging, so there's no need to force-push to git to keep the history clean. | [] |
https://avatars.githubusercontent.com/u/46907231?v=4 | EmbedFile.zig | robbielyman/EmbedFile.zig | 2024-12-31T19:43:21Z | an extension to the Zig build system to programmatically collect assets | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/robbielyman/EmbedFile.zig/tags | MIT | [
"zig",
"zig-build",
"zig-package"
] | 17 | false | 2025-03-28T21:30:59Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/24697112?v=4 | example-zig | goreleaser/example-zig | 2024-11-24T20:31:00Z | Example Zig project using GoReleaser | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/goreleaser/example-zig/tags | - | [
"goreleaser",
"zig",
"ziglang"
] | 44 | false | 2025-05-15T09:07:51Z | true | true | 0.14.0 | github | [] | GoReleaser Example using Zig
This uses GoReleaser v2.5+ to build and release a Zig project with GoReleaser. | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.