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/146390816?v=4 | zstd | allyourcodebase/zstd | 2024-07-25T17:20:45Z | zstd ported to the zig build system | master | 0 | 7 | 1 | 7 | https://api.github.com/repos/allyourcodebase/zstd/tags | MIT | [
"zig",
"zig-package"
] | 17 | false | 2025-05-15T11:58:03Z | true | true | 0.14.0 | github | [
{
"commit": "master",
"name": "zstd",
"tar_url": "https://github.com/facebook/zstd/archive/master.tar.gz",
"type": "remote",
"url": "https://github.com/facebook/zstd"
}
] | <a></a>
zstd
This is <a>zstd</a>, packaged for <a>Zig</a>.
Installation
First, update your <code>build.zig.zon</code>:
```
Initialize a <code>zig build</code> project if you haven't already
zig init
zig fetch --save git+https://github.com/allyourcodebase/zstd.git#1.5.7
```
You can then import <code>zstd</code> in your <code>build.zig</code> with:
<code>zig
const zstd_dependency = b.dependency("zstd", .{
.target = target,
.optimize = optimize,
});
your_exe.linkLibrary(zstd_dependency.artifact("zstd"));</code> | [
"https://github.com/Scythe-Technology/Zune",
"https://github.com/Syndica/zstd.zig",
"https://github.com/allyourcodebase/binutils",
"https://github.com/allyourcodebase/curl",
"https://github.com/allyourcodebase/elfutils",
"https://github.com/allyourcodebase/libpq",
"https://github.com/allyourcodebase/zst... |
https://avatars.githubusercontent.com/u/161890530?v=4 | css-parser | soheil-01/css-parser | 2024-03-10T13:12:04Z | A very incomplete CSS parser in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/soheil-01/css-parser/tags | - | [
"css",
"css-parser",
"zig"
] | 3 | false | 2024-03-10T13:13:59Z | true | true | unknown | github | [] | CSS Parser
My Third project while learning Zig, a very incomplete CSS parser based on <a>Metaprogramming in Zig and parsing CSS</a>.
Run
<code>bash
zig build run -- tests/basic.css</code> | [] |
https://avatars.githubusercontent.com/u/161890530?v=4 | bitzig | soheil-01/bitzig | 2024-05-09T14:07:05Z | Bitzig is a Zig port of the "Programming Bitcoin" book code. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/soheil-01/bitzig/tags | - | [
"bitcoin",
"zig"
] | 170 | false | 2024-07-09T11:37:05Z | true | true | unknown | github | [
{
"commit": "11946ff9d2f159cb06aaf423ce13bd8aa2a481e7",
"name": "json",
"tar_url": "https://github.com/getty-zig/json/archive/11946ff9d2f159cb06aaf423ce13bd8aa2a481e7.tar.gz",
"type": "remote",
"url": "https://github.com/getty-zig/json"
},
{
"commit": "master",
"name": "network",
... | Bitzig
Bitzig is a Zig port of the "Programming Bitcoin" book code by Jimmy Song. I created this project to learn both Bitcoin internals and the Zig programming language. | [] |
https://avatars.githubusercontent.com/u/109492796?v=4 | zig-todo-web-app | zigcc/zig-todo-web-app | 2024-07-19T06:03:04Z | A Single-page TODO app in Zig! | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/zigcc/zig-todo-web-app/tags | - | [
"zig",
"zig-library",
"zig-package",
"zig-programming-language",
"ziglang"
] | 47 | false | 2024-07-25T15:12:30Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/50830044?v=4 | zpg | Viocalpan/zpg | 2024-02-21T05:43:52Z | zpg tiny native postgresql driver by zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Viocalpan/zpg/tags | - | [
"postgres",
"postgresql",
"postgresql-driver",
"zig"
] | 29 | false | 2024-02-21T06:23:20Z | false | false | unknown | github | [] | zpg
zpg tiny native postgresql driver by zig
compile under zig 0.11 and 0.12
come soon connect pool
example
```
const std = @import("std");
const zpg = @import("zpg.zig");
const stdout = std.io.getStdOut().writer();
pub fn main() !void {
// const conninfo: zpg.ConnInfo = .{host="192.168.56.51",.port=5432,.user="test",.database="test",.password="1qaz.2",.appname="zpg"};
const conninfo = zpg.ConnInfo.parse("test:1qaz.2@127.0.0.1/");
try stdout.print("conninfo = {any}\n", .{conninfo});
<code>var conn = try zpg.PgDb.connect(conninfo);
defer conn.deinit();
try stdout.print("conn.id = {}\n", .{conn.backend});
const value = conn.parameter.get("server_version");
try stdout.print("params = {s},count={d}\n", .{ value.?, conn.parameter.count() });
try stdout.print("\r\n", .{});
var iterator = conn.parameter.iterator();
while (iterator.next()) |item| {
try stdout.print("{s} = {s}\r\n", .{ item.key_ptr.*, item.value_ptr.* });
}
var cur = conn.cursor();
defer cur.deinit();
try cur.begin();
cur.query("select * from handlers limit 5;") catch |err| { //'abcd', 5, 2>1;
try cur.rollback();
try stdout.print("\n catch: code = {s}, messages = {s}\n", .{ cur.LastMsg.code, cur.LastMsg.message });
try stdout.print("\n error = {}\n", .{err});
return err;
};
try cur.commit();
try stdout.print("\n success: code = {s}, messages = {s}\n\r\n", .{ cur.LastMsg.code, cur.LastMsg.message });
for (cur.description) |*col| {
try stdout.print(" fields = {any}\n", .{col});
}
try stdout.print("\n", .{});
for (cur.rows) |*row| {
try stdout.print(" data: {any}\n", .{row});
}
try stdout.print(" description = {any}, rows = {d}\n\n", .{ cur.description.len, cur.rowcount });
</code>
}
``` | [] |
https://avatars.githubusercontent.com/u/25056868?v=4 | pso-rust-vs-zig | ogau/pso-rust-vs-zig | 2024-02-18T08:41:00Z | PSO Rust/Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/ogau/pso-rust-vs-zig/tags | - | [
"particle-swarm-optimization",
"pso",
"rust",
"zig"
] | 16 | false | 2024-02-18T15:50:55Z | false | false | unknown | github | [] | Comparison of PSO implementations in Rust and Zig
This project contains two implementations of the Particle Swarm Optimization (PSO) algorithm in Rust and Zig programming languages.
The goal of the project is to compare the experience of developing the same algorithm in two different languages, as well as test the performance of the implementations.
Running
To run the Rust version:
<code>bash
$ cd rust
$ cargo r -r</code>
To run the Zig version:
```bash
$ cd zig
$ zig build run
````
Brief overview of PSO algorithm
The Particle Swarm Optimization (PSO) algorithm is an optimization algorithm inspired by the social behavior of bird flocks or insect swarms. In PSO there is a swarm of particles, each of which represents a possible solution to an optimization problem. The particles fly through the solution space, communicating their best found positions to each other. Over time the whole swarm converges to the optimal solution.
In this project PSO is used to optimize a simple test function. | [] |
https://avatars.githubusercontent.com/u/3477132?v=4 | zag | anthonycorletti/zag | 2024-02-28T03:50:34Z | A fast http web framework written in Zig ⚡️🦖 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/anthonycorletti/zag/tags | - | [
"http",
"webframework",
"zag",
"zig"
] | 3 | false | 2024-02-28T03:51:55Z | true | false | unknown | github | [] | zag
A fast http web framework written in Zig ⚡️🦖
This is just a fun project and not meant to be taken seriously or used for production purposes. Lots of cool ideas for this one.
In the future, I might spend more time making it an actual framework. Once async sticks around zig's stdlib for a bit, zig gets closer to a 1.0 release, and I have more time to spend on it. | [] |
https://avatars.githubusercontent.com/u/89275?v=4 | using-zig-with-go-libraries | dgv/using-zig-with-go-libraries | 2024-04-12T01:32:41Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/dgv/using-zig-with-go-libraries/tags | - | [
"c",
"go",
"zig"
] | 4 | false | 2024-05-05T21:14:20Z | false | false | unknown | github | [] | using-zig-with-go-libraries
just simple example using <a>cgo</a> to export headers. better example at <a>go-cshared-examples</a>. | [] |
https://avatars.githubusercontent.com/u/22410262?v=4 | Arkanoid | Rajaikumar-iOSDev/Arkanoid | 2024-06-17T07:08:07Z | Arkanoid game built with Raylib in Zig lang | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Rajaikumar-iOSDev/Arkanoid/tags | - | [
"arkanoid",
"raylib",
"zig",
"ziglang"
] | 18,332 | false | 2024-06-24T12:54:44Z | true | true | unknown | github | [
{
"commit": "b03c8ba945a06ed1ec3d6ed7c3185e1264909323.tar.gz",
"name": "raylib",
"tar_url": "https://github.com/raysan5/raylib/archive/b03c8ba945a06ed1ec3d6ed7c3185e1264909323.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/raysan5/raylib"
}
] | 🪩Arkanoid
Arkanoid game built with Raylib based on the Ankanoid on Raylib repo(https://github.com/raysan5/raylib-games/blob/master/classics/src/arkanoid.c).
🏃🏼♂️How to run
Clone the repo ->
cd Arkanoid
-> zig build run
🙏Thanks
zigraylib(https://github.com/SimonLSchlee/zigraylib)
📝license
public domain or MIT | [] |
https://avatars.githubusercontent.com/u/148223003?v=4 | pe-ziglang | pe-solutions/pe-ziglang | 2024-02-25T18:12:41Z | Project Euler solutions in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/pe-solutions/pe-ziglang/tags | - | [
"zig",
"ziglang"
] | 24 | false | 2024-08-20T07:25:51Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/28787?v=4 | learning-zig-karlseguin | rofrol/learning-zig-karlseguin | 2024-05-07T13:53:36Z | Polish translation of "Learning Zig" blog series by Karl Seguin | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/rofrol/learning-zig-karlseguin/tags | CC-BY-SA-4.0 | [
"zig"
] | 239 | true | 2024-08-08T20:19:45Z | false | false | unknown | github | [] | Nauka Ziga
To repozytorium zawiera pliki tłumaczenia książki "Nauka Ziga", napisanej przez <a>Karla Seguina</a>
<blockquote>
This repository contains the translation files of the book 'Learning Zig," written by Karl Seguin
</blockquote>
Wersja oryginalna
Seria publikacji "Nauka Ziga" została pierwotnie stworzona przez Karla Seguina i zaprezentowana na jego <a>osobistym blogu</a>.
Publikacje te wyróżniają się wyjątkowym podejściem dydaktycznym, stanowiąc cenne źródło wiedzy zarówno dla początkujących, stawiających pierwsze kroki w Zig, jak i dla tych, którzy chcą utrwalić podstawowe pojęcia używane na co dzień. Jakość treści oferowanych przez autora nie tylko umożliwia sekwencyjne czytanie w celu pełnego zrozumienia, ale także pozwala na wykorzystanie ich jako praktycznego odniesienia, gdy zagłębiamy się w bardziej zaawansowaną wiedzę.
Niektóre z innych znanych publikacji autora są wymienione poniżej:
<ul>
<li><a>The Little Go Book</a></li>
<li>The Little Redis Book](https://github.com/karlseguin/the-little-redis-book)</li>
<li><a>The Little MongoDB Book</a></li>
</ul>
Wkład
Tłumaczenie wykonane w tej pracy jest całkowicie bezpłatne. Dlatego też, jeśli zauważysz jakiekolwiek błędy ortograficzne, niejasne wyjaśnienia lub źle przetłumaczone koncepcje programistyczne, zapraszam do wniesienia wkładu poprzez napisanie PR i pomoc w ulepszeniu tego tłumaczenia materiału o Zigu na język polski.
Głównym celem tego tłumaczenia jest zapewnienie wysokiej jakości treści w języku polskim dla społeczności Ziga, a przede wszystkim pomoc tym, którzy zaczynają w rozległym świecie programowania (głównie na poziomie systemów).
Licencja
<a>CC-BY-SA-4.0</a> | [] |
https://avatars.githubusercontent.com/u/166154118?v=4 | zig_pigpiod | Curuvar-Ltd/zig_pigpiod | 2024-04-05T16:23:40Z | Userspace Raspberry Pi GPIO for ZIG via the pigpiod daemon. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Curuvar-Ltd/zig_pigpiod/tags | MIT | [
"gpio",
"gpio-pins",
"gpiod",
"raspberry-pi",
"zig"
] | 91 | false | 2025-03-04T15:58:46Z | true | true | 0.13.0 | github | [] | zig_pigpiod
Zig_pigpiod is a Zig module that communicates with the Raspberry Pi's pigpiod
GPIO daemon.
Zig_pigpiod provides most of the capabilities of C based pigpiod_if2
interface, but is written entirely in zig. The missing capabilities are
functions that pigpiod implements directly on the client, and that Zig
provides native function for.
Currently working:
<ul>
<li>Pin set value, direction, pull up and down</li>
<li>Pin block get, set and clear</li>
<li>Pin level change callback</li>
<li>Event callback</li>
<li>SPI master communications</li>
<li>Get tick</li>
<li>Get hardware version</li>
<li>Get pigpiod version</li>
</ul>
Present but not well tested
<ul>
<li>Pin PWM functions</li>
<li>Pin Servo functions</li>
<li>Pin glitch and noise filters</li>
<li>I2C master communications</li>
<li>Serial interface (hardware and bit-bang)</li>
<li>Scripting commands</li>
<li>File operation commands</li>
</ul>
If the current version does not support something you need, send a message via
<a>the Curuvar contact page</a>.
A note on formatting
I've been programming computers since 1968. In that time I have developed
a coding style that I am comfortable with. I have nothing against others
choosing a different style, just don't push it on me.
If you with to use this code in your own project, the license allows you to
reformat it and you may do so with my blessing. I have no desire to force
my style on you. However, if you wish to contribute to this project, please
respect the style that I have chosen:
<ul>
<li>Allman style braces.</li>
<li>Single space inside parentheses for function definition and calls.</li>
<li>When breaking long lines at a binary operator, the operator goes on
the start of the new line.</li>
<li>Align parts of similar statements vertically.</li>
<li>Function parameters (except for self) start with:</li>
<li>in_ -- data passed into a function</li>
<li>out_ -- data passed out from a function</li>
<li>io_ -- data passed into a function and modifications passed out</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/2251232?v=4 | zig-game | Chukobyte/zig-game | 2024-04-29T04:15:56Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Chukobyte/zig-game/tags | - | [
"game",
"zig"
] | 9,690 | false | 2024-06-16T03:06:59Z | true | true | 0.13.0 | github | [
{
"commit": "refs",
"name": "zeika",
"tar_url": "https://github.com/Chukobyte/zeika/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/Chukobyte/zeika"
}
] | Zig Game
A game prototype made with zig. | [] |
https://avatars.githubusercontent.com/u/22221987?v=4 | dummy-ethers-zig | eltNEG/dummy-ethers-zig | 2024-05-09T12:04:38Z | Zig comptime implementation of Ether js contract initialization style | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/eltNEG/dummy-ethers-zig/tags | - | [
"comptime",
"ethers",
"ethersjs",
"solidity",
"zig"
] | 3 | false | 2024-05-09T12:38:55Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/68867487?v=4 | lexicon-ls | brymer-meneses/lexicon-ls | 2024-06-22T21:23:27Z | [WIP] LSP Server/Linter for Checking Grammar | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/brymer-meneses/lexicon-ls/tags | BSD-3-Clause | [
"languagetool",
"lsp",
"zig"
] | 71 | false | 2024-07-15T17:03:07Z | true | true | unknown | github | [] | Lexicon
Lexicon checks for grammatical errors in your code comments. It levergages
<a>LanguageTool</a> which is an
open-source grammar checker tool.
State
Currently a work in progress. | [] |
https://avatars.githubusercontent.com/u/79535237?v=4 | ztex | SafeMemoryZone/ztex | 2024-06-12T06:08:57Z | Very simple nano-like text editor in zig. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/SafeMemoryZone/ztex/tags | MIT | [
"text-editor",
"zig"
] | 8 | false | 2024-07-15T10:26:38Z | true | false | unknown | github | [] | ztex
A very simple nano-like text editor in zig.
Quickstart
<ol>
<li>
Make sure you have the <a>zig compiler</a> and <a>ncurses</a> installed.
</li>
<li>
Compile and run the project with (pass any arguments to the text editor after '--'):
</li>
</ol>
<code>console
$ zig build run -- ...</code>
Usage
<code>console
$ ./ztex [<file_to_edit>]</code>
Controls
<ul>
<li>Use the arrow keys to move</li>
<li>Use <code>ctrl + q</code> to quit the editor (a prompt will appear asking for the filename - press <code>ctrl + q</code> again to quit)</li>
</ul>
Note
This project is unfinished and has currently not support for windows. Keep your expectations low! | [] |
https://avatars.githubusercontent.com/u/120808662?v=4 | dough | tulilirockz/dough | 2024-07-27T20:41:00Z | Declarative disk partitioning utility based on libfdisk | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/tulilirockz/dough/tags | NOASSERTION | [
"disk-partition",
"fdisk",
"linux",
"zig"
] | 26 | false | 2024-08-03T23:46:15Z | true | true | 0.13.0 | github | [
{
"commit": "55444b9d1a3688b11c47adeef750e7c80a03bae3",
"name": "yazap",
"tar_url": "https://github.com/prajwalch/yazap/archive/55444b9d1a3688b11c47adeef750e7c80a03bae3.tar.gz",
"type": "remote",
"url": "https://github.com/prajwalch/yazap"
},
{
"commit": "beddd5da24de91d430ca7028b00986f7... | Dough
Disko but cooler
Uses YAML for configuration instead of that
<code>bash
dough plan ./declaration.yaml /dev/device or FILE # Shows what will be changed if applied
dough apply ./declaration.yaml /dev/device # Applies formatting to the selected device + works with raw files</code> | [] |
https://avatars.githubusercontent.com/u/88278380?v=4 | QuanCompZ | Yggdrasill501/QuanCompZ | 2024-03-13T10:02:10Z | A compiler for quantum computers | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Yggdrasill501/QuanCompZ/tags | - | [
"c",
"compiler",
"quantum-computing",
"zig"
] | 5 | false | 2024-03-13T12:09:03Z | true | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/170934839?v=4 | zig-utilities | Ang3lERR404/zig-utilities | 2024-06-03T17:01:27Z | Utilities for zig, in a smol, convenient file | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Ang3lERR404/zig-utilities/tags | GPL-3.0 | [
"utilities",
"zig",
"zig-package",
"ziglang"
] | 14 | false | 2024-06-11T20:08:52Z | false | false | unknown | github | [] | Utils.zig
A smol utility library before skill issues were found :D
<strong><em>IN THE ENTIRE STANDARD LIBRARY FOR ZIG</em></strong>
=~=
<blockquote>
W h y\
a r e\
y o u\
l i k e\
t h i s
</blockquote> | [] |
https://avatars.githubusercontent.com/u/36218264?v=4 | monkey_lang | Peter-Roh/monkey_lang | 2024-07-12T13:39:24Z | Learning how to make an interpreter in zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Peter-Roh/monkey_lang/tags | - | [
"interpreter",
"thorstenball",
"zig"
] | 5 | false | 2024-07-12T13:57:34Z | true | true | unknown | github | [] | monkey lang
Learning how to make an interpreter in zig.
Reference
<strong>Writing an Interpreter in Go</strong> by Thorsten Ball | [] |
https://avatars.githubusercontent.com/u/85967099?v=4 | hello | eugenesang/hello | 2024-04-03T19:15:24Z | Hello world in various languages | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/eugenesang/hello/tags | - | [
"c",
"cpp",
"csharp",
"java",
"javascript",
"python",
"rust",
"zig"
] | 11 | false | 2024-04-19T18:10:44Z | false | false | unknown | github | [] | Hello World
Hello world in different languages
Languages
<ul>
<li><a>C</a></li>
<li><a>C++</a></li>
<li><a>C#</a></li>
<li><a>Java</a></li>
<li><a>JavaScript</a></li>
<li><a>Python</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/8776?v=4 | zua | Jonesy/zua | 2024-05-17T17:17:48Z | A simple Lua parser written in Zig, for learning purposes | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Jonesy/zua/tags | Unlicense | [
"fun",
"lua",
"parser",
"zig"
] | 12 | false | 2024-05-28T07:29:23Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/1675360?v=4 | ziglings | peteraba/ziglings | 2024-03-09T21:03:19Z | My Ziglings solutions. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/peteraba/ziglings/tags | MIT | [
"learning-exercise",
"zig",
"ziglang",
"ziglings"
] | 1,232 | false | 2024-03-09T21:06:22Z | true | false | unknown | github | [] | Ziglings
⚠️ Ziglings has moved from GitHub to Codeberg!
You are looking at the current Ziglings repo if you are viewing
this at https://codeberg.org/ziglings/exercises/
You can also use the handy URL https://ziglings.org to get here!
Welcome to Ziglings! This project contains a series of tiny
broken programs (and one nasty surprise). By fixing them, you'll
learn how to read and write <a>Zig</a> code.
Those broken programs need your help! (You'll also save the
planet from evil aliens and help some friendly elephants stick
together, which is very sweet of you.)
This project was directly inspired by the brilliant and fun
<a>rustlings</a>
project for the <a>Rust</a> language.
Indirect inspiration comes from <a>Ruby Koans</a>
and the Little LISPer/Little Schemer series of books.
Intended Audience
This will probably be difficult if you've <em>never</em> programmed
before. But no specific programming experience is required. And
in particular, you are <em>not</em> expected to have any prior
experience with "systems programming" or a "systems" level
language such as C.
Each exercise is self-contained and self-explained. However,
you're encouraged to also check out these Zig language resources
for more detail:
<ul>
<li>https://ziglang.org/learn/</li>
<li>https://ziglearn.org/</li>
<li>https://ziglang.org/documentation/master/</li>
<li><a>Zig in Depth! (video series)</a></li>
</ul>
Also, the <a>Zig community</a>
is incredibly friendly and helpful!
Getting Started
Install a <a>development build</a> of
the Zig compiler. (See the "master" section of the downloads
page.)
Verify the installation and build number of <code>zig</code> like so:
<code>$ zig version
0.12.0-dev.xxxx+xxxxxxxxx</code>
Clone this repository with Git:
<code>$ git clone https://ziglings.org
$ cd ziglings.org</code>
Then run <code>zig build</code> and follow the instructions to begin!
<code>$ zig build</code>
Note: The output of Ziglings is the unaltered output from the Zig
compiler. Part of the purpose of Ziglings is to acclimate you to
reading these.
A Note About Versions
<strong>Hint:</strong> To check out Ziglings for a stable release of Zig, you can use
the appropriate tag.
The Zig language is under very active development. In order to be
current, Ziglings tracks <strong>development</strong> builds of the Zig
compiler rather than versioned <strong>release</strong> builds. The last
stable release was <code>0.11.0</code>, but Ziglings needs a dev build with
pre-release version "0.12.0" and a build number at least as high
as that shown in the example version check above.
It is likely that you'll download a build which is <em>greater</em> than
the minimum.
Once you have a build of the Zig compiler that works with
Ziglings, they'll continue to work together. But keep in mind
that if you update one, you may need to also update the other.
Version Changes
Version-0.12.0-dev.2618
* <em>2024-02-05</em> zig 0.12.0-dev.2618 - changes in <code>build system</code> - from <code>Step.zig_exe</code> to <code>Step.graph.zig_exe</code> - see<a>#18778</a>
* <em>2024-01-05</em> zig 0.12.0-dev.2043 - rename of <code>std.Build.FileSource</code> to <code>std.Build.LazyPath</code> - see<a>#16353</a>
* <em>2023-10-24</em> zig 0.12.0-dev.1243 - changes in <code>std.ChildProcess</code>: renamed exec to run - see<a>#5853</a>
* <em>2023-06-26</em> zig 0.11.0-dev.4246 - changes in compile step (now it can be null)
* <em>2023-06-26</em> zig 0.11.0-dev.3853 - removal of destination type from all cast builtins
* <em>2023-06-20</em> zig 0.11.0-dev.3747 - <code>@enumToInt</code> is now <code>@intFromEnum</code> and <code>@intToFloat</code> is now <code>@floatFromInt</code>
* <em>2023-05-25</em> zig 0.11.0-dev.3295 - <code>std.debug.TTY</code> is now <code>std.io.tty</code>
* <em>2023-04-30</em> zig 0.11.0-dev.2704 - use of the new <code>std.Build.ExecutableOptions.link_libc</code> field
* <em>2023-04-12</em> zig 0.11.0-dev.2560 - changes in <code>std.Build</code> - remove run() and install()
* <em>2023-04-07</em> zig 0.11.0-dev.2401 - fixes of the new build system - see <a>#212</a>
* <em>2023-02-21</em> zig 0.11.0-dev.2157 - changes in <code>build system</code> - new: parallel processing of the build steps
* <em>2023-02-21</em> zig 0.11.0-dev.1711 - changes in <code>for loops</code> - new: Multi-Object For-Loops + Struct-of-Arrays
* <em>2023-02-12</em> zig 0.11.0-dev.1638 - changes in <code>std.Build</code> cache_root now returns a directory struct
* <em>2023-02-04</em> zig 0.11.0-dev.1568 - changes in <code>std.Build</code> (combine <code>std.build</code> and <code>std.build.Builder</code> into <code>std.Build</code>)
* <em>2023-01-14</em> zig 0.11.0-dev.1302 - changes in <code>@addWithOverflow</code> (now returns a tuple) and <code>@typeInfo</code>; temporary disabled async functionality
* <em>2022-09-09</em> zig 0.10.0-dev.3978 - change in <code>NativeTargetInfo.detect</code> in build
* <em>2022-09-06</em> zig 0.10.0-dev.3880 - Ex 074 correctly fails again: comptime array len
* <em>2022-08-29</em> zig 0.10.0-dev.3685 - <code>@typeName()</code> output change, stage1 req. for async
* <em>2022-07-31</em> zig 0.10.0-dev.3385 - std lib string <code>fmt()</code> option changes
* <em>2022-03-19</em> zig 0.10.0-dev.1427 - method for getting sentinel of type changed
* <em>2021-12-20</em> zig 0.9.0-dev.2025 - <code>c_void</code> is now <code>anyopaque</code>
* <em>2021-06-14</em> zig 0.9.0-dev.137 - std.build.Id <code>.Custom</code> is now <code>.custom</code>
* <em>2021-04-21</em> zig 0.8.0-dev.1983 - std.fmt.format() <code>any</code> format string required
* <em>2021-02-12</em> zig 0.8.0-dev.1065 - std.fmt.format() <code>s</code> (string) format string required
Advanced Usage
It can be handy to check just a single exercise:
<code>zig build -Dn=19</code>
You can also run without checking for correctness:
<code>zig build -Dn=19 test</code>
Or skip the build system entirely and interact directly with the
compiler if you're into that sort of thing:
<code>zig run exercises/001_hello.zig</code>
Calling all wizards: To prepare an executable for debugging,
install it to zig-cache/bin with:
<code>zig build -Dn=19 install</code>
To get a list of all possible options, run:
```
zig build -Dn=19 -l
install Install 019_functions2.zig to prefix path
uninstall Uninstall 019_functions2.zig from prefix path
test Run 019_functions2.zig without checking output
...
```
What's Covered
The primary goal for Ziglings is to cover the core Zig language.
It would be nice to cover the Standard Library as well, but this
is currently challenging because the stdlib is evolving even
faster than the core language (and that's saying something!).
Not only would stdlib coverage change very rapidly, some
exercises might even cease to be relevant entirely.
Having said that, there are some stdlib features that are
probably here to stay or are so important to understand that they
are worth the extra effort to keep current.
Conspicuously absent from Ziglings are a lot of string
manipulation exercises. This is because Zig itself largely avoids
dealing with strings. Hopefully there will be an obvious way to
address this in the future. The Ziglings crew loves strings!
Zig Core Language
<ul>
<li>[x] Hello world (main needs to be public)</li>
<li>[x] Importing standard library</li>
<li>[x] Assignment</li>
<li>[x] Arrays</li>
<li>[x] Strings</li>
<li>[x] If</li>
<li>[x] While</li>
<li>[x] For</li>
<li>[x] Functions</li>
<li>[x] Errors (error/try/catch/if-else-err)</li>
<li>[x] Defer (and errdefer)</li>
<li>[x] Switch</li>
<li>[x] Unreachable</li>
<li>[x] Enums</li>
<li>[x] Structs</li>
<li>[x] Pointers</li>
<li>[x] Optionals</li>
<li>[x] Struct methods</li>
<li>[x] Slices</li>
<li>[x] Many-item pointers</li>
<li>[x] Unions</li>
<li>[x] Numeric types (integers, floats)</li>
<li>[x] Labelled blocks and loops</li>
<li>[x] Loops as expressions</li>
<li>[x] Builtins</li>
<li>[x] Inline loops</li>
<li>[x] Comptime</li>
<li>[x] Sentinel termination</li>
<li>[x] Quoted identifiers @""</li>
<li>[x] Anonymous structs/tuples/lists</li>
<li>[ ] Async <--- ironically awaiting upstream Zig updates</li>
<li>[X] Interfaces</li>
<li>[X] Bit manipulation</li>
<li>[X] Working with C</li>
<li>[X] Threading</li>
<li>[ ] Interfaces part 2</li>
</ul>
Zig Standard Library
<ul>
<li>[X] String formatting</li>
<li>[X] Testing</li>
<li>[X] Tokenization</li>
</ul>
Contributing
Contributions are very welcome! I'm writing this to teach myself
and to create the learning resource I wished for. There will be
tons of room for improvement:
<ul>
<li>Wording of explanations</li>
<li>Idiomatic usage of Zig</li>
<li>Additional exercises</li>
</ul>
Please see <a>CONTRIBUTING</a>
in this repo for the full details. | [] |
https://avatars.githubusercontent.com/u/12452210?v=4 | chafacad | slingercode/chafacad | 2024-04-15T06:35:44Z | AutoCAD... but chafa | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/slingercode/chafacad/tags | MIT | [
"raylib",
"raylib-zig",
"zig"
] | 47 | false | 2024-08-15T20:52:44Z | true | true | unknown | github | [
{
"commit": "6cc4aec3c478b88559e7d7e40b9e29d01de0a18b.tar.gz",
"name": "raylib-zig",
"tar_url": "https://github.com/Not-Nik/raylib-zig/archive/6cc4aec3c478b88559e7d7e40b9e29d01de0a18b.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/Not-Nik/raylib-zig"
}
] | ChafaCAD
Requirements
<ul>
<li><a>Zig</a> => <code>>=0.13.0</code></li>
<li><a>Raylib</a> (raylib is handled by raylib-zig)</li>
</ul>
Local Installation
<ol>
<li><code>zig build</code></li>
</ol>
<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 use the font <a>Berkeley Mono</a> (🐐) so the configuration expects this font
</blockquote>
TODO
<ul>
<li>[ ] Hold esc key to quit draw mode if drawimg</li>
<li>[ ] Draw a line, where and how to store it (deprecate line and store a polyline)</li>
<li>[ ] Detect a figure (hatch mode in a polygon)</li>
<li>[ ] Area</li>
<li>[ ] Detect if the drawing is not a polygon</li>
<li>[ ] 90° mode</li>
<li>[ ] Combine hatch mode (two or more polygoms in a same operation)</li>
<li>[ ] Two or more polygons inside a polygon?</li>
</ul>
References
Old References
This links are from my previos versions and I'm keeping them in
order to create an archive
Raylib using C
<ul>
<li><a>Raylib - Working on MacOS</a></li>
<li><a>themutti - Raylib installation</a></li>
</ul>
OpenGL, GLEW, GLFW using C
This links are from my previous version that was using GLEW and GLFW but I'm keeping them in order to create an archive
<ul>
<li><a>Some interesting post in reddit</a></li>
<li><a>OpenGL tutorial</a></li>
<li><a>Triangle</a></li>
<li><a>Triangle solved</a></li>
</ul>
Personal comments
<ul>
<li>I tried to build raylib manually in zig and failed miserably, as a possible TODO is to stop using raylib-zig in a near future (or not)</li>
<li>Apparently, OpenGL in MacOS and the M lineup is kinda special.
So my option is this: use the last supported OpenGL version (4.1) with GLEW and use GLFW</li>
<li>I spend like 1.5 hours trying to make the basic glfw example... there are some important
steps in order to link the library into the project. (<a>this is a nice help</a>)</li>
</ul>
So... we need to link to the path that brew install it. in the build its the solution. | [] |
https://avatars.githubusercontent.com/u/26017543?v=4 | ray-zig | typio/ray-zig | 2024-03-17T09:08:57Z | null | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/typio/ray-zig/tags | - | [
"game",
"racing",
"raylib",
"zig"
] | 116 | false | 2024-03-17T09:22:39Z | true | true | unknown | github | [] | Zig + raylib
Demonstration of how easy it is to use raylib with Zig. I'll flesh this out into a full minigame like tetris or snake or pong, I'm taking suggestions...
Maybe a racing game cause ray + zig sort of sounds like "racing". | [] |
https://avatars.githubusercontent.com/u/74064138?v=4 | AoC | Hkaar/AoC | 2024-06-13T09:03:53Z | Solutions to advent of code problems | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Hkaar/AoC/tags | - | [
"advent-of-code",
"advent-of-code-2023",
"solutions",
"zig"
] | 13 | false | 2024-06-13T09:06:30Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/135217?v=4 | plan9 | gthvn1/plan9 | 2024-06-26T14:44:44Z | Writing a 9P server from scratch to understand 9P | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/gthvn1/plan9/tags | GPL-3.0 | [
"js",
"wasm",
"zig"
] | 49 | false | 2024-07-10T12:00:48Z | true | true | unknown | github | [] | <ul>
<li>
We are far away from the 9P server. We are using this to experiment but
first steps are just writing a simple http server and we will extend it
gradually.
</li>
<li>
Currently we are more playing with 🥳 Zig, JS and WASM 🥳 as you can see
in <a>html_contents/</a>.
</li>
<li>
And in the same time in this repo we are implementing a server in Zig 🛠️...
</li>
<li>
So right now nothing is related to plan9 but fun things
</li>
<li>start the server:<ul>
<li>run: <code>zig build && && ./zig-out/bin/http_server</code></li>
</ul>
</li>
<li>and try to get an answer: <code>curl -v localhost:8000</code></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/6756180?v=4 | ffi-flang-zig | kassane/ffi-flang-zig | 2024-06-18T15:16:52Z | FFI flang-new runtime with Zig | main | 2 | 0 | 0 | 0 | https://api.github.com/repos/kassane/ffi-flang-zig/tags | Apache-2.0 | [
"cross-compile",
"ffi",
"ffi-bindings",
"flang",
"fortran",
"llvm",
"zig",
"zig-package"
] | 3,002 | false | 2025-03-31T13:00:07Z | true | false | unknown | github | [] | ffi-flang-zig
FFI between Fortran runtime and Zig
<a>LLVM/flang v19.1.7</a> files are included in this repository.
Inspired by <a>sourceryinstitute/ISO_Fortran_binding</a>. However, for LLVM-based only!
Requires
<ul>
<li><a>Zig</a> v0.14.0 or master</li>
<li><a>Flang</a></li>
</ul>
How to use
Build docker and run image:
<code>bash
$ docker build -t flang-zig -f .devcontainer/Dockerfile
$ docker run -it --rm -v $(pwd):/app -w /app flang-zig bash</code>
Build help
<code>bash
Project-Specific Options:
-Doptimize=[enum] Prioritize performance, safety, or binary size
Supported Values:
Debug
ReleaseSafe
ReleaseFast
ReleaseSmall
-Dtarget=[string] The CPU architecture, OS, and ABI to build for
-Dcpu=[string] Target CPU features to add or subtract
-Ddynamic-linker=[string] Path to interpreter on the target system
-Dshared=[bool] Build as shared library [default: false]
-Damalgamation=[bool] Build as amalgamation [default: false]
-Denable-tests=[bool] Build tests [default: false]</code> | [] |
https://avatars.githubusercontent.com/u/5650611?v=4 | docker-zig | denisgolius/docker-zig | 2024-03-27T09:57:01Z | A docker image for Zig based upon Alpine Linux 3.21.2 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/denisgolius/docker-zig/tags | BSD-3-Clause | [
"alpine",
"alpine-linux",
"docker",
"zig",
"zig-dev",
"ziglang"
] | 84 | true | 2025-05-15T10:03:53Z | false | false | unknown | github | [] | Zig
<a></a>
A docker image for <a>Zig</a> based upon <a>Alpine Linux</a> <code>3.21.3</code> .
Using this image
Building an executable
<code>bash
docker run -v $PWD:/app denisgolius/zig:0.14.0 build-exe hello.zig</code>
Available tags
There are two variants of tags provided by this repository - release tags such as <code>0.14.0</code>, and <code>master</code> branch builds such as <code>master-6a65561e3</code>.
The most recent <code>master-X</code> build is always tagged as simply <code>master</code> as well as having a tag including the Git hash for the release.
The most recent stable release is always tagged as <code>latest</code>.
Building the Docker image(s)
A bash script (<code>build.sh</code>) is ran by GitHub actions nightly in order to check for new versions and to then build and push images for them. | [] |
https://avatars.githubusercontent.com/u/20820?v=4 | sd_notify | jiripospisil/sd_notify | 2024-06-23T20:27:17Z | null | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/jiripospisil/sd_notify/tags | - | [
"notify",
"systemd",
"zig"
] | 4 | false | 2024-06-29T13:39:36Z | true | true | unknown | github | [] | sd_notify
sd_notify is a library which implements a subset of APIs for interacting with
systemd services of type "notify".
```zig
const notifications = try sd.Notifications.init(.{});
defer notifications.deinit();
try notifications.notify(.ready);
if (try sd.listenFdsMap(allocator, true)) |map| {
var iter = map.iterator();
while (iter.next()) |entry| {
std.log.info("fdname {s} fd {any}", .{ entry.key_ptr.<em>, entry.value_ptr.</em> });
}
}
```
License MIT. | [] |
https://avatars.githubusercontent.com/u/122152230?v=4 | zigthon | Pawel-Parma/zigthon | 2024-03-17T18:42:34Z | Zig plus Python experiment | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Pawel-Parma/zigthon/tags | MIT | [
"docker",
"docker-compose",
"python",
"python-3",
"python3",
"zig",
"ziglang"
] | 9 | false | 2025-03-23T20:39:08Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/112193680?v=4 | nofucks | nitrogenez/nofucks | 2024-03-14T19:01:05Z | A fucking castrated brainfuck interpreter in Zig. Run it. See what horror unwraps. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/nitrogenez/nofucks/tags | - | [
"brainfuck",
"brainfuck-interpreter",
"just-for-fun",
"zig"
] | 5 | false | 2024-03-14T19:04:13Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/39703898?v=4 | riscv-examples | bluebrown/riscv-examples | 2024-06-02T22:50:00Z | riscv examples | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/bluebrown/riscv-examples/tags | - | [
"assembly",
"c",
"embedded",
"kernel",
"osdev",
"qemu",
"riscv",
"riscv64",
"rust",
"zig"
] | 79 | false | 2024-06-17T11:04:25Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/84944042?v=4 | zig-codec | niteshbalusu11/zig-codec | 2024-03-11T18:42:08Z | A Zig Library for Encoding and Decoding Formats | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/niteshbalusu11/zig-codec/tags | MIT | [
"base64",
"hex",
"zig"
] | 13 | false | 2024-03-11T19:14:45Z | true | true | 0.12.0-dev.3160+aa7d16aba | github | [] | zig-codec
A Zig Library for Encoding and Decoding Formats
<ul>
<li>Using Zig master branch, I am on zig version <code>0.12.0-dev.3352+95cb93944</code>.</li>
</ul>
Installation
<ul>
<li>In your <code>build.zig.zon</code></li>
</ul>
<code>zig
.dependencies = .{
.zigcodec = .{
.url = "https://github.com/niteshbalusu11/zig-codec/archive/<some-commit-hash>.tar.gz",
// The compiler should give you the right hash to use and replace.
.hash = "12209012a6baf146acc3bb13f3f84243bba8f266b18d775b2ba84de0038319a4a159",
},
},</code>
<ul>
<li>In your <code>build.zig</code></li>
</ul>
```zig
const zigcodec = b.dependency("zigcodec", .{
.target = target,
.optimize = optimize,
});
<code>const zig_codec_module = b.addModule("zigcodec", .{ .root_source_file = .{ .path = zigcodec.builder.pathFromRoot("src/lib.zig") } });
exe.root_module.addImport("zigcodec", zig_codec_module);
// IF YOU'RE USING BUILDING A LIBRARY, THEN IT'LL PROBABLY BE
// lib.root_module.addImport("zigbase64", zig_codec_module);
</code>
```
Example Hex Encoding and Decoding
```zig
const hex = @import("zigcodec").hex;
const std = @import("std");
test "hex encoding" {
const allocator = std.testing.allocator;
<code>const original_string = "Hello, Zig!";
const expected_hex = "48656c6c6f2c205a696721";
const bytes = original_string;
const hex_from_bytes = try hex.hexEncode(allocator, bytes);
defer allocator.free(hex_from_bytes);
try std.testing.expectEqualSlices(u8, expected_hex, hex_from_bytes);
</code>
}
test "hex decoding" {
const allocator = std.testing.allocator;
<code>const original_string = "Hello, Zig!";
const expected_hex = "48656c6c6f2c205a696721";
const decoded_bytes = try hex.hexDecode(allocator, expected_hex);
defer allocator.free(decoded_bytes);
try std.testing.expectEqualSlices(u8, original_string, decoded_bytes);
</code>
}
test "is valid hex" {
const valid_hex = "48656c6c6f2c205a696721";
const invalid_hex = "48656c6c6f20576f726c6x";
<code>try std.testing.expect(hex.isHex(valid_hex));
try std.testing.expect(!hex.isHex(invalid_hex));
</code>
}
```
Example Base64 Encoding and Decoding
```zig
const std = @import("std");
const base64 = @import("zigcodec").base64;
test "base64 encoding" {
const allocator = std.testing.allocator;
<code>const original_bytes = "Hello, Zig!";
const expected_base64 = "SGVsbG8sIFppZyE=";
const bytes = try base64.base64Encode(allocator, original_bytes);
defer allocator.free(bytes);
try std.testing.expectEqualSlices(u8, expected_base64, bytes);
</code>
}
test "base64 decoding" {
const allocator = std.testing.allocator;
<code>const original_base64 = "SGVsbG8sIFppZyE=";
const expected_bytes = "Hello, Zig!";
const bytes = try base64.base64Decode(allocator, original_base64);
defer allocator.free(bytes);
try std.testing.expectEqualSlices(u8, expected_bytes, bytes);
</code>
}
test "is base64" {
const valid_base64 = "SGVsbG8sIFppZyE=";
const invalid_base64 = "SGVsbG8sIFppZyE =";
<code>try std.testing.expect(base64.isBase64(valid_base64));
try std.testing.expect(!base64.isBase64(invalid_base64));
</code>
}
``` | [] |
https://avatars.githubusercontent.com/u/29946764?v=4 | Juggler-crackme | forentfraps/Juggler-crackme | 2024-04-07T22:50:54Z | CrackME | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/forentfraps/Juggler-crackme/tags | - | [
"asm",
"blazingly-fast",
"c",
"crackme",
"python",
"rust",
"zig"
] | 14,663 | false | 2024-09-20T23:26:51Z | false | false | unknown | github | [] | Juggler crackme
This is my best attempt at making a crackme. Currently its biggest challenge is the anti-debugging part, meaning, if you find the key processing logic you are practically done.
Building the project
You will require:
- GCC
- Visual Studio build tools (cl and lib)
- rust compiler
- zig
- nasm
- python 3
- strip (this is optional)
- ability to edit 1 file
The file requiring edit is in c_verification under the name of make_microsoft_nocrt.bat
Edit all the paths, pointing to visual studio related stuff, or try your luck, may be we are using the same version
After you have all that you clone the repo and run the build.bat
<code>shell
git clone https://github.com/forentfraps/Juggler-crackme.git --depth=1
cd Juggler-crackme
.\build.bat</code>
⚠️<em>I suggest you try solving it before you scroll down and see all of the design ideas and spoilers</em>⚠️
I update the crackme overtime, adding new functionality. All releases from V2 (including the V2) are fully funcitonal.
Architectural overview
```
+----------------------+----------------------+----------------------+----------------------+
| rust main thread | zig key deriver | rust warden | c aes verification |
+----------------------+----------------------+----------------------+----------------------+
| | | | |
| Loads zig key | | | |
| deriver -------------|-> Enters infinite | | |
| | loop | | |
| Begins loading c aes | | | |
| verification (pauses)| | | |
| Unlocks zig key | | | |
| deriver ------------>| Receives unlock, | | |
| | modifies rust main | | |
| | thread | | | |
| Context modified <---|------------/ | | |
| | Unlocks main thread | | |
| | | | | |
| Receives unlock <----|----------------/ | | |
| | | | |
| Continues loading c | | | |
| aes verification ----|----------------------|----------------------|-> Starts running |
| Loads rust warden ---|--------------------->| Starts running | |
| Passes data to rust | | | |
| warden --------------|--------------------->| Receives data | |
| | | Passes data to c aes | |
| | | verification --------|--------------------->|
| | | | Receives data |
| | | | Decrypts data |
| | | | Passes decrypted data|
| | | | back to rust warden |
| | | Receives decrypted | | |
| | | data <---------------|--------------------/ |
| | | Passes decrypted data| |
| | | back to rust main | |
| | | thread | | |
| Receives decrypted | | | | |
| data <---------------|----------------------|--------------/ | |
| Loads data into | | | |
| memory and executes | | | |
+----------------------+----------------------+----------------------+----------------------+
```
The name "Juggler" comes from the data juggling between threads
Anti-Debug tricks
Making the static analysis unbearable
<ul>
<li>Swapping the header of embedded dll's to BMP format </li>
<li>Stripping it from labels</li>
<li>
Littering with with <code>hide!</code> and <code>fake_exit!</code> asm macros:
<ul>
<li>hide!</li>
</ul>
The big idea is that you cannot disassemble after a call to a special function, because it increments the return address by one. And the reason for this increment is a junk byte 0x9a after the call, which screws up the disassembly.
<code>asm
call appendByte2Rip
db 0x9a
;here the execution resumes</code>
where appndByte2Rip does just what is says
<code>asm
appendByte2Rip:
pop r11
add r11, 1
jmp r11</code>
- fake_exit!
Here the idea is to make it seem that the function ends. We extract current IP, put it on the stack and then return, effectively ending the function, whearas in reality the execution continues past the <code>ret</code>.
In the macro I added a bit more logic and junk data.
<code>asm
call label
label:
pop rax
add rax, 29
xor r9, 0xf8145 ; useless calculation, making the compiler's life more difficult, since I clobber one more register
push rax
ret
;13 bytes of junk data
db 13 dup(0xcc)
;here the execution resumes</code>
</li>
</ul>
This is all easily avoidable when stepping through funcions, so the last anti-static defense is encrypting the key verification logic
Dynamic Anti-Debugging tricks
<ul>
<li>Each load is a runtime Reflective DLL Load</li>
<li>Thread locking and unlocking is just one thread entering an infinite loop like:
<code>asm
label:
jmp label</code>
And when the second thread is unlocking that infinite loop thread, it finds this loop, and just fills it with nops with thread safe lock prefix like so:
<code>asm
mov rax, 0x9090909090909090
lock xchg rax, [addr of loop]</code></li>
<li>Data between the <code>warden</code> and <code>c aes verification</code> is passed via RtlUserThreadStart and DbgBreakPoint, so the buffer is literally the first bytes of these functions. The idea behind this decision is that so when you remotely try to suspend the process, it tries to create a new thread and dies instantly, or it just fails to start one, either is fine. </li>
<li>The whole point of the zig thread is that it puts a NtContinueEx syscall in the main thread, which jumps over 2048 junk bytes. The NtContinueEx detaches Intel Pin, rendering any codecoverage plugins and tools useless (without manual modification, you have to check [rdx] manually and jump - adjust rip - manually)</li>
<li>Read of the user provided string is done via NtReadVirtualMemory, a kernel mode function. This is in place to avoid triggering and hardware breakpoints on read/write.</li>
<li>The same NtReadVirtualMemory is used to put a hook on RtlExitUserProcess to display Win/Lose messages</li>
<li>Most of the threads are created through TpAllocWork/TpPostWork/TpReleaseWork, more on that could be read: https://0xdarkvortex.dev/hiding-in-plainsight/</li>
</ul>
How to solve it
When designing this, I tried to patch every approach I would take, so this section is more like a TODO list for the future:
- Hooking/Blocking VirtualProtect/VirtualAlloc and looking at what is happening at the memory regions.
I think this is solved with manual syscalls, since pintool is out of the picture (thanks to NtContinueEx), good luck trying to find which memory is what
- Since the logic overall is pretty obscure,after hooking juicy GetModuleHandle/GetProcAddress or aforementioned VirtualProtect/VirtualAlloc stack trace could be observed and backtracked.
This could be solved in moving all these juicy calls outside, via TpAllocWork. Where the cleanest stack trace will yeild no useful info
<ul>
<li>
Once the encrypted payload and the key are extracted + it is clear that the algo is simple AES, there are no more obstacles
Since the AES implementation is my own, I could change up the constants, making it oh so more fun to reverse this hellfile, but I think this will remain as-is, since the main challenge is circumvention of anti-debug measures.
</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/156404?v=4 | sokol-zig-template | Angluca/sokol-zig-template | 2024-02-18T16:49:05Z | This template is zig use sokol c headers | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Angluca/sokol-zig-template/tags | - | [
"sokol",
"sokol-zig",
"zig"
] | 79 | false | 2024-02-20T01:57:34Z | true | true | 0.12.0 | github | [
{
"commit": "c18280c8f3f8f088b4337f0f6a5fdb2be0d67179.tar.gz",
"name": "emsdk",
"tar_url": "https://github.com/emscripten-core/emsdk/archive/c18280c8f3f8f088b4337f0f6a5fdb2be0d67179.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/emscripten-core/emsdk"
},
{
"commit": "a40c44... | Not need generated binding file, Use origin <a>sokol headers</a> directly.
For Zig version 0.12.0-dev or newer.
Building the samples
Supported platforms are: Windows, macOS, Linux (with X11) and web
On Linux install the following packages: libglu1-mesa-dev, mesa-common-dev, xorg-dev, libasound-dev
(or generally: the dev packages required for X11, GL and ALSA development)
sokol.h: You can use it add headers
```c
// sokol.h
include "sokol_app.h"
include "sokol_gfx.h"
... and more
include "nuklear.h"
```
Add headers dictionary and build c files in build.zig
<code>zig
var user_h_dirs = .{
"new_dir/lib",
};
var user_c_files = .{
"new_dir/lib/nuklear.c",
};</code>
To build the platform-native samples:
```sh
First generite glsl to h shaders file if use glsl
zig build shaders
or build example shaders
zig build shaders -Dexample
<code></code>sh
build and run project:
zig build
zig build run
build and run example:
zig build -Dexample
zig build -Dexample clear
zig build -Dexample triangle
zig build -Dexample quad
...
```
(also run <code>zig build --help</code> to inspect the build targets)
By default, the backend 3D API will be selected based on the target platform:
<ul>
<li>macOS: Metal</li>
<li>Windows: D3D11</li>
<li>Linux: GL</li>
</ul>
To force the GL backend on macOS or Windows, build with <code>-Dgl=true</code>:
```
<blockquote>
zig build -Dgl=true -Dexample clear
```
</blockquote>
The <code>clear</code> sample prints the selected backend to the terminal:
<code>sokol-zig ➤ zig build -Dgl=true -Dexample clear
Backend: .sokol.gfx.Backend.GLCORE33</code>
For the web-samples, run:
```sh
zig build -Dtarget=wasm32-emscripten
or to build and run one of the samples
zig build clear -Dexample -Dtarget=wasm32-emscripten
...
```
When building with target <code>wasm32-emscripten</code> for the first time, the build script will
install and activate the Emscripten SDK into the Zig package cache for the latest SDK
version. There is currently no build system functionality to update or delete the Emscripten SDK
after this first install. The current workaround is to delete the global Zig cache
(run <code>zig env</code> to see where the Zig cache resides).
Improving the Emscripten SDK integration with the Zig build system is planned for the future. | [] |
https://avatars.githubusercontent.com/u/380158?v=4 | zig-gtk-gl | frmdstryr/zig-gtk-gl | 2024-05-25T13:12:38Z | Demo app using Gtk4 and Opengl in Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/frmdstryr/zig-gtk-gl/tags | - | [
"gtk4",
"opengl",
"zig"
] | 5 | false | 2024-05-31T16:56:24Z | true | false | unknown | github | [] | zig-gtk4-zgl
A test application using <a>gtk4</a> and <a>opengl</a> in zig. | [] |
https://avatars.githubusercontent.com/u/38767574?v=4 | zig-http-server | Syaoran2014/zig-http-server | 2024-07-18T21:08:46Z | A very simple HTTP Server made in Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/Syaoran2014/zig-http-server/tags | - | [
"http",
"http-server",
"server",
"zig"
] | 13 | false | 2024-07-18T21:16:18Z | true | true | unknown | github | [] | My Notes:
For this challenge, I used <code>zig (0.13)</code> and it seemed to work with no issues.
I attempted to focuse on using the built in http.server library, This seemed to do well and I didn't see any issues.
One issue I had when testing with concurrent connections, It would sometimes fail on the codecrafters side.
This could simply be because my code didn't work properly or just an inherit bug when using zig, or specifically zig v0.13
By no means was this an "optimal" or the most efficient soluction, but it does work and has passed their tests.
<a></a>
This is a starting point for Zig solutions to the
<a>"Build Your Own HTTP server" Challenge</a>.
<a>HTTP</a> is the
protocol that powers the web. In this challenge, you'll build a HTTP/1.1 server
that is capable of serving multiple clients.
Along the way you'll learn about TCP servers,
<a>HTTP request syntax</a>,
and more.
<strong>Note</strong>: If you're viewing this repo on GitHub, head over to
<a>codecrafters.io</a> to try the challenge. | [] |
https://avatars.githubusercontent.com/u/237008?v=4 | zig-quickstarts | jnbdz/zig-quickstarts | 2024-05-13T17:08:48Z | 🇿 Zig | Quicstarts 🇿 | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/jnbdz/zig-quickstarts/tags | MIT | [
"quickstart",
"quickstarts",
"zig",
"ziglang"
] | 18 | false | 2024-06-29T22:24:58Z | false | false | unknown | github | [] | zig-quickstarts
🇿 Zig | Quicstarts 🇿
Resources
Documentations
<ul>
<li><a>Zig Language Reference</a></li>
<li><a>zig.guide</a></li>
<li><a>Zig by Example</a></li>
</ul>
Exercise
<ul>
<li><a>Ziglings | codeberg</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/72983221?v=4 | tut-pong | ZackeryRSmith/tut-pong | 2024-03-23T16:38:07Z | Raylib-Zig pong tutorial | video-1 | 0 | 0 | 0 | 0 | https://api.github.com/repos/ZackeryRSmith/tut-pong/tags | - | [
"pong",
"raylib",
"tutorial",
"zig"
] | 3,054 | false | 2024-06-12T00:53:44Z | true | true | unknown | github | [
{
"commit": "5.0.tar.gz",
"name": "raylib",
"tar_url": "https://github.com/raysan5/raylib/archive/5.0.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/raysan5/raylib"
}
] | [] | |
https://avatars.githubusercontent.com/u/122347252?v=4 | zaye | epicyclic-dev/zaye | 2024-03-08T06:40:19Z | null | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/epicyclic-dev/zaye/tags | MIT | [
"yaml-parser",
"zig"
] | 109 | false | 2024-06-19T00:25:09Z | true | true | unknown | github | [] | ZAYE Ain't a Yaml Emitter
zaye is a very simple libyaml-based YAML parser for zig. In the spirit of describing
things by defining what they aren't, it is not capable of emitting YAML. If that
changes in the future, then this will have been a poor naming choice.
Status
A single YAML document can be parsed one-shot into a nested tagged-union structure in
zig. No automatic type conversion happens, all scalars left as strings. Most advanced
YAML features are ignored or not supported (e.g. anchors/aliases and tags).
It does what I need it to do.
zig 0.11.0 build system for now. | [] |
https://avatars.githubusercontent.com/u/99103484?v=4 | color | Peppy3/color | 2024-02-15T13:44:08Z | Terminal color viewer | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Peppy3/color/tags | MIT | [
"color",
"color-palette",
"colorscheme",
"zig"
] | 10,331 | false | 2024-02-15T14:43:06Z | true | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/111171997?v=4 | cngp-zig | protocol-laboratory/cngp-zig | 2024-03-09T14:14:32Z | Cngp Zig. Feel free to open an issue if you have any questions or feature requests. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/protocol-laboratory/cngp-zig/tags | - | [
"cngp",
"zig"
] | 3 | false | 2024-09-12T09:24:48Z | false | false | unknown | github | [] | cngp-zig | [] |
https://avatars.githubusercontent.com/u/97989036?v=4 | fdutils | iambnlvn/fdutils | 2024-06-16T22:49:41Z | file directory utils | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/iambnlvn/fdutils/tags | - | [
"cli",
"tooling",
"zig",
"ziglang"
] | 6 | false | 2024-06-17T13:34:47Z | true | true | unknown | github | [] | Fdutils
another file and directory utility... Just learning Zig actually. | [] |
https://avatars.githubusercontent.com/u/132494380?v=4 | clefcraft | EarthmanMuons/clefcraft | 2024-04-10T21:05:31Z | Exploration of Western music theory concepts with Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/EarthmanMuons/clefcraft/tags | 0BSD | [
"midi",
"music",
"music-theory",
"theory",
"zig",
"ziglang"
] | 355 | false | 2024-09-02T20:05:12Z | true | true | 0.12.0 | github | [
{
"commit": "e3e3a7518a308261551dc143bf347fd142bc80b3.tar.gz",
"name": "raylib-zig",
"tar_url": "https://github.com/Not-Nik/raylib-zig/archive/e3e3a7518a308261551dc143bf347fd142bc80b3.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/Not-Nik/raylib-zig"
},
{
"commit": "74a1eaa... | ClefCraft
<strong>Exploration of Western music theory concepts with <a>Zig</a>.</strong>
License
ClefCraft is released under the <a>Zero Clause BSD License</a> (SPDX: 0BSD).
Copyright © 2024 <a>Aaron Bull Schaefer</a> and contributors
Credits
Thank you to the following people:
<ul>
<li>
<a>@Not-Nik</a> for the <a>raylib-zig</a> bindings to the <a>raylib</a> project, used
for GUI (Graphical User Interface) support.
</li>
<li>
<a>@ryleelyman</a> for the <a>rtmidi_z</a> bindings to the <a>RtMidi</a> project, used
for MIDI (Musical Instrument Digital Interface) support.
</li>
</ul> | [] |
https://avatars.githubusercontent.com/u/24637919?v=4 | zig-gba | LawsOfScience/zig-gba | 2024-07-08T14:01:30Z | My attempt at programming a GBA in Zig from scratch | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/LawsOfScience/zig-gba/tags | MIT | [
"gameboy-advance",
"gba",
"gbadev",
"zig"
] | 11 | false | 2024-07-12T01:51:08Z | true | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/157066878?v=4 | raycasting-zig | jscromao/raycasting-zig | 2024-08-05T10:08:20Z | Raycasting in 1 Weekend implementation for Zig lang exploration | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/jscromao/raycasting-zig/tags | MIT | [
"developer-experience",
"language-exploration",
"raycasting",
"testing",
"zig",
"ziglang"
] | 202 | false | 2024-08-16T16:50:09Z | true | true | unknown | github | [] | Raycasting in 1 Weekend implementation for Zig lang exploration
| [] |
https://avatars.githubusercontent.com/u/69104965?v=4 | lisp-zig | doccaico/lisp-zig | 2024-04-02T00:21:19Z | Lisp written in Zig/Ziglang | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/doccaico/lisp-zig/tags | - | [
"zig"
] | 107 | false | 2024-04-06T07:03:36Z | true | false | unknown | github | [] | Lisp-Zig (Tested on Windows only)
Something like Lisp. I referred to <a>Lisp interpreter in Rust</a> and <a>vishpat/lisp-rs</a>. Thank you Vishal Patil.
Zig version
<code>// 2024/04/06
0.12.0-dev.3533+e5d900268</code>
Usage
<code>$ zig run src\main.zig</code>
Keywords
<ul>
<li>print
```
print arg</li>
</ul>
(print "foobar")
<blockquote>
"foobar"
```
</blockquote>
<ul>
<li>define
```
define name value</li>
</ul>
(define pi 3.14)
(print pi)
<blockquote>
3.14
```
</blockquote>
<ul>
<li>begin
```
begin element ...</li>
</ul>
(begin
(define a 1)
(define b 2)
(+ a b)
)
<blockquote>
3
```
</blockquote>
<ul>
<li>list
```
list element ...</li>
</ul>
(list 1 2 3 4 5)
<blockquote>
(1 2 3 4 5)
```
</blockquote>
<ul>
<li>lambda
```
lambda args body</li>
</ul>
(define add (lambda (a b) (+ a b)))
(add 1 2)
<blockquote>
3
```
</blockquote>
<ul>
<li>let
```
let binds body</li>
</ul>
(begin
(let ((a 1) (b 2))
(+ a b)
)
)
<blockquote>
3
```
</blockquote>
<ul>
<li>map
```
map function list</li>
</ul>
(map (lambda (a) (+ a 10)) (list 1 2 3 4 5))
<blockquote>
(11 12 13 14 15)
```
</blockquote>
<ul>
<li>filter
```
filter function list</li>
</ul>
(begin
(define odd (lambda (v) (= 1 (% v 2))))
(define l (list 1 2 3 4 5))
(filter odd l)
)
<blockquote>
(1 3 5)
```
</blockquote>
<ul>
<li>reduce
```
reduce function list</li>
</ul>
(begin
(define add (lambda (a b) (+ a b)))
(define l (list 1 2 4 8 16 32))
(reduce add l )
)
<blockquote>
63
```
</blockquote>
<ul>
<li>range
```
range (start end stride)</li>
</ul>
(range 0 11)
<blockquote>
(0 1 2 3 4 5 6 7 8 9 10)
</blockquote>
(range 0 11 2)
<blockquote>
(0 2 4 6 8 10)
```
</blockquote>
<ul>
<li>car
```
car list</li>
</ul>
(car (list 1 2 3))
<blockquote>
1
```
</blockquote>
<ul>
<li>cdr
```
cdr list</li>
</ul>
(car (list 1 2 3))
<blockquote>
(2 3)
```
</blockquote>
<ul>
<li>length
```
length list</li>
</ul>
(length (list 1 2 3))
<blockquote>
3
```
</blockquote>
<ul>
<li>null?
```
null? list</li>
</ul>
(null? (list 1 2 3 4 5))
<blockquote>
false
</blockquote>
(null? (list))
<blockquote>
true
```
</blockquote> | [] |
https://avatars.githubusercontent.com/u/40190339?v=4 | toy-httpserver | daneelsan/toy-httpserver | 2024-07-21T13:53:14Z | Implementation of a toy HTTP server in lua, python, wolfram language and zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/daneelsan/toy-httpserver/tags | - | [
"http-server",
"lua",
"mathematica",
"python",
"wolfram-language",
"zig"
] | 229 | false | 2025-03-08T02:46:36Z | false | false | unknown | github | [] | Toy HTTP Server in multiple languages
Implementation of a toy HTTP server in lua, python, wolfram language and zig.
The server is built on top of simple socket functionality, using TCP for the connection protocol and using localhost as the socket address.
The server currently only handles the GET method, but it could be easily be expanded.
Usage
Start the HTTP server in various languages:
lua
Tested on:
<code>shell
$ lua -v
Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio</code>
Install the <a>luasocket</a> package (I chose <code>luarocks</code> for this):
<code>shell
$ luarocks install luasocket</code>
Also install the <a>mimetypes</a> package:
<code>shell
$ luarocks install mimetypes</code>
Start the server:
<code>shell
$ lua httpserver.lua</code>
NOTE: Testing against Google Chrome works fine. There seems to be an issue with Safari which needs more study.
python
Tested on:
<code>shell
$ python3 --version
Python 3.9.6</code>
Start the server:
<code>shell
$ python3 httpserver.py</code>
wolfram
Tested on:
<code>shell
$ wolframscript --version
WolframScript 1.8.0 for Mac OS X ARM (64-bit)</code>
Start the server:
<code>shell
wolframscript -f httpserver.wl</code>
zig
Tested on:
<code>shell
$ zig version
0.14.0</code>
Start the server:
<code>shell
zig run httpserver.zig</code>
Test
Send a HTTP request to the toy HTTP server using curl:
```shell
$ curl -i 127.0.0.1:8888/index.html
HTTP/1.1 200 OK
content-type: text/html;charset=UTF-8
Index page
Index page
This is the index page.
```
Or do it via a web browser:
A request for a non-existant file returns the following:
```shell
$ curl -i --http0.9 127.0.0.1:8888/notafile.txt
HTTP/1.1 404 Not Found
Server: ToyServer (python)
Content-Type: text/html
404 Not Found
```
References
lua
<ul>
<li><a>LuaSocket: Introduction to the core</a></li>
<li><a>Programming in Lua</a></li>
<li><a>Lua Style Guide</a></li>
</ul>
python
<ul>
<li><a>Writing an HTTP server from scratch</a></li>
<li><a>socket — Low-level networking interface</a></li>
</ul>
wolfram
<ul>
<li><a>SocketListen - Wolfram Language Documentation</a></li>
<li><a>SocketOpen - Wolfram Language Documentation</a></li>
<li><a>SessionSubmit - Wolfram Language Documentation</a></li>
</ul>
zig
<ul>
<li><a>Writing a HTTP Server in Zig</a></li>
<li><a>Socket programming in Zig (YouTube)</a></li>
<li><a>Zig Bits 0x4: Building an HTTP client/server from scratch</a></li>
<li><a>Creating UDP server from scratch in Zig</a></li>
</ul>
other
<ul>
<li><a>An overview of HTTP</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/163546630?v=4 | mime | zon-dev/mime | 2024-08-03T09:44:54Z | Support MIME (HTTP Media Types) types parse in Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/zon-dev/mime/tags | MIT | [
"media-types",
"mime",
"mime-parser",
"mime-types",
"zig",
"zig-package",
"ziglang"
] | 16 | false | 2024-08-06T08:39:27Z | true | true | unknown | github | [] | mime
Support MIME (HTTP Media Types) types parse in Zig.
Usage:
```zig
var mime = Mime.parse(std.heap.page_allocator, "text/plain; charset=utf-8; foo=bar");
try std.testing.expect(mime != null);
try std.testing.expect(std.mem.eql(u8, mime.?.essence, "text/plain; charset=utf-8; foo=bar"));
try std.testing.expect(std.mem.eql(u8, mime.?.basetype, "text"));
try std.testing.expect(std.mem.eql(u8, mime.?.subtype, "plain"));
const charset = mime.?.getParam("charset");
try testing.expectEqualStrings("utf-8", charset.?);
const foo = mime.?.getParam("foo");
try testing.expectEqualStrings("bar", foo.?);
const bar = mime.?.getParam("bar");
try testing.expect(bar == null);
``` | [
"https://github.com/andrewrk/StaticHttpFileServer",
"https://github.com/dasimmet/zig-devserver",
"https://github.com/kristoff-it/zine",
"https://github.com/ringtailsoftware/zig-wasm-audio-framebuffer",
"https://github.com/ringtailsoftware/zoridor",
"https://github.com/scottredig/zig-demo-webserver"
] |
https://avatars.githubusercontent.com/u/61829840?v=4 | zig-search | root-hunter/zig-search | 2024-05-29T23:26:27Z | High-performance search utility written entirely in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/root-hunter/zig-search/tags | MIT | [
"cross-platform",
"search",
"zig"
] | 717 | false | 2024-06-09T15:57:51Z | true | false | unknown | github | [] | <a name="readme-top"></a>
<a></a>
<a></a>
<a>
</a>
zig-search
High-performance search utility written entirely in Zig
About The Project
This is my first project written in Zig. I've been fascinated by Zig and its features, which offer a unique blend of performance, simplicity, and control. Zig-Search is a testament to the power and efficiency that Zig brings to the table, and it has been an exciting journey exploring what this language can do. I hope this tool showcases the potential of Zig and inspires others to explore it as well.
Features
<ul>
<li>100% Zig implementation</li>
<li>Only std lib</li>
<li>Fast and efficient directory scanning</li>
<li>Recursive search in nested directories</li>
<li>Simple command-line interface</li>
</ul>
Getting Started
This is an example of how you may give instructions on setting up your project locally.
To get a local copy up and running follow these simple example steps.
Build Prerequisites
These are the prerequisites needed only to build the project, if you only want to use zig-search you can go to the <b>Usage</b> section
* <a>Install zig</a>
Build
<ol>
<li>Clone the repo
<code>sh
git clone https://github.com/root-hunter/zig-search</code></li>
<li>Move to zig-search dir
<code>sh
cd zig-search</code></li>
<li>Build executable
<code>sh
make build-exe</code>
or
<code>sh
zig build-exe src/main.zig --name zig-search -static</code></li>
</ol>
(<a>back to top</a>)
Examples
Search and export into file all path of files (with extension .txt) that contains the word "password" at least one time.
<code>sh
zig-search /start/path "password" -f txt -e ${HOME}/Documents/zig-search_result.txt</code>
Search and export into file all path of files (with extension .txt, .js, .html) that contains the word "password" at least one time.
<code>sh
zig-search /start/path "password" -f txt,js,html -e ${HOME}/Documents/zig-search_result.txt</code>
Search and export into file all path of files (with extension .txt) that contains the word "password" at least one time using 16 threads.
<code>sh
zig-search /start/path "password" -f txt -t 16 -e ${HOME}/Documents/zig-search_result.txt</code>
Search and export into file all path of files (with extension .txt) that contains the word "password" at least one time using all possible threads.
<code>sh
zig-search /start/path "password" -f txt -t 0 -e ${HOME}/Documents/zig-search_result.txt</code>
Only print paths to console without export result file (using all cpu core).
<code>sh
zig-search /start/path "password" -f txt -t 0</code>
Active case sensitive search.
<code>sh
zig-search /start/path "Password" -f txt -t 0 -c</code>
Help command.
```sh
zig-search --help
Usage: zig-search START_PATH SEARCH_STRING [OPTIONS]...
Options:
--help Help command
-f, --file-extensions File extensions, in this form: txt,js | js,c,cpp
-t, --thread-count Scan thread count (Default: 1)
-a, --all-match Match all the occurence in the file (Default: false)
-c, --case-sensitive Case sensitive search (Default: false)
Export options:
-e, --export-path File export path (ABSOLUTE)
--export-no-info Disable info header in the export file
--export-match-position Add match position info for each path in the export file
```
(<a>back to top</a>)
Roadmap
<ul>
<li>[X] Help command</li>
<li>[X] Multihreading</li>
<li>[X] Advance text search</li>
<li>[X] Export results to file</li>
<li>[X] Scan file by list file paths</li>
</ul>
(<a>back to top</a>)
License
Distributed under the MIT License. See <code>LICENSE</code> for more information.
(<a>back to top</a>) | [] |
https://avatars.githubusercontent.com/u/54503497?v=4 | line_editor | RetroDev256/line_editor | 2024-07-25T03:43:16Z | Just a simple line editor that I made in zig to practice | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/RetroDev256/line_editor/tags | - | [
"zig"
] | 541 | false | 2025-05-15T02:49:15Z | true | true | 0.14.0-dev.3445+6c3cbb0c8 | github | [] | line_editor
Just a simple line editor.
Under active development - expect (and please report) bugs :)
The windows builds are significantly larger than the other builds due to this:
https://github.com/ziglang/zig/issues/18849
TODO:
- rewrite lots of code
- raw mode parsing (so we can use our arrow keys in the input)
- options to toggle aspects of printing:
- toggle printing line numbers
- toggle printing command prompt | [] |
https://avatars.githubusercontent.com/u/37394523?v=4 | zig-learn-it24 | ziteh/zig-learn-it24 | 2024-08-08T23:26:21Z | Zig 程式語言範例(iThome 2024 鐵人賽) | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/ziteh/zig-learn-it24/tags | Unlicense | [
"examples",
"ithome",
"zig",
"ziglang"
] | 63 | false | 2024-09-28T02:53:25Z | false | false | unknown | github | [] | Zig 語言入門指南
<a>Zig</a> 是一個很新的通用程式語言,是靜態強型別的程序式編程語言。它在保留了 C 語言使用者最喜歡且熟悉的低階操作的同時,又藉鑒並加入了不少類似 Rust 的現代語法。主打強健、最佳化和重複利用。
<blockquote>
這是我參加 2024 iThome 鐵人賽的文章:<a>Zig 語言入門指南——聽説你是現代化的 C</a> 的程式碼庫。該系列文也同時發佈在我的 Blog:<a>Zig 入門指南(鐵人 24)</a>
</blockquote>
用法
在本地執行這些程式(<a>安裝好 Zig 後</a>):
<code>sh
git clone https://github.com/ziteh/zig-learn-it24.git
cd zig-learn-it24
bash run_all.sh</code>
如果你不想自己執行的話,可以查看 <a>Action: Run Zig</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>
Zig version: <code>0.13.0</code>
</blockquote> | [] |
https://avatars.githubusercontent.com/u/8742002?v=4 | zig-arm9 | smbl64/zig-arm9 | 2024-04-17T12:27:47Z | (WIP) Build a Zig binary for ARM926EJ-S | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/smbl64/zig-arm9/tags | - | [
"arm",
"arm926ejs",
"armv5te",
"zig"
] | 0 | false | 2024-04-22T11:59:50Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/161890530?v=4 | eva | soheil-01/eva | 2024-04-07T11:51:25Z | A Programming Language for Learning Purposes | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/soheil-01/eva/tags | - | [
"interpreter",
"parser",
"programming-language",
"recursive-descent-parser",
"zig"
] | 200 | false | 2024-05-08T08:36:51Z | true | true | unknown | github | [] | Eva
Eva is a simple, interpreted programming language designed for educational purposes. It is implemented in Zig and aims to provide a clear and understandable syntax for beginners learning about programming concepts.
Run
<code>bash
zig build run -- example/basic.eva</code>
Examples
Math Operations
<code>1 + 2 * 3 - 4 / 2; // Result: 5</code>
Variables
```
let x = 1;
x; // Result: 1
{
let y = x + 2;
y; // Result: 3
}
x = 2;
x; // Result: 2
```
Relational Operators
<code>3 > 2; // Result: true
1 < 2; // Result: true
2 > 4; // Result: false
2 >= 2; // Result: true
1 <= 1; // Result: true</code>
Equality Operators
<code>2 + 1 == 3; // Result: true
2 + 3 != 1 + 4; // Result: false</code>
IF Statement
```
let x = 1;
if (x < 2) {
x = x + 2;
}
// Result: x is now 3
x = 2;
if (x < 2) {
// do nothing
} else {
x = 10;
}
// Result: x is now 10
```
While Loop
<code>let i = 0;
while (i < 10) {
i = i + 1;
}
i; // Result: 10</code>
Do While Loop
<code>i = 0;
do {
i = i + 1;
} while (i < 1);
// Result: i is 1</code>
For Loop
<code>let x = 0;
for (let i = 0; i < 10; i = i + 1) {
x = x + 1;
}
// Result: x is 10</code>
Unary Operators
<code>!(2 > 1); // Result: false
6 / -2; // Result: -3</code>
Functions
<code>let value = 100;
def calc(x, y){
let z = x + y;
def inner(foo){
return foo + z + value;
}
return inner;
}
let fn = calc(10, 20);
fn(30); // Result: 160</code>
Lambda Functions
```
def onClick(callback) {
let x = 10;
let y = 20;
return callback(x+y);
}
onClick(lambda (data) data * 10); // Result: 300
(lambda (x) x * 2)(2); // Result: 4
let square = lambda (x) x * x;
square(4); // Result: 16
```
Recursive Functions
<code>def fact(num) {
if(num == 1) { return 1; }
return num * fact(num - 1);
}
fact(5); // Result: 120</code>
Switch Statement
<code>let x = 10;
let answer = "";
switch(x){
case 10 {
answer = "x is 10";
}
case 20 {
answer = "x is 20";
}
default {
answer = "x is neither 10 nor 20";
}
}
answer; // Result: "x is 10"</code>
Classes
```
class Point {
def constructor(self, x, y){
self.x = x;
self.y = y;
}
def calc(self){
return self.x + self.y;
}
}
let p = new Point(10,20);
p.calc(p); // Result: 30
class Point3D extends Point {
def constructor(self, x, y, z){
super(Point3D).constructor(self, x, y);
self.z = z;
}
def calc(self){
return super(Point3D).calc(self) + self.z;
}
}
let p = new Point3D(10, 20, 30);
p.calc(p); // Result: 60
```
Logical Operators
<code>5 > 3 && 4 < 3 || 5 > 2; // Result: true</code>
Imports
<code>let Math = import("math");
Math.abs(-10); // Result: 10</code> | [] |
https://avatars.githubusercontent.com/u/91665686?v=4 | Zix | Miou-zora/Zix | 2024-04-06T20:22:07Z | Spline Visualiser using Raylib + Zig + Nix | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Miou-zora/Zix/tags | MIT | [
"graphics-programming",
"nix",
"raylib",
"raylib-zig",
"splines",
"zig"
] | 545 | false | 2024-06-02T14:04:44Z | true | true | unknown | github | [] | Zix (Spline visualizer in Zig)
Zix is a spline visualizer written in zig that use Raylib for rendering and Nix for dev-env.
I will try to implement these functions:
- :white_check_mark: Bézier
- :white_check_mark: Catmull-Rom
- :white_check_mark: B-Spline
- :white_check_mark: Linear
:bookmark_tabs: Requirements
<ul>
<li>:cherry_blossom: <a>Nix</a></li>
</ul>
<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>
You will need to enable <code>nix-command</code> and <code>flakes</code>experimental features
If you get an error about it, consider this command:
<code>mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" | tee ~/.config/nix/nix.conf</code>
</blockquote>
:zap: Usage
:wrench: Setup
Clone this repository and navigate to the project directory.
<code>shell
git clone https://github.com/Miou-zora/Zix.git
cd Zix</code>
:construction_worker: Building
<code>shell
zig build</code>
:rocket: Running
```shell
It will build the project and run it. (do nothing if the project is already built)
zig build run
or you can run the executable directly
./zig-out/bin/Zix
```
<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>
<code>nix build</code> is not supported yet. If you try to use it, it will create a <code>result</code> symlink that contain the executable BUT musl isn't linked correctly to binary. It would be appreciated if someone could help me to fix this issue.
</blockquote>
:heavy_plus_sign: Using direnv
You may load the devShell automatically using <a>direnv</a>
shell integration.
<code>echo "use flake" | tee .envrc
direnv allow</code>
:art: Result
| [] |
https://avatars.githubusercontent.com/u/6431196?v=4 | chess-engine-zig | oswalpalash/chess-engine-zig | 2024-04-16T04:40:08Z | Zig Based Chess Engine | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/oswalpalash/chess-engine-zig/tags | MIT | [
"chess",
"engine",
"uci",
"zig",
"zig-lang",
"zig-package"
] | 224 | false | 2025-04-19T14:28:37Z | true | false | unknown | github | [] | Zig based Chess Engine
Project Summary
A chess engine written in zig. Mostly written as a means to learn and improve at zig.
What works?
<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> UCI Compliant
<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 Evaluation
<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> FEN Parsing
<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> Board Design and Piece Information
<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> Move Generator
<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> Unit Tests for supported 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> CI Based Testing
<strong><em>NOTE:</em></strong> This is an evolving project. No backwards compatibility guaraenteed.
How to test
<code>bash
zig build test</code>
How to run
<code>bash
zig build run</code> | [] |
https://avatars.githubusercontent.com/u/49963287?v=4 | kiwiRTOS | Kaweees/kiwiRTOS | 2024-07-30T06:40:53Z | ⏰ A minimal Real-Time Operating System (RTOS) designed for embedded applications with targets for x86_84, RISC-V (RV32I, RV64I) and ARM written in Zig. (🚧 in construction 🚧) | main | 0 | 0 | 1 | 0 | https://api.github.com/repos/Kaweees/kiwiRTOS/tags | GPL-3.0 | [
"bootloader",
"os",
"risc",
"risc-v",
"rtos",
"zig"
] | 6,218 | false | 2025-05-21T23:06:13Z | true | false | unknown | github | [] |
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
<a>
</a>
<em><a>~kiwiRTOS</a></em>
A minimal Real-Time Operating System (RTOS) designed for embedded applications with targets for x86_64, RISC-V (RV32I, RV64I) and ARM written in Zig.
Built With
<a></a>
<a></a>
<a></a>
Preview
Getting Started
Prerequisites
Before attempting to build this project, make sure you have <a>Zig</a> and <a>Nix</a> installed on your machine.
Installation
To get a local copy of the project up and running on your machine, follow these simple steps:
<ol>
<li>Clone the project repository</li>
</ol>
<code>sh
git clone https://github.com/Kaweees/kiwiRTOS.git
cd kiwiRTOS</code>
<ol>
<li>Install the project dependencies</li>
</ol>
<code>sh
nix-shell</code>
<ol>
<li>Run the project</li>
</ol>
<code>sh
just run <architecture></code>
Project Structure
<code>sh
.kiwiRTOS/
├── .github/ - GitHub Actions CI/CD workflows
├── build.zig - Zig build file
├── src/ - Project packages
│ ├── arch/ - Architecture specific code
│ │ ├── x86_64/ - x86_64 architecture specific code
│ │ ├── riscv/ - RISC-V architecture specific code
│ │ └── arm/ - ARM architecture specific code
│ ├── drivers/ - Device drivers
│ ├── kernel/ - Kernel code
│ ├── lib/ - Library code
│ └── tests/ - Project tests
├── LICENSE - Project license
└── README.md - You are here</code>
License
The source code for this project is distributed under the terms of the GNU General Public License v3.0, as I firmly believe that collaborating on free and open-source software fosters innovations that mutually and equitably beneficial to both collaborators and users alike. See <a><code>LICENSE</code></a> for details and more information.
| [] |
https://avatars.githubusercontent.com/u/49963287?v=4 | zig-riscv-assembler | Kaweees/zig-riscv-assembler | 2024-07-22T22:05:32Z | An assembler for a 32-bit RISC-V CPU Core (RV32I) written in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Kaweees/zig-riscv-assembler/tags | - | [
"assembler",
"risc",
"risc-v",
"zig"
] | 3 | false | 2024-08-24T03:47:25Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/53630?v=4 | lmdb-zig | diogok/lmdb-zig | 2024-07-30T21:54:37Z | LMDB wrapper in Zig | main | 0 | 0 | 1 | 0 | https://api.github.com/repos/diogok/lmdb-zig/tags | - | [
"lmdb",
"zig"
] | 2,514 | false | 2024-08-02T22:35:48Z | true | true | unknown | github | [
{
"commit": null,
"name": "liblmdb",
"tar_url": null,
"type": "relative",
"url": "liblmdb"
}
] | LMDB for Zig
This is a wrapper for LMDB. Includes compiling LMDB from source.
Tested with Zig 0.13.0.
Usage
Check the full documentation at https://diogok.github.io/lmdb-zig.
```zig
// This is the directory the DB will be stored
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
// We start by creating an Environment
const env = try Environment.init(tmp.dir, .{});
defer env.deinit();
// Next we get a Database handler
const db = try env.openDatabase(null);
// To write data, we begin a RW transaction
const tx = try env.beginTransaction(.ReadAndWrite);
// And use the Transaction to interact with the Database
const dbTX = tx.withDatabase(db);
// Finally, we put some data
try dbTX.put("key0", "value 0");
try dbTX.put("key1", "value 1");
try dbTX.put("key2", "value 2");
try dbTX.put("key3", "value 3");
// And commit
try tx.commit();
// Next, we start a RO transaction to read the data
const tx2 = try env.beginTransaction(.ReadOnly);
const dbTX2 = tx2.withDatabase(db);
// We can read values by key
const value0 = dbTX1.get("key0");
// We can also open a Cursor to iterate over some keys
var cursor = try dbTX2.openCursor();
defer cursor.deinit();
// Set the Cursor at a specific key
var mkv = try cursor.set("key1");
while (mkv) |kv| {
// kv[0] is the current key
// kv[1] is the current value for that key
mkv = try cursor.next();
}
// We still release the RO Transaction
try tx2.commit();
```
License
MIT | [] |
https://avatars.githubusercontent.com/u/156404?v=4 | sokol-zig-microui-example | Angluca/sokol-zig-microui-example | 2024-02-12T13:17:30Z | microui, a tiny immediate-mode ui library | main | 0 | 0 | 1 | 0 | https://api.github.com/repos/Angluca/sokol-zig-microui-example/tags | - | [
"microui",
"sokol",
"zig"
] | 27 | false | 2024-02-12T14:38:59Z | true | true | 0.12.0 | github | [
{
"commit": "e0df69dc8ca17053bfa48ecec46dde02acb4395b",
"name": "sokol",
"tar_url": "https://github.com/floooh/sokol-zig/archive/e0df69dc8ca17053bfa48ecec46dde02acb4395b.tar.gz",
"type": "remote",
"url": "https://github.com/floooh/sokol-zig"
}
] |
A <em>tiny</em>, portable, immediate-mode UI library written in Zig
<a><strong>rxi/microui</strong></a>
Features
<ul>
<li>Tiny: around <code>1100 sloc</code> of ANSI C</li>
<li>Works within a fixed-sized memory region: no additional memory is allocated</li>
<li>Built-in controls: window, scrollable panel, button, slider, textbox, label,
checkbox, wordwrapped text</li>
<li>Works with any rendering system that can draw rectangles and text</li>
<li>Designed to allow the user to easily add custom controls</li>
<li>Simple layout system</li>
</ul>
Example
```c
if (cc.mu_begin_window(ctx, "My Window", mu_rect(10, 10, 140, 86)) != 0) {
cc.mu_layout_row(ctx, 2, &[_]i32{ 60, -1 }, 0);
cc.mu_label(ctx, "First:");
if (mu_button(ctx, "Button1") != 0) {
std.debug.print("Button1 pressed\n", .{});
}
cc.mu_label(ctx, "Second:");
if (cc.mu_button(ctx, "Button2") != 0) {
cc.mu_open_popup(ctx, "My Popup");
}
if (cc.mu_begin_popup(ctx, "My Popup") != 0) {
cc.mu_label(ctx, "Hello world!");
cc.mu_end_popup(ctx);
}
cc.mu_end_window(ctx);
}
```
Screenshot
<a><strong>Browser Demo</strong></a>
Usage
<ul>
<li>See <a><code>doc/usage.md</code></a> for usage instructions</li>
<li>See the <a><code>demo</code></a> directory for a usage example</li>
</ul>
Notes
The library expects the user to provide input and handle the resultant drawing
commands, it does not do any drawing itself.
Contributing
The library is designed to be lightweight, providing a foundation to which you
can easily add custom controls and UI elements; pull requests adding additional
features will likely not be merged. Bug reports are welcome.
License
This library is free software; you can redistribute it and/or modify it under
the terms of the MIT license. See <a>LICENSE</a> for details. | [] |
https://avatars.githubusercontent.com/u/58421041?v=4 | noob_http_server | abhaysp95/noob_http_server | 2024-06-23T07:55:56Z | A simple http server | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/abhaysp95/noob_http_server/tags | - | [
"http-server",
"zig",
"ziglang"
] | 64 | false | 2024-07-01T17:09:54Z | true | true | unknown | github | [] | <a></a>
Noob Http Server
This is not like prod-ready server or anything. The purpose of this project was to learn the internal mechanism of how a typical HTTP server works. Here I have built a simple server for <code>HTTP/1.1</code> protocol.
📖 Learnings
Following are the things which I learned:
<ul>
<li>Establishing connection via TCP server. </li>
<li>Reading the client request.</li>
<li>Parsing the client request (Request line, Headers & Body).</li>
<li>Forming the response (Status line, Headers & Body).</li>
<li>Sending the response back to the client.</li>
<li>Handling multiple clients (i.e., concurrent connections)</li>
<li>Handling signal sent from terminal running the server.</li>
<li>Sending over the file to client upon request.</li>
<li>Learn some bits about HTTP compression mechanism.</li>
<li>Parsing for the multiple compression schemes.</li>
<li>Support for Gzip compression.</li>
</ul>
⚡️ Requirements
The project is written in <a>Zig</a> programming language. The experience to use this language was pleasant. I would encourage for people to try it out. The comunity of the language although relatively small, has been a helping one. I would continue doing some other projects on this language.
<a></a>
Here are the steps to build the project:
<ul>
<li>Follow the steps mentioned on the <a>zig's official site</a> and setup the language.</li>
<li>Run the command <code>zig build-exe src/main.zig</code> to build the executable</li>
<li>Simply run the executable as <code>./main</code></li>
</ul>
The following project was done as part of <strong>Codecrafters</strong> challenge. You can read more about the codecrafters from below.
This is a starting point for Zig solutions to the
<a>"Build Your Own HTTP server" Challenge</a>.
<a>HTTP</a> is the
protocol that powers the web. In this challenge, you'll build a HTTP/1.1 server
that is capable of serving multiple clients.
Along the way you'll learn about TCP servers,
<a>HTTP request syntax</a>,
and more.
<strong>Note</strong>: If you're viewing this repo on GitHub, head over to
<a>codecrafters.io</a> to try the challenge. | [] |
https://avatars.githubusercontent.com/u/58421041?v=4 | intro_to_parallel_programming | abhaysp95/intro_to_parallel_programming | 2024-04-09T14:54:53Z | examples from 'introduction to parallel programming' and more | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/abhaysp95/intro_to_parallel_programming/tags | - | [
"c",
"parallel-programming",
"zig",
"ziglang"
] | 15 | false | 2024-04-09T14:57:08Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/54759461?v=4 | zig-source | zeindevs/zig-source | 2024-07-06T07:10:50Z | 📔 Zig code by learning section. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/zeindevs/zig-source/tags | - | [
"zig"
] | 86 | false | 2024-10-28T00:51:33Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/7355528?v=4 | shallenge | jstrieb/shallenge | 2024-06-21T04:39:12Z | Quick script to (naively, slowly) brute force hashes for SHAllenge. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/jstrieb/shallenge/tags | - | [
"zig",
"ziglang"
] | 2 | false | 2024-06-22T18:00:32Z | false | false | unknown | github | [] | Quick Zig script to (naively, slowly) brute force hashes for
<a>SHAllenge</a>. | [] |
https://avatars.githubusercontent.com/u/161890530?v=4 | dmidecode | soheil-01/dmidecode | 2024-03-04T11:49:21Z | dmidecode parser in zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/soheil-01/dmidecode/tags | - | [
"dmidecode",
"zig"
] | 4 | false | 2024-03-04T12:47:30Z | true | true | unknown | github | [] | DMIDecode
My first project while learning Zig. This is a Zig implementation for parsing the output of the <code>dmidecode</code> command. This is a port of <a>dmidecode-nim</a>.
Quick Start
```zig
const std = @import("std");
const DMIDecode = @import("dmidecode.zig").DMIDecode;
pub fn main() !void {
var parser = DMIDecode.init(std.heap.page_allocator);
defer parser.deinit();
<code>const sections = try parser.parse(
\\Handle 0x0036, DMI type 43, 31 bytes
\\TPM Device
\\ Vendor ID: INTC
\\ Specification Version: 2.0
\\ Firmware Revision: 500.5
\\ Strings:
\\ Insyde_ASF_001
\\ Insyde_ASF_002
\\
);
const section: DMIDecode.Section = sections.get("TPM Device").?;
std.debug.print("Handle: {s}, Title: {s}\n", .{ section.handleLine, section.title });
const vendorID = section.props.get("Vendor ID").?.val;
std.debug.print("Vendor ID: {s}\n", .{vendorID});
const strings = section.props.get("Strings").?.items;
std.debug.print("Strings: {s}, {s}\n", .{ strings.items[0], strings.items[0] });
</code>
}
```
Installation
<ol>
<li>Declare dmidecode as a project dependency with <code>zig fetch</code>:</li>
</ol>
<code>bash
zig fetch --save git+https://github.com/soheil-01/dmidecode.git#main</code>
<ol>
<li>Expose dmidecode as a module in your project's <code>build.zig</code>:</li>
</ol>
```zig
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
<code>const opts = .{ .target = target, .optimize = optimize }; // 👈
const dmidecode_mod = b.dependency("dmidecode", opts).module("dmidecode"); // 👈
const exe = b.addExecutable(.{
.name = "my-project",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("dmidecode", dmidecode_mod); // 👈
// ...
</code>
}
```
<ol>
<li>Import dmidecode into your code:</li>
</ol>
<code>zig
const dmidecode = @import("dmidecode");</code> | [] |
https://avatars.githubusercontent.com/u/58421041?v=4 | zig_aoc2023 | abhaysp95/zig_aoc2023 | 2024-03-18T16:38:36Z | Advent of Code 20232 with zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/abhaysp95/zig_aoc2023/tags | - | [
"aoc",
"aoc-in-zig",
"aoc2023",
"aoc2023-in-zig",
"zig",
"ziglang"
] | 27 | false | 2024-04-09T14:58:54Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/7075?v=4 | showcase-microservices-zig | unexist/showcase-microservices-zig | 2024-03-25T08:17:15Z | Showcase for Microservices based on Zig [MIRROR] | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/unexist/showcase-microservices-zig/tags | Apache-2.0 | [
"showcase",
"zap",
"zig"
] | 21 | false | 2024-06-06T09:13:03Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/163546630?v=4 | zon.dev | zon-dev/zon.dev | 2024-03-15T13:29:24Z | zon.dev is a website for a decentralized community. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/zon-dev/zon.dev/tags | MIT | [
"zig",
"ziglang",
"zon"
] | 5 | false | 2024-07-29T08:15:47Z | false | false | unknown | github | [] | Introducing ZON
ZON (Zig Object Notation) is a simple data format, which uses Zig's anonymous struct and array initialization syntax to declare objects.
<a>zon.dev</a> is a decentralized community site for sharing <a>Zig</a> related dependency packages
Ecosystem.
<a>Zinc</a> is a high-performance web framework written in <a>Zig</a>.
<a>Zon Hub</a> Zon Hub hosting excellent <a>Zig</a> packages.
<a>zig.wiki</a> An encyclopedia about zig. | [] |
https://avatars.githubusercontent.com/u/91234915?v=4 | zmatrix | nrdave/zmatrix | 2024-05-10T22:12:41Z | A cmatrix clone written in Zig | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/nrdave/zmatrix/tags | - | [
"zig"
] | 552 | false | 2025-05-10T04:45:17Z | true | true | 0.14.0 | github | [
{
"commit": "refs",
"name": "parg",
"tar_url": "https://github.com/judofyr/parg/archive/refs.tar.gz",
"type": "remote",
"url": "https://github.com/judofyr/parg"
},
{
"commit": "refs",
"name": "termsize",
"tar_url": "https://github.com/softprops/zig-termsize/archive/refs.tar.gz",
... | zmatrix
zmatrix is a (partial) clone of the popular
<a>cmatrix</a> program written purely in
<a>Zig</a>. It's currently just a project for me to learn
Zig as a language, but feel free to contribute any ideas/code.
Capabilities
zmatrix can replicate all core functionality of cmatrix.
This includes the basic premise (characters falling down a terminal) as well
as changing the color of the characters
zmatrix has support for the following flags (some inherited from cmatrix,
others are original):
- a: Asynchronous scroll - columns of characters move at different speeds
- b: Bold - characters can be in bold
- B: All bold - all characters are bold
- C [color]: set the desired character color
- g [color]: set the desired background color.
- If no option is provided, the background will be the terminal's black
color
- This option is provided since zmatrix does not set a background color by
default, unlike newer builds of cmatrix.
- h: Help - print this help message
- r: rainbow: random colors for each character
- Note: unlike cmatrix's rainbow mode, the color of a character does not
change
Building zmatrix
zmatrix is a purely Zig project, so the only thing you need to install is the
Zig compiler (downloads <a>here</a>).
Once installed, all you need to do is clone the repo (or download an extract
an archive) and run <code>zig build</code> to compile zmatrix for your system.
Alternatively, you can run <code>zig build run</code> to compile and immediately run
zmatrix.
On first build, you will need an internet connection so the compiler can fetch
the dependencies (see below).
Dependencies
zmatrix depends on:
- <a>zig-termsize</a>: a library for
determining the terminal size regardless of platform. It's simple, but why
reinvent the wheel.
- <a>parg</a>: "parg is a lightweight argument
parser for Zig which focuses on a single task: Parsing command-line
arguments into positional arguments and long/short flags" - parg README
Unlike cmatrix, zmatrix does not depend on ncurses. This was done for a few
reasons, including
<ol>
<li>I don't know how to add ncurses as a dependency</li>
<li>Using ncurses would make compilation for different targets much harder</li>
<li>All I need for zmatrix is ANSI terminal codes, which can be set up rather
easily</li>
</ol> | [] |
https://avatars.githubusercontent.com/u/1713384?v=4 | zig-installer | exilesprx/zig-installer | 2024-04-05T03:38:37Z | null | main | 0 | 1 | 0 | 1 | https://api.github.com/repos/exilesprx/zig-installer/tags | MIT | [
"go",
"installer",
"zig"
] | 102 | false | 2025-05-14T21:19:53Z | false | false | unknown | github | [] | Zig and ZLS Installer
This program installs Zig and the Zig Language Server (ZLS). You can choose to install both or just one of them.
<strong>Note:</strong> This program must be run as root. Use <code>sudo</code> when executing the binary.
<blockquote>
<strong>Platform Support:</strong> Linux is fully supported. macOS builds are currently a work in progress.
</blockquote>
Prerequisites
Before running the program, ensure you have the following dependencies installed:
<ul>
<li><code>wget</code> (for downloading Zig binary)</li>
<li><code>git</code> (for downloading ZLS)</li>
<li><code>jq</code> (for parsing version information)</li>
<li><code>minisign</code> (for verifying Zig download)</li>
<li><code>xz</code> (for extracting archives)</li>
</ul>
Installation
<ol>
<li>Clone the repository or download the pre-built binary for your platform.</li>
<li>If downloading the source code, build the program:</li>
</ol>
<code>bash
go build</code>
Or use the justfile if available:
<code>bash
just build</code>
<ol>
<li>Run the program with the desired options.</li>
</ol>
Usage
<code>bash
sudo ./zig-install-{platform} [command] [OPTIONS]</code>
Commands
<ul>
<li><code>install</code>: Install Zig and/or ZLS (default if no command specified)</li>
<li><code>version</code>: Show version information about the installer</li>
<li><code>env</code>: Generate a template .env file</li>
</ul>
Options
<ul>
<li><code>--zig-only</code>: Install only Zig</li>
<li><code>--zls-only</code>: Install only ZLS (Zig Language Server)</li>
<li><code>--verbose</code>: Show detailed output during installation</li>
<li><code>--no-color</code>: Disable colored output</li>
<li><code>--env <file></code>: Specify a custom environment file (default: <code>.env</code>)</li>
<li><code>--settings</code>: Show current configuration settings</li>
<li><code>--log-file <file></code>: Specify log file (default: <code>zig-install.log</code>)</li>
<li><code>--enable-log</code>: Enable/disable logging to file (enabled by default)</li>
<li><code>--version, -v <version></code>: Specify Zig version to install (default: latest master)</li>
</ul>
Configuration
This program can be configured in two ways (in order of precedence):
<ol>
<li><strong>Command-line flags</strong>: Options provided directly when running the program</li>
<li><strong>Configuration file</strong>: Settings in an <code>.env</code> file</li>
</ol>
Before running the program, it will check for required dependencies like <code>wget</code>, <code>git</code>, <code>jq</code>, <code>minisign</code>, and <code>xz</code>. If any are missing, it will inform you so you can install them.
Configuration File (.env)
You can create a <code>.env</code> file in the same directory as the executable in two ways:
1. Use the <code>env</code> command to create a template:
<code>bash
./zig-install-linux-amd64 env</code>
2. Use the <code>--generate-env</code> flag with the install command:
<code>bash
sudo ./zig-install-linux-amd64 install --generate-env</code>
You can view your current configuration settings at any time using the <code>--settings</code> flag:
<code>bash
./zig-install-linux-amd64 install --settings</code>
```
Zig download and verification
ZIG_PUB_KEY=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
ZIG_DOWN_URL=https://ziglang.org/builds/
ZIG_INDEX_URL=https://ziglang.org/download/index.json
```
The values override the defaults.
Creating a <code>.env</code> file is optional, but it allows for easy customization without modifying the source code. It allows you to update settings in the event of:
<ol>
<li>The upstream Zig project rotates their signing keys and the hardcoded default is outdated</li>
<li>The upstream Zig project has moved to a new download URL</li>
</ol>
Build-time Configuration (Linker Flags)
When building from source, you can also customize some defaults using linker flags:
<code>bash
go build -ldflags="-X 'github.com/exilesprx/zig-install/internal/config.Version=VERSION'"</code>
The justfile in this project automatically reads from the <code>.env</code> file and sets the defaults during build.
Examples
Install both Zig and ZLS (latest master):
<code>bash
sudo ./zig-install-linux-amd64 install</code>
Install only Zig:
<code>bash
sudo ./zig-install-linux-amd64 install --zig-only</code>
Install only ZLS (Zig Language Server):
<em>Note: You must have Zig installed in order to compile ZLS.</em>
<code>bash
sudo ./zig-install-linux-amd64 install --zls-only</code>
Install a specific version (both Zig and ZLS will be installed at this version):
<code>bash
sudo ./zig-install-linux-amd64 install --version 0.11.0</code>
Install only Zig at a specific version:
<code>bash
sudo ./zig-install-linux-amd64 install --zig-only --version 0.11.0</code>
Install only ZLS (will use current Zig version regardless of --version):
<code>bash
sudo ./zig-install-linux-amd64 install --zls-only --version 0.11.0 # Note: version will be ignored</code>
Install with verbose output and custom log file:
<code>bash
sudo ./zig-install-linux-amd64 install --verbose --log-file custom.log</code>
Display the current settings:
<code>bash
./zig-install-linux-amd64 install --settings</code>
Generate a template .env file:
<code>bash
./zig-install-linux-amd64 env</code>
Show version information:
<code>bash
./zig-install-linux-amd64 version</code>
Version Management
The installer manages Zig and ZLS versions in the following way:
<ul>
<li>When using <code>--version</code>, both Zig and ZLS will be installed at the specified version to ensure compatibility</li>
<li>When using <code>--zig-only</code> with <code>--version</code>, only Zig will be installed at the specified version</li>
<li>When using <code>--zls-only</code> with <code>--version</code>, ZLS will be installed matching your current Zig version, ignoring the specified version</li>
<li>If no version is specified, the latest master versions will be used</li>
</ul>
This versioning strategy ensures that Zig and ZLS remain compatible with each other.
Notes
<ul>
<li>This program must be run as root as it installs software to system directories</li>
<li>Configuration via .env file allows for easy customization without rebuilding</li>
<li>Logging is enabled by default to <code>zig-install.log</code>, but can be configured or disabled</li>
<li>The program performs automatic dependency checks before installation</li>
<li>Both Zig and ZLS installations preserve file ownership for non-root users</li>
</ul>
License
This project is licensed under the MIT License. | [] |
https://avatars.githubusercontent.com/u/1631585?v=4 | sqlite-zig | anna-hope/sqlite-zig | 2024-07-25T04:51:08Z | Tutorial from https://cstack.github.io/db_tutorial/ but in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/anna-hope/sqlite-zig/tags | GPL-3.0 | [
"database",
"recurse-center",
"sqlite",
"zig"
] | 30 | false | 2024-07-25T16:03:27Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/103554944?v=4 | perfect-tetris | TemariVirus/perfect-tetris | 2024-03-25T21:22:42Z | Blazingly fast Tetris perfect clear solver with low RAM usage | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/TemariVirus/perfect-tetris/tags | Unlicense | [
"perfect-clear",
"solver",
"tetris",
"zig"
] | 247 | false | 2025-04-13T14:01:52Z | true | true | 0.14.0 | github | [
{
"commit": "9425b94c103a031777fdd272c555ce93a7dea581",
"name": "args",
"tar_url": "https://github.com/ikskuh/zig-args/archive/9425b94c103a031777fdd272c555ce93a7dea581.tar.gz",
"type": "remote",
"url": "https://github.com/ikskuh/zig-args"
},
{
"commit": "5bb70a255025fcb2ecddfe251fa868117... | perfect-tetris
Blazingly fast Tetris perfect clear solver. Accepts input in fumen format and
outputs solutions in fumen format. For performance metrics, check out
<a>benchmarks</a>.
Usage
<code>bash
pc COMMAND [options] [INPUT]</code>
Run <code>pc COMMAND --help</code> for command-specific help.
Commands
Demo
<code>bash
pc demo [options]</code>
Demostrates the perfect clear solver's speed with a tetris playing bot. The
solver runs on a single thread in this demo.
Options
<code>-h</code>, <code>--help</code> Print the help message.
<code>-k</code>, <code>--kicks</code> Kick/rotation system to use. For kick systems that have a
180-less and 180 variant, the 180-less variant has no 180 rotations. The 180
variant has 180 rotations but no 180 kicks. Supported Values:
[<code>none</code>,<code>none180</code>,<code>srs</code>,<code>srs180</code>,<code>srsPlus</code>,<code>srsTetrio</code>] (default: <code>srsPlus</code>)
<code>-m</code>, <code>--min-height</code> The minimum height of PCs to find. (default: <code>4</code>)
<code>-n</code>, <code>--nn</code> The path to the neural network to use for the solver. The path may
be absolute, relative to the current working directory, or relative to the
executable's directory. If not provided, a default built-in NN will be used.
<code>-p</code>, <code>--pps</code> The target pieces per second of the bot. (default: <code>10</code>)
<code>-s</code>, <code>--seed</code> The seed to use for the 7-bag randomizer. If not provided, a
random value will be used.
Display
<code>bash
pc display [options] PATH</code>
Displays the perfect clear solutions saved at <code>PATH</code>. Press <code>enter</code> to display
the next solution. To seek to a specific solution, type the solution number and
press <code>enter</code>. Only supports <code>.pc</code> files.
Options
<code>-h</code>, <code>--help</code> Print the help message.
Fumen
<code>bash
pc fumen [options] INPUTS...</code>
Produces a perfect clear solution for each input fumen. Outputs each solution
to stdout as a new fumen, separated by newlines. If the fumen is inside a url,
the url will be preserved in the output. Fumen editor:
<a>https://fumen.zui.jp/#english.js</a>
Finds the shortest perfect clear solution of each input fumen. The queue is
encoded in the comment of the fumen, in the format:
<code>#Q=[<HOLD>](<CURRENT>)<NEXT1><NEXT2>...<NEXTn></code>
Outputs each solution to stdout as a new fumen, separated by newlines. If the
fumen is inside a url, the url will be preserved in the output. Fumen editor:
<a>https://fumen.zui.jp/#english.js</a>
Options
<code>-a</code>, <code>--append</code> Append solution frames to input fumen instead of making a new
fumen from scratch.
<code>-h</code>, <code>--help</code> Print the help message.
<code>-k</code>, <code>--kicks</code> Kick/rotation system to use. For kick systems that have a
180-less and 180 variant, the 180-less variant has no 180 rotations. The 180
variant has 180 rotations but no 180 kicks. Supported Values:
[<code>none</code>,<code>none180</code>,<code>srs</code>,<code>srs180</code>,<code>srsPlus</code>,<code>srsTetrio</code>] (default: <code>srs</code>)
<code>-m</code>, <code>--min-height</code> Overrides the minimum height of the PC to find.
<code>-n</code>, <code>--nn</code> The path to the neural network to use for the solver. The path may
be absolute, relative to the current working directory, or relative to the
executable's directory. If not provided, a default built-in NN will be used.
<code>-s</code>, <code>--save</code> The piece type to save in the hold slot by the end of the
perfect clear. This option is not case-sensitive. If not specified, any piece
may go into the hold slot. Supported Values: [<code>i</code>,<code>o</code>,<code>t</code>,<code>s</code>,<code>z</code>,<code>l</code>,<code>j</code>]
<code>-t</code>, <code>--output-type</code> The type of fumen to output. Overwrites the input fumen's
type even when append is true. Supported Values: [edit,list,view]
(default: view)
<code>-v</code>, <code>--verbose</code> Print solve time and solution length to stderr.
Validate
<code>bash
pc validate [options] PATHS...</code>
Validates the perfect clear solutions saved at <code>PATHS</code>. This will validate that
<code>PATHS</code> are valid .pc files and that all solutions are valid perfect clear
solutions.
Options
<code>-h</code>, <code>--help</code> Print the help message.
Version
<code>bash
pc version</code>
Prints the program's version.
Build commands
You will need to have Zig installed to build the project. You can download Zig
from <a>here</a>.
This project currently uses Zig 0.13.0.
Run
<code>bash
zig build run -- COMMAND [ARGS] [INPUT]</code>
Runs the main program. Refer to <a>usage</a> for more information. The <code>-Dstrip</code>
option may be passed to the compiler to produce a smaller binary.
Solve
<code>bash
zig build solve</code>
Finds all perfect clear solutions of a given height from an empty playfield,
and saves the solutions to disk in <a><code>.pc</code></a> format.
Settings may be adjusted in the top-level declarations in <code>src/scripts/solve.zig</code>.
Test
<code>bash
zig build test</code>
Runs all tests.
Benchmark
<code>bash
zig build bench</code>
Runs the benchmarks.
Train
<code>bash
zig build train</code>
Trains a population of neural networks to solve perfect clears as fast as
possible. The population is saved at the end of every generation.
Settings may be adjusted in the top-level declarations in <code>src/scripts/train.zig</code>.
Benchmarks
<code>txt
CPU: Intel Core i7-8700
OS: Windows 11
Run command: zig build bench -Dcpu=x86_64_v3</code>
The results below are agregated over 200 random 1st PC sequences from a 7-bag randomiser.
| PC height | Kick system | Mean time | Max time | Mean memory | Max memory |
| --------- | ----------- | --------- | --------- | ----------- | ---------- |
| 4 | SRS+ | 10.697ms | 237.634ms | 245.380KiB | 9.455MiB |
| 6 | SRS+ | 9.253ms | 217.802ms | 173.771KiB | 2.430MiB |
.pc file format
The <code>.pc</code> file format is a binary format that stores perfect clear solutions.
The <code>.pc</code> format can only store solutions with up to 15 placements, and that
start with an empty playfield. The format consists of only a list of solutions
with no padding or metadata. The format of a solution is as follows:
| Bytes | Name | Description |
| ----- | ---------- | ------------------------------------------------ |
| 0-5 | sequence | The sequence of hold and next pieces |
| 6-7 | holds | 15 binary flags indicating where holds are used |
| 8+ | placements | The list of placements that make up the solution |
Sequence
The sequence is a 6-byte integer that stores the sequence of hold and next
pieces (a total of 16 3-bit values). The sequence is stored in little-endian
order. Bits 0-2 indicate the hold piece, bits 3-5 indicate the current piece,
bits 6-8 indicate the first piece in the next queue, bits 9-11 indicate the
second piece in the next queue, etc. Each 3-bit value maps to a different
piece:
| Value | Piece |
| ----- | -------- |
| 000 | I |
| 001 | O |
| 010 | T |
| 011 | S |
| 100 | Z |
| 101 | L |
| 110 | J |
| 111 | sentinel |
Once a sentinel value is reached, all subsequent values should also be sentinel
values. If no sentinel value is reached, the sequence is assumed to have the
maximum length of 16.
Holds
The holds are stored as a 2-byte integer in little-endian order. The i-th bit
indicates whether a hold was used at the i-th placement. A <code>0</code> indicates no
hold, and a <code>1</code> indicates a hold. As there is a maxium of 15 placements, the
last bit is always <code>0</code>.
Placements
The list of placements is stored in little-endian order, and the length of this
list is always the length of the sequence minus one. Each placement is stored
as a single byte, with the following format:
| Bits | Name | Description |
| ---- | -------- | --------------------------------------------- |
| 0-1 | facing | The direction the piece is facing when placed |
| 2-7 | position | The position of the piece. x + 10y |
The type of piece is determined by the sequence and holds.
A value of '0' for facing indicates the piece is facing north; '1' indicates
east; '2' indicates south, and '3' indicates west.
Position is a value in the range [0, 59]. The x-coordinate is this value modulo
10, and the y-coordinate is this value divided by 10 (rounded down). The x- and
y-coordinates represent the center of the piece as defined by
<a>SRS true rotation</a>. The
x-axis starts at 0 at the leftmost column and increases rightwards. The y-axis
starts at 0 at the bottom row and increases upwards.
Other interesting information
Number of possible next sequences (with any hold)
| Length | Non-equivalent* |
| ------ | ----------------- |
| 0 | 7 |
| 1 | 28 |
| 2 | 196 |
| 3 | 1,365 |
| 4 | 9,198 |
| 5 | 57,750 |
| 6 | 326,340 |
| 7 | 1,615,320 |
| 8 | 6,849,360 |
| 9 | 24,857,280 |
| 10 | 79,516,080 |
| 11 | 247,474,080 |
| 12 | 880,180,560 |
| 13 | 3,683,700,720 |
| 14 | 15,528,492,000 |
| 15 | 57,596,696,640 |
| 16 | 189,672,855,120 |
| 17 | 549,973,786,320 |
| 18 | 1,554,871,505,040 |
*Two sequences are considered equivalent if the set of all possible structures
that can be built by each are equal.
PC solve chances
The chances of a perfect clear being possible in certain situations with an
empty playfield are as follows:
| Type | held piece | randomiser | rotation system | Chance | Odds |
| -------------- | ---------- | ---------- | --------------- | ------- | -------------------------- |
| 2-line, opener | none | 7-bag | SRS | 0% | 0 in 5,040 |
| 2-line | none | 7-bag | SRS | 3.3217% | 5,148 in 154,980 |
| 2-line | any | 7-bag | SRS | 3.9987% | 15,132 in 378,420 |
| 4-line, opener | none | 7-bag | SRS | 100% | 4,233,600 in 4,233,600 |
| 4-line | none | 7-bag | SRS | 100% | 57,576,960 in 57,576,960 |
| 4-line | any | 7-bag | SRS | 99.965% | 196,794,376 in 196,862,400 | | [] |
https://avatars.githubusercontent.com/u/30342951?v=4 | ChallengeGallery | MzaxnaV/ChallengeGallery | 2024-05-07T08:03:31Z | Gallery of coding train challenges I do | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/MzaxnaV/ChallengeGallery/tags | MIT | [
"coding-train",
"raylib",
"zig"
] | 154 | false | 2025-04-17T23:31:46Z | true | true | unknown | github | [] | ChallengeGallery
Gallery of <a>coding train</a> challenges I do. | [] |
https://avatars.githubusercontent.com/u/36482619?v=4 | zls-deb | jkoop/zls-deb | 2024-06-13T20:33:25Z | scripts and helper files I use to create `.deb` files from precompiled binaries of Zig language server | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/jkoop/zls-deb/tags | MIT | [
"debian-package",
"zig",
"zls"
] | 2 | false | 2024-06-13T20:40:16Z | false | false | unknown | github | [] | zls-deb
Here are the scripts and helper files I use to create <code>.deb</code> files from precompiled binaries of <a>Zig language server</a>, which I host on <a>my apt packages server</a>.
I am not endorsed by <a>@zigtools</a>. I just like their project, and see that they aren't publishing <code>.deb</code> files of their own.
Usage
<strong>The easy, trusting way:</strong>
<ol>
<li>Go to http://packages.joekoop.com and run the two commands at the top of the page.</li>
<li>Update your local indecies: <code>sudo apt update</code></li>
<li>Install ZLS: <code>sudo apt install zls</code></li>
</ol>
<strong>The slightly more difficult, less trusting way:</strong>
<ol>
<li>Clone this repo: <code>git clone https://github.com/jkoop/zls-deb.git</code></li>
<li>Change to the directory that corresponds with the version you want to package.</li>
<li>(Trust check) Read <code>make-package.sh</code> and look for anything that you don't like.</li>
<li>The script downloads the precompiled binaries and libraries from GitHub itself,</li>
<li>copies them into a new directory along with the metadata file, DEBIAN-control,</li>
<li>and builds a <code>.deb</code> file with <code>dpkg-deb</code> (<a>man page</a>).</li>
<li>Run the script: <code>./make-package.sh</code></li>
<li>The resulting <code>.deb</code> file will be in your CWD.</li>
</ol> | [] |
https://avatars.githubusercontent.com/u/35909?v=4 | nsqx | ianic/nsqx | 2024-08-03T15:45:21Z | Linux only, io_uring based nsqd daemon written in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/ianic/nsqx/tags | MIT | [
"io-uring",
"nsq",
"zig"
] | 859 | false | 2025-01-23T21:53:23Z | true | true | unknown | github | [
{
"commit": "80789e5d6dce70a2ec8b72a5a203edbe112067fe.tar.gz",
"name": "iox",
"tar_url": "https://github.com/ianic/iox/archive/80789e5d6dce70a2ec8b72a5a203edbe112067fe.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/ianic/iox"
}
] | nsqxd
<a>nsqd</a> daemon written in Zig. It is Linux only, because it uses io_uring for input/output.
Limitations/difference from nsqd:
* Linux only
* requires Linux kernel 6.0 or newer
* in memory only, no diskqueue
* no tls implementation
* no compression
* doesn't measure end to end processing latency
In other aspects functions like nsqd. Implements <a>nsq tcp</a> and <a>http</a> protocol (except the Go specific /debug/pprof endpoints). All the same client can be used to connect to. Works with nsqlookup's, nsqadmin, statsd in the same way.
Performance
Using <a>bench</a> from nsq project (to be fair; nsqd is configured to not use diskqueue raising it's mem-queue-size above max number of messages used in test).
nsqd:
<code>PUB: [bench_writer] 2025/01/09 18:58:23 duration: 10s - 527.127mb/s - 2763665.089ops/s - 0.362us/op messages: 27638800
SUB: [bench_reader] 2025/01/09 18:58:33 duration: 10s - 129.623mb/s - 679596.744ops/s - 1.471us/op messages: 6800786</code>
nsqdx:
<code>PUB: [bench_writer] 2025/01/09 19:08:50 duration: 12s - 2064.445mb/s - 10823639.233ops/s - 0.092us/op messages: 129885400
SUB: [bench_reader] 2025/01/09 19:09:00 duration: 10s - 2149.133mb/s - 11267647.191ops/s - 0.089us/op messages: 112745333</code>
nsqdx performs roughly 4 times better in writes and more than 16 time better in reads.
Using bench from the project to read and write in the same time gives throughput of almost 5Gb/s on my system (Intel i9-13900, I226-V NIC). Both nsqxd, reader and writer are running on the same host.
<code>[bench_writer] 2025/01/09 19:13:51 duration: 10s - 2409.497mb/s - 12632702.142ops/s - 0.079us/op messages: 126328400
[bench_reader] 2025/01/09 19:13:51 duration: 10s - 2408.409mb/s - 12626996.800ops/s - 0.079us/op messages: 126330200
[bench_writer] 2025/01/09 19:14:01 duration: 10s - 2427.462mb/s - 12726890.058ops/s - 0.079us/op messages: 127270600
[bench_reader] 2025/01/09 19:14:01 duration: 10s - 2427.336mb/s - 12726233.717ops/s - 0.079us/op messages: 127280800
[bench_writer] 2025/01/09 19:14:11 duration: 10s - 2433.169mb/s - 12756813.976ops/s - 0.078us/op messages: 127570600
[bench_reader] 2025/01/09 19:14:11 duration: 10s - 2432.899mb/s - 12755395.118ops/s - 0.078us/op messages: 127582711
[bench_writer] 2025/01/09 19:14:21 duration: 10s - 2395.150mb/s - 12557481.585ops/s - 0.080us/op messages: 125576200
[bench_reader] 2025/01/09 19:14:21 duration: 10s - 2395.069mb/s - 12557059.634ops/s - 0.080us/op messages: 125590489
[bench_writer] 2025/01/09 19:14:31 duration: 10s - 2419.875mb/s - 12687111.974ops/s - 0.079us/op messages: 126872400
[bench_reader] 2025/01/09 19:14:31 duration: 10s - 2419.806mb/s - 12686752.558ops/s - 0.079us/op messages: 126889600
[bench_writer] 2025/01/09 19:14:41 duration: 10s - 2351.639mb/s - 12329362.387ops/s - 0.081us/op messages: 123295000
[bench_reader] 2025/01/09 19:14:41 duration: 10s - 2351.526mb/s - 12328770.982ops/s - 0.081us/op messages: 123317759
[bench_writer] 2025/01/09 19:14:51 duration: 10s - 2382.419mb/s - 12490738.464ops/s - 0.080us/op messages: 124908600
[bench_reader] 2025/01/09 19:14:51 duration: 10s - 2382.622mb/s - 12491801.432ops/s - 0.080us/op messages: 124940041</code> | [] |
https://avatars.githubusercontent.com/u/183031282?v=4 | zig-flx | the-flx/zig-flx | 2024-03-08T07:24:03Z | Zig bindings for flx-c | master | 3 | 0 | 1 | 0 | https://api.github.com/repos/the-flx/zig-flx/tags | MIT | [
"flx",
"fuzzy",
"zig"
] | 57 | false | 2024-12-02T18:03:10Z | true | true | unknown | github | [] | <a></a>
<a></a>
zig-flx
<blockquote>
Zig bindings for flx-c
</blockquote>
<a></a>
<a></a>
🔧 Usage
```zig
const std = @import("std");
const flx = @import("flx");
pub fn main() !void {
const result = flx.score("switch-to-buffer", "stb");
std.debug.print("Score: {d}", .{result.*.score});
}
```
💾 Installation
<ol>
<li>Add the dependency to the <code>build.zig.zon</code> of your project.</li>
</ol>
<code>zig
.dependencies = .{
.flx = .{
.url = "https://github.com/the-flx/zig-flx/archive/9370accf3bb09a9e27a8c3a6ed7181cecc6679be.tar.gz",
.hash = "12205a4519fc774374102a05b52a460e4598019dc775d7fb535517171a45abad3a08",
},
},</code>
<ol>
<li>Add the dependency and module to your <code>build.zig</code>.</li>
</ol>
<code>zig
const flx_dep = b.dependency("flx", .{});
const flx_mod = flx_dep.module("flx");
exe.addModule("flx", flx_mod);</code>
<ol>
<li>Import it inside your project.</li>
</ol>
<code>zig
const flx = @import("flx");</code>
<em>📝 P.S. See <a>examples</a> for full example!</em>
⚜️ License
<code>zig-flx</code> is distributed under the terms of the MIT license.
See <a><code>LICENSE</code></a> for details.
| [] |
https://avatars.githubusercontent.com/u/109950820?v=4 | my-process-manager | DreamerChaserHAH/my-process-manager | 2024-04-27T10:54:08Z | Windows-Task Manager Inspired Process Manager in C++ with ImGUI | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/DreamerChaserHAH/my-process-manager/tags | - | [
"cpp",
"imgui-glfw",
"portfolio-pro",
"process-manager",
"zig"
] | 5 | false | 2024-04-27T10:58:29Z | true | false | unknown | github | [] | My Process Manager
A process manager made with C++ (inspired by Windows Task Manager)
<strong>Frameworks</strong>
ImGUI \
GLFW \
OpenGL
<strong>Languages</strong>
C++ \
Zig 0.12.0 (for build system)
Commands
Run Debug build
<code>make debug-run</code>\
Run Release build
<code>make release-run</code> | [] |
https://avatars.githubusercontent.com/u/112193680?v=4 | numto | nitrogenez/numto | 2024-03-22T14:34:25Z | A utility that converts an input number into different representations (hexadecimal, decimal, etc.) | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/nitrogenez/numto/tags | BSD-3-Clause | [
"cli",
"utility",
"zig",
"ziglang"
] | 3 | false | 2024-03-22T17:34:00Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/22549550?v=4 | httpz | EloToJaa/httpz | 2024-07-15T13:23:25Z | An example HTTP API written in Zig based on httpz | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/EloToJaa/httpz/tags | - | [
"api",
"httpz",
"zig",
"ziglang"
] | 3 | false | 2024-07-23T19:21:13Z | true | true | unknown | github | [
{
"commit": "3a3ef453efc1eceb74401b42228f4f890a954a20.tar.gz",
"name": "httpz",
"tar_url": "https://github.com/karlseguin/http.zig/archive/3a3ef453efc1eceb74401b42228f4f890a954a20.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/karlseguin/http.zig"
}
] | 404 | [
"https://github.com/Chanyon/Xjournal",
"https://github.com/EloToJaa/httpz",
"https://github.com/Strum355/wdnas-exporter",
"https://github.com/cztomsik/tokamak",
"https://github.com/deatil/zig-say",
"https://github.com/dgv/mup",
"https://github.com/dgv/play.zig",
"https://github.com/dgv/zig-htmx-tailwi... |
https://avatars.githubusercontent.com/u/38223894?v=4 | zigdump | lpg2709/zigdump | 2024-05-15T23:25:12Z | Tool to view files in hexadecimal format, like xxd, but in zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/lpg2709/zigdump/tags | - | [
"hexdump",
"xxd",
"zig"
] | 5 | false | 2024-05-15T23:29:01Z | true | true | unknown | github | [] | zigdump
Tool to view files in hexadecimal format, like xxd, but in <a>zig</a>.
<blockquote>
Not include all funcitions from xxd, this is only a program to studies.
</blockquote>
Build
Setup zig in your machine. Developed on zig 0.12.0
<code>sh
zig build</code>
Executable inside <code>./zig-out/bin</code>.
References
<ul>
<li><a>Zig Doc</a></li>
<li><a>Zig Standar Library</a></li>
<li><a>xxd man</a></li>
<li><a>xxd source code</a></li>
</ul>
Benchmark
<ul>
<li><strong>Compiled with: <code>zig build -Doptimize=Debug</code></strong></li>
</ul>
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:------------------------------|---------------:|--------:|--------:|------------:|
| <code>xxd ./zig</code> | 44.780 ± 1.379 | 42.368 | 47.603 | 1.00 |
| <code>./zig-out/bin/zigdump ./zig</code> | 47.753 ± 0.386 | 47.420 | 48.423 | 1.07 ± 0.03 |
<ul>
<li><strong>Compiled with: <code>zig build -Doptimize=ReleaseSafe</code></strong></li>
</ul>
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:------------------------------|---------------:|-------:|-------:|------------:|
| <code>xxd ./zig</code> | 44.106 ± 0.868 | 42.578 | 45.315 | 5.94 ± 0.12 |
| <code>./zig-out/bin/zigdump ./zig</code> | 7.421 ± 0.033 | 7.371 | 7.466 | 1.00 |
<ul>
<li><strong>Compiled with: <code>zig build -Doptimize=ReleaseFast</code></strong></li>
</ul>
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:------------------------------|---------------:|-------:|-------:|------------:|
| <code>xxd ./zig</code> | 47.417 ± 2.821 | 44.298 | 50.783 | 7.12 ± 0.42 |
| <code>./zig-out/bin/zigdump ./zig</code> | 6.663 ± 0.033 | 6.619 | 6.704 | 1.00 |
<ul>
<li><strong>Compiled with: <code>zig build -Doptimize=ReleaseSmall</code></strong></li>
</ul>
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:------------------------------|---------------:|--------:|--------:|------------:|
| <code>xxd ./zig</code> | 49.071 ± 0.404 | 48.554 | 49.711 | 5.34 ± 0.08 |
| <code>./zig-out/bin/zigdump ./zig</code> | 9.187 ± 0.120 | 9.088 | 9.510 | 1.00 |
Only for fun. There is a lot of difference in implemented features
Used <a>hyperfine</a> for benchmark.
All tests made with <code>zig</code> 0.12.0 binary, with the follow script
```sh
!/bin/bash
options=("Debug" "ReleaseSafe" "ReleaseFast" "ReleaseSmall")
bin="./zig"
if [ ! -d "logs" ]; then
mkdir logs
fi
for opt in "${options[@]}"; do
echo ">> Compiling for options ${opt} ..."
zig build -Doptimize=${opt}
if [ "$?" -eq 0 ]; then
echo ">> Making benchmark for ${opt}"
./hyperfine --export-markdown "logs/${opt}.md" --warmup 3 "xxd $bin" "./zig-out/bin/zigdump $bin"
else
echo ">> Compilation fail!"
fi
done
echo ">> Done"
```
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> View data in hexadecimal and printable characters
<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> Switch to bits. <code>-b | -bits</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> Select column size by <code>-c | -cols</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> Separate the output of evrey byte by a whitespace <code>-g | -groupsize</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> Stop after writing some octets <code>-l | -len</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> Start read from byte <code>-s | -seek</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> Hexa output in uppercase letters <code>-u</code>
<blockquote>
Maybe in the future, but not now?
</blockquote> | [] |
https://avatars.githubusercontent.com/u/85593302?v=4 | saltos | svelterust/saltos | 2024-04-21T14:51:16Z | Tutorial for creating an x86 operating system from scratch using Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/svelterust/saltos/tags | - | [
"osdev",
"tutorial",
"x86",
"zig"
] | 1 | false | 2024-04-21T14:52:18Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/49799321?v=4 | ring-buffer | ruy-dan/ring-buffer | 2024-07-28T18:00:34Z | A Ring Buffer implementation with a fixed-size buffer, developed in Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/ruy-dan/ring-buffer/tags | MIT | [
"ring-buffer",
"zig"
] | 6,009 | false | 2025-01-10T18:14:52Z | true | true | 0.13.0 | github | [] | ring-buffer
A Ring Buffer implementation with a fixed-size buffer.
Usage
```zig
const RingBuffer = @import("ring-buffer").RingBuffer;
var buffer = try RingBuffer([]const u8, .{ .capacity = 2 }).init();
try buffer.write("hello");
try buffer.write("circular");
_ = try buffer.read(); // hello
_ = try buffer.read(); // circular
try buffer.write("world");
_ = try buffer.read(); // world
```
Install
<code>sh
zig fetch --save https://github.com/ruy-dan/ring-buffer/archive/refs/heads/main.tar.gz</code>
build.zig.zon
<code>zig
.dependencies = .{
.ring_buffer = .{
.url = "https://github.com/ruy-dan/ring-buffer/archive/refs/heads/main.tar.gz",
// .hash
}
}</code>
build.zig
<code>zig
const ring_buffer = b.dependency("ring_buffer", .{
.target = target,
.optimize = optimize,
});
exe.addModule("ring-buffer", ring_buffer.module("ring-buffer"));</code>
<code>sh
zig build run</code>
API
<code>zig
pub fn RingBuffer(comptime T: type, opts: Opts) !type</code>
Creates a new RingBuffer with a fixed-size buffer.
The capacity can be set through opts. Otherwise, the default capacity is set to 1024.
Returns an error if the capacity is not a power of two.
<code>const Opts = struct { capacity: usize = 1024 };</code>
Test
<code>zig
zig test test.zig</code>
Methods
<code>isEmpty() bool</code>
Returns <code>true</code> if the ring buffer is empty, <code>false</code> otherwise.
<code>isFull() bool</code>
Returns <code>true</code> if the ring buffer is full, <code>false</code> otherwise.
<code>size() usize</code>
Returns the number of elements in the ring buffer.
<code>write(self: *Self, item: T) !void</code>
Writes an item to the ring buffer. Returns an error if the buffer is full.
<code>read(self: *Self) !T</code>
Reads an item from the ring buffer. Returns an error if the buffer is empty.
<code>clear(self: *Self) void</code>
Clears the ring buffer.
<code>print(self: Self) void</code>
Prints the contents of the ring buffer for debugging.
License
MIT | [] |
https://avatars.githubusercontent.com/u/97989036?v=4 | xxd | iambnlvn/xxd | 2024-06-18T22:31:29Z | xxd command implemented in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/iambnlvn/xxd/tags | - | [
"cli",
"unix",
"zig",
"ziglang"
] | 7 | false | 2025-04-09T16:35:58Z | true | true | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/163648948?v=4 | zig-pa1 | fcases/zig-pa1 | 2024-03-19T14:57:52Z | An exercise with ZIG and the C libraries: gtk and portaudio. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/fcases/zig-pa1/tags | MIT | [
"gtk3",
"portaudio",
"sample",
"zig"
] | 10,548 | false | 2024-09-11T09:16:31Z | true | false | unknown | github | [] | zig-pa1
An exercise with ZIG and the gtk and portaudio C libraries.
Just choose an input device in first combobox, output in second combobox. If both devices are compatible, the green led will turn on. Next step, you can push the play ... and whistle.
The first graph shows the FFT of the signal, the second draws the raw signal.
Listening Los Zigarros.
| [] |
https://avatars.githubusercontent.com/u/27396316?v=4 | zzip | mharbol/zzip | 2024-06-21T21:42:19Z | Homemade compression application written in zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/mharbol/zzip/tags | - | [
"compression",
"huffman-coding",
"rle",
"utility",
"zig"
] | 71 | false | 2024-07-24T03:39:51Z | true | true | unknown | github | [] | zzip (working title)
Compression utility written as an excuse to learn <a>Zig</a>.
Also a fun intro to simple compression concepts like <a>RLE</a>
and <a>Huffman coding</a>.
Once it's up and running will publish the standard quick-guides and other stuff like that. | [] |
https://avatars.githubusercontent.com/u/154885296?v=4 | libspec | yctai1994/libspec | 2024-06-20T14:08:05Z | A library for spectral line-shape analysis. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/yctai1994/libspec/tags | MIT | [
"automatic-differentiation",
"bfgs-algorithm",
"expectation-maximization-algorithm",
"spectral-analysis",
"zig"
] | 104 | false | 2024-08-31T20:01:59Z | true | true | unknown | github | [] | libspec
A library for spectral analysis. | [] |
https://avatars.githubusercontent.com/u/85673341?v=4 | zontact | coderloff/zontact | 2024-06-22T14:05:10Z | A simple terminal-based contact book written in Zig | main | 1 | 0 | 0 | 0 | https://api.github.com/repos/coderloff/zontact/tags | - | [
"contact-book",
"zig"
] | 6 | false | 2024-06-24T09:40:35Z | true | true | unknown | github | [] | Zontact
A simple terminal-based contact book written in Zig
| [] |
https://avatars.githubusercontent.com/u/58421041?v=4 | bittorrent_parser | abhaysp95/bittorrent_parser | 2024-05-20T16:40:29Z | Excersise done for codecrafters bittorrent primarily focuses on bencoding built on zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/abhaysp95/bittorrent_parser/tags | - | [
"bencode",
"bencode-parser",
"bittorrent",
"codecrafters",
"codecrafters-bittorrent",
"zig",
"ziglang"
] | 58 | false | 2024-12-21T12:21:49Z | false | false | unknown | github | [] | <a></a>
This is a starting point for Zig solutions to the
<a>"Build Your Own BitTorrent" Challenge</a>.
In this challenge, you’ll build a BitTorrent client that's capable of parsing a
.torrent file and downloading a file from a peer. Along the way, we’ll learn
about how torrent files are structured, HTTP trackers, BitTorrent’s Peer
Protocol, pipelining and more.
<strong>Note</strong>: If you're viewing this repo on GitHub, head over to
<a>codecrafters.io</a> to try the challenge.
Passing the first stage
The entry point for your BitTorrent implementation is in <code>app/main.zig</code>. Study
and uncomment the relevant code, and push your changes to pass the first stage:
<code>sh
git add .
git commit -m "pass 1st stage" # any msg
git push origin master</code>
Time to move on to the next stage!
Stage 2 & beyond
Note: This section is for stages 2 and beyond.
<ol>
<li>Ensure you have <code>zig (0.11)</code> installed locally</li>
<li>Run <code>./your_bittorrent.sh</code> to run your program, which is implemented in
<code>app/main.zig</code>.</li>
<li>Commit your changes and run <code>git push origin master</code> to submit your solution
to CodeCrafters. Test output will be streamed to your terminal.</li>
</ol> | [] |
https://avatars.githubusercontent.com/u/18238046?v=4 | hotreloadz | iagocq/hotreloadz | 2024-05-03T01:48:46Z | Hot reload DLLs in (almost) any executable | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/iagocq/hotreloadz/tags | - | [
"dll-injector",
"hot-reload",
"zig"
] | 9 | false | 2024-05-03T04:25:02Z | true | false | unknown | github | [] | hotreloadz
Hot reload DLLs in (almost) any executable.
Downloading
https://github.com/iagocq/hotreloadz/releases/latest
Building
Install zig 0.12.0.
Run:
<code>zig build</code>
Binaries will be available in <code>zig-out/bin</code>
Usage
Replace functions in <code>old.dll</code> with functions in <code>new.dll</code> in process <code>game.exe</code>.
<code>sh
hotreloadz.exe --process game.exe --old-lib old.dll --new-lib ./path/to/new-dll.dll</code>
Replace functions in <code>old.dll</code> with functions in <code>another-new.dll</code> in process with PID 1234.
<code>sh
hotreloadz.exe --pid 1234 --old-lib old.dll --new-lib ./path/to/another-new.dll</code>
Just load <code>yet-another-new.dll</code> without replacing any functions.
<code>sh
hotreloadz.exe --process game.exe --new-lib yet-another-new.dll</code>
Arguments explanations
- <code>--process IMAGE</code>: targets a process with the given image name. Returns a list of PIDs if multiple processes share the same name.
- <code>--pid PID</code>: targets a process with the given PID.
- <code>--new-lib PATH</code>: new library to be loaded. Will be copied to a temporary location before being loaded so the original file is still free.
- <code>--old-lib IMAGE</code>: name of the loaded library in the process that will have the corresponding functions in <code>--new-lib</code> replaced. If not specified, the new library is only loaded, no replacement occurs.
- Must specify either <code>--process</code> or <code>--pid</code>.
- Must specify <code>--new-lib</code>.
Example
<ol>
<li>Find <code>example.exe</code>, <code>original-lib.dll</code>, <code>replaced-lib.dll</code> in the build/download folder.</li>
<li>Place them in the same folder.</li>
<li>Execute <code>example.exe</code>. Notice the output of $y = 2x$</li>
<li>Execute <code>hotreloadz.exe --process example.exe --old-lib original-lib.dll --new-lib ./path/to/replaced-lib.dll</code>. Notice how the output changed to $y = x^2$</li>
</ol>
How it works
hotreloadz:
1. loads the DLL in the address space of the target process;
2. finds exported functions of the new library;
3. finds corresponding functions of the old library;
4. writes a trampoline (<code>jmp newaddress</code>) in place of the old function.
Future additions
<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> File watcher: keep watching a DLL path for updates to its content and automatically inject the file in the target process.
<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> Garbage collector: remove old DLLs from the target process's memory before loading new ones.
<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> 32-bit support: needs a new 32-bit trampoline.
<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 support: support for hot reloading on 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> Small function support: write special trampolines for functions that are too small to hold the standard trampoline. Has not been a problem yet because functions seem to be aligned to at least 16 bytes by default, but this is an assumption that can easily be broken and lead to problems.
<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> Callback functions: call special functions in the old and new libraries when they're loading and unloading.
<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> Import Address Table patching: less destructive than trampolines and works with functions of any size, but only works with DLLs that were imported in import tables of the process (DLL is loaded in process initialization), missing LoadLibrary'ed DLLs. The trampoline approach works with all DLLs, even ones loaded with LoadLibrary.
Why
I wanted a hot reloader for another project I might work on which requires replacing a DLL in a running program if I don't want to spend 30 seconds to test any changes. | [] |
https://avatars.githubusercontent.com/u/156404?v=4 | tic80-zig-template | Angluca/tic80-zig-template | 2024-02-15T03:55:48Z | zig language template for TIC-80 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Angluca/tic80-zig-template/tags | - | [
"gba",
"pico8",
"tic-80",
"tic80",
"zig"
] | 6 | false | 2024-02-15T04:10:27Z | true | false | unknown | github | [] | ZIG Starter Project Template
This is a ZIG / TIC-80 starter template. To build it, ensure you have the latest development release (<code>0.12.0-dev.2727+fad5e7a99</code> or newer), then run:
<code>zig build --release=small</code>
To import the resulting WASM to a cartridge:
<code>tic80 --fs . --cmd 'load cart.wasmp & import binary zig-out/bin/cart.wasm & save'</code>
Or from the TIC-80 console:
```
tic80 --fs .
load zig-out/bin/cart.wasmp
import binary cart.wasm
save
```
This is assuming you've run TIC-80 with <code>--fs .</code> inside your project directory.
Or easy call it :)
<code>zsh
sh run.sh</code> | [] |
https://avatars.githubusercontent.com/u/62779291?v=4 | zig-midi | shimamura-sakura/zig-midi | 2024-02-14T11:41:32Z | mini library to read midi in zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/shimamura-sakura/zig-midi/tags | MIT | [
"midi",
"zig"
] | 5 | false | 2024-02-14T14:52:33Z | false | false | unknown | github | [] | zig-midi
a library for reading MIDI file (from a memory region) in zig
usage
const midi = @import("midi.zig");
read main.zig and midi.zig for usage
this library only reads number from the file (cmd, arg1, arg2, etc.)
you need to extract things like command and channel from 'kind' by yourself.
meta event kind is in 'arg1'
data for meta and sysex event are in 'size' and 'data'
example
main.zig is a note counter that counts note on and offs.
(note that it runs for 200 times) | [] |
https://avatars.githubusercontent.com/u/74600205?v=4 | nvim-config | JungerBoyo/nvim-config | 2024-06-30T11:48:35Z | My neovim config! | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/JungerBoyo/nvim-config/tags | - | [
"c",
"cmake",
"cpp",
"embedded-development",
"linux-kernel-dev",
"nvim",
"nvim-config",
"zig"
] | 5 | false | 2024-09-16T19:09:20Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/1752509?v=4 | token-totem | flarebyte/token-totem | 2024-07-08T20:47:34Z | Token Totem: Weaving the Fabric of AI Stories | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/flarebyte/token-totem/tags | MIT | [
"zig",
"zig-cli"
] | 54 | false | 2025-03-08T20:28:05Z | false | false | unknown | github | [] | 404 | [] |
https://avatars.githubusercontent.com/u/1970306?v=4 | zig-documentation-0.13.0-examples | rustkas/zig-documentation-0.13.0-examples | 2024-07-07T13:37:58Z | Examples, based on documentation | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/rustkas/zig-documentation-0.13.0-examples/tags | - | [
"zig",
"ziglang"
] | 30 | false | 2024-07-08T11:42:43Z | false | false | unknown | github | [] | Zig documentation 0.13.0 examples
Examples, based on documentation | [] |
https://avatars.githubusercontent.com/u/377802?v=4 | note-about-zig | samwhelp/note-about-zig | 2024-07-24T07:00:08Z | note-about-zig | gh-pages | 0 | 0 | 0 | 0 | https://api.github.com/repos/samwhelp/note-about-zig/tags | MIT | [
"zig",
"zig-lang"
] | 5 | false | 2024-07-25T00:04:41Z | false | false | unknown | github | [] | 首頁
| Link | GitHub |
| ---- | ------ |
| <a>Zig 探索筆記</a> | <a>GitHub</a> |
主題
<ul>
<li><a>相關筆記</a></li>
</ul>
相關筆記
| Link | GitHub |
| ---- | ------ |
| <a>River 探索筆記</a> | <a>GitHub</a> |
Samwhelp
<ul>
<li><a>個人筆記</a></li>
</ul> | [] |
https://avatars.githubusercontent.com/u/135217?v=4 | zraysm | gthvn1/zraysm | 2024-06-13T23:48:02Z | Experimenting with Zig, Raylib and WebAssembly | master | 2 | 0 | 0 | 0 | https://api.github.com/repos/gthvn1/zraysm/tags | GPL-3.0 | [
"raylib",
"wasm",
"zig"
] | 67 | false | 2024-07-02T11:43:09Z | true | false | unknown | github | [] | [Z]ig & [Ray]lib & Wa[sm]
Overview
<ul>
<li>Experimentation around Zig, Raylib and Wasm.</li>
<li>A game in Zig using Raylib bindings and allowing plugins written in Wasm...</li>
<li>Currently we are able to use Raylib and build a small WAT file.</li>
</ul>
Installation
Requirements
<ul>
<li>To use <em>Zraysm</em> you will need <a>Raylib</a> and <a>Wasmer</a>.</li>
<li>For information we are testing with the following versions:<ul>
<li>Raylib: Release v5.0</li>
<li>Wasmer: Release v4.3.2</li>
</ul>
</li>
</ul>
Install <em>Raylib</em> header and library
<ul>
<li>You need to build <a>Raylib</a></li>
<li>Create a directory called <em>raylib</em> (or modify <em>build.zig</em>)</li>
<li>Then copy the <code>raylib.h</code>, <code>raymath.h</code> and <code>libraylib.a</code> into the <em>raylib/</em> directory</li>
<li>As <em>Raylib</em> has a <code>build.zig</code> file it should be easy to build it with <em>Zraysm</em></li>
</ul>
Install <em>Wasmer</em> headers and library
<ul>
<li>Download <a>Wasmer</a></li>
<li>Create a directory <em>wasmer</em></li>
<li>go into the directory and untar the previously downloaded release</li>
<li>
we only need <code>lib/libwasmer.so</code> and the <code>include/*</code> but you can keep other stuff
</li>
<li>
After installing <em>Raylib</em> and <em>Wasmer</em> you should have a tree like:
<code>.
├── build.zig
├── LICENSE
├── raylib
│ ├── libraylib.a
│ ├── raylib.h
│ └── raymat.h
├── README.md
├── samples
│ ...
├── src
│ ...
├── wasmer
│ ├── include
│ │ ├── README.md
│ │ ├── wasmer.h
│ │ ├── wasmer_wasm.h
│ │ ├── wasm.h
│ │ └── wasm.hh
│ ├── lib
│ │ └── libwasmer.so
│ └── LICENSE</code>
</li>
</ul>
Run <em>Zraysm</em>
<ul>
<li>We have an issue using <code>libwasmer.a</code> so to run it:</li>
<li><code>zig build && LD_LIBRARY_PATH=./wasmer/lib ./zig-out/bin/zraysm ./src/wat/gcd.wat</code></li>
<li>or you can just do: <code>zig build run</code></li>
<li><strong>Note</strong>: only wasm function that takes two i32 arguments and returns one i32 can be called for now</li>
</ul>
Changelog
<strong>2024-06-24</strong> Gthvn1 <a>gthvn1@gmail.com</a>
* Draw a ship
<strong>2024-06-21</strong> Gthvn1 <a>gthvn1@gmail.com</a>
* Read the WAT file as the first argument of <code>Zraysm</code>
* Read a WAT file instead of using the string
<strong>2024-06-20</strong> Gthvn1 <a>gthvn1@gmail.com</a>
* Run a WAT string into our Zig code using Wasmer
* It is the example in the <em>wasmer/include/README.md</em>
<strong>2024-06-17</strong> Gthvn1 <a>gthvn1@gmail.com</a>
* Add samples of wasmtime C API
* don't know if we will use wasmtime or another runtime.
<strong>2024-06-15</strong> Gthvn1 <a>gthvn1@gmail.com</a>
* Add simple example of using WAT file into HTML
* It runs outside of Zig
* Link our program with Raylib
* Calling a C function from Zig (see foo)
* Initial commit
Screenshots
First ship...
| [] |
https://avatars.githubusercontent.com/u/19251040?v=4 | Pequi | hd1fernando/Pequi | 2024-07-17T12:05:54Z | Just a fiscal code validator in order to learn Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/hd1fernando/Pequi/tags | - | [
"cpf-validador",
"zig"
] | 9 | false | 2024-08-21T13:38:01Z | true | true | unknown | github | [] | Pequi
Just a fiscal code validator in order to learn Zig | [] |
https://avatars.githubusercontent.com/u/35233963?v=4 | apricot | OsoGran/apricot | 2024-06-25T01:34:04Z | A simple file manager written in Zig with Vim like key-bindings. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/OsoGran/apricot/tags | MIT | [
"fileexplorer",
"zig"
] | 10 | false | 2024-09-08T00:16:44Z | false | false | unknown | github | [] | apricot
<a></a>
<a></a>
<code>apricot</code> is a terminal file manager with vim like keybindings, written in C++. <a>Ranger</a> and <a>cfiles</a> have heavily inspired me to create apricot. Apricot is intended to be quick, memory safe, minimal, and easy to use.
Dependencies
Compiling and Installation
To compile, run | [] |
https://avatars.githubusercontent.com/u/22549550?v=4 | zap | EloToJaa/zap | 2024-07-12T19:15:54Z | An example HTTP API written in Zig based on zap | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/EloToJaa/zap/tags | - | [
"api",
"zap",
"zig",
"ziglang"
] | 7 | false | 2024-07-23T19:21:52Z | true | true | unknown | github | [
{
"commit": "v0.8.0.tar.gz",
"name": "zap",
"tar_url": "https://github.com/zigzap/zap/archive/v0.8.0.tar.gz.tar.gz",
"type": "remote",
"url": "https://github.com/zigzap/zap"
}
] | zap
Example API using zap and zig | [
"https://github.com/0x4c756e61/ZDSM",
"https://github.com/Ashu11-A/zig-rest-api",
"https://github.com/BitlyTwiser/zlog",
"https://github.com/EloToJaa/zap",
"https://github.com/EngineersBox/Flow",
"https://github.com/Lajule/hsminer",
"https://github.com/OsakiTsukiko/nimrod",
"https://github.com/QubitSy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.