Dataset Viewer
avatar_url
stringlengths 46
53
| name
stringlengths 1
41
| full_name
stringlengths 7
49
| created_at
stringlengths 20
20
| description
stringlengths 1
387
| default_branch
stringclasses 40
values | open_issues
int64 0
4.52k
| stargazers_count
int64 0
77k
| forks_count
int64 0
2.98k
| watchers_count
int64 0
77k
| tags_url
stringlengths 41
83
| license
stringclasses 27
values | topics
sequencelengths 0
20
| size
int64 0
4.63M
| fork
bool 2
classes | updated_at
stringlengths 20
20
| has_build_zig
bool 2
classes | has_build_zig_zon
bool 2
classes | readme_content
stringlengths 3
468k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
https://avatars.githubusercontent.com/u/32980656?v=4 | raylib-zig | Not-Nik/raylib-zig | 2020-02-15T09:58:13Z | Manually tweaked, auto-generated raylib bindings for zig. https://github.com/raysan5/raylib | devel | 12 | 1,013 | 171 | 1,013 | https://api.github.com/repos/Not-Nik/raylib-zig/tags | MIT | [
"binding",
"bindings",
"game-development",
"gamedev",
"raylib",
"zig",
"zig-package"
] | 3,117 | false | 2025-03-22T21:31:30Z | true | true | 
# raylib-zig
Manually tweaked, auto-generated [raylib](https://github.com/raysan5/raylib) bindings for zig.
Bindings tested on raylib version 5.6-dev and Zig 0.14.0
Thanks to all the [contributors](https://github.com/Not-Nik/raylib-zig/graphs/contributors) for their help with this
binding.
## Example
```zig
const rl = @import("raylib");
pub fn main() anyerror!void {
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
defer rl.closeWindow(); // Close window and OpenGL context
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!rl.windowShouldClose()) { // Detect window close button or ESC key
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(.white);
rl.drawText("Congrats! You created your first window!", 190, 200, 20, .light_gray);
//----------------------------------------------------------------------------------
}
}
```
## Building the examples
To build all available examples simply `zig build examples`. To list available examples run `zig build --help`. If you
want to run an example, say `basic_window` run `zig build basic_window`
## Building and using
### Using raylib-zig's template
* Execute `project_setup.sh project_name`, this will create a folder with the name specified
* You can copy that folder anywhere you want and edit the source
* Run `zig build run` at any time to test your project
### In an existing project (e.g. created with `zig init`)
Download and add raylib-zig as a dependency by running the following command in your project root:
```
zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
```
Then add raylib-zig as a dependency and import its modules and artifact in your `build.zig`:
```zig
const raylib_dep = b.dependency("raylib_zig", .{
.target = target,
.optimize = optimize,
});
const raylib = raylib_dep.module("raylib"); // main raylib module
const raygui = raylib_dep.module("raygui"); // raygui module
const raylib_artifact = raylib_dep.artifact("raylib"); // raylib C library
```
Now add the modules and artifact to your target as you would normally:
```zig
exe.linkLibrary(raylib_artifact);
exe.root_module.addImport("raylib", raylib);
exe.root_module.addImport("raygui", raygui);
```
If you additionally want to support Web as a platform with emscripten, you will need to use `emcc.zig` by importing
raylib-zig's build script with `const rlz = @import("raylib_zig");` and then accessing its functions with `rlz.emcc`.
Refer to raylib-zig's project template on how to use them.
### Passing build options
raylib allows customisations of certain parts of its build process such as choosing an OpenGL version, building as a
shared library or not including certain modules. You can optionally pass these options to raylib-zig dependency like so
```zig
const raylib_dep = b.dependency("raylib_zig", .{
.target = target,
.optimize = optimize,
.shared = true, // Build raylib as a shared library
.opengl_version = rlz.OpenglVersion.gl_2_1, // Use OpenGL 2.1 (requires importing raylib-zig's build script)
});
```
### Defining feature macros
raylib lets the user enable and disable options for different features, loading different file formats for images,
fonts, 3D models and audio, linkage variants. You can specify these options for your raylib-zig build by defining the
corresponding C macro before you link with it, e.g.:
```zig
raylib_artifact.root_module.addCMacro("SUPPORT_FILEFORMAT_JPG", "");
```
## Exporting for web
To export your project for the web, first install emsdk.
Once emsdk is installed, set it up by running
`emsdk install latest`
Find the folder where it's installed and run
`zig build -Dtarget=wasm32-emscripten --sysroot [path to emsdk]/upstream/emscripten`
once that is finished, the exported project should be located at `zig-out/htmlout`
### When is the binding updated?
I plan on updating it every mayor release (2.5, 3.0, etc.). Keep in mind these are technically header files, so any
implementation stuff should be updatable with some hacks on your side.
### What needs to be done?
+ _(Done)_ Set up a proper package build and a build script for the examples
+ Port all the examples
+ Member functions/initialisers
|
https://avatars.githubusercontent.com/u/19482899?v=4 | mach | hexops/mach | 2021-07-04T17:37:47Z | zig game engine & graphics toolkit | main | 152 | 3,813 | 174 | 3,813 | https://api.github.com/repos/hexops/mach/tags | NOASSERTION | [
"2d",
"3d",
"composable",
"cross-platform",
"ecs",
"entity-component-system",
"game-development",
"game-engine",
"gamedev",
"graphics",
"gui",
"open-source",
"steam-deck",
"webassembly",
"webgpu",
"zig",
"ziglang"
] | 10,250 | false | 2025-03-21T09:22:41Z | true | true | <a href="https://machengine.org">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://machengine.org/assets/media/mach/logo_dark.svg">
<img alt="mach-opus" src="https://machengine.org/assets/media/mach/logo_light.svg" height="150px">
</picture>
</a>
Zig game engine & graphics toolkit for building high-performance, truly cross-platform, robust & modular games, visualizations, and desktop/mobile GUI apps.
<a href="https://user-images.githubusercontent.com/3173176/173177664-2ac9e90b-9429-4b09-aaf9-b80b53fee49f.gif"><img align="left" src="https://user-images.githubusercontent.com/3173176/173177664-2ac9e90b-9429-4b09-aaf9-b80b53fee49f.gif" alt="gen-texture-light" height="190px"></img></a>
<a href="https://user-images.githubusercontent.com/3173176/163936001-fd9eb918-7c29-4dcc-bfcb-5586f2ea1f9a.gif"><img align="left" src="https://user-images.githubusercontent.com/3173176/163936001-fd9eb918-7c29-4dcc-bfcb-5586f2ea1f9a.gif" alt="boids" height="190px"></img></a>
<a href="https://user-images.githubusercontent.com/3173176/173177646-a3f0982c-f07b-496f-947b-265bdc71ece9.gif"><img src="https://user-images.githubusercontent.com/3173176/173177646-a3f0982c-f07b-496f-947b-265bdc71ece9.gif" alt="textured-cube" height="190px"></img></a>
## Learn more
[machengine.org](https://machengine.org)
## Join the community
Join the [Mach community on Discord](https://discord.gg/XNG3NZgCqp) to discuss this project, ask questions, get help, etc.
**We're here to make games and have fun, so please help keep the community focused on that.** No politics/heated topics are allowed. Unfortunately, the political landscape today makes it such that we must also state fascists can go f*k themselves. :) Anyone else is very welcome here.
|
https://avatars.githubusercontent.com/u/113083639?v=4 | zig-gamedev | zig-gamedev/zig-gamedev | 2021-07-16T14:14:52Z | Dev repo for @zig-gamedev libs and sample applications | main | 28 | 2,510 | 177 | 2,510 | https://api.github.com/repos/zig-gamedev/zig-gamedev/tags | MIT | [
"cross-platform",
"d3d12",
"demos",
"directx12",
"game-development",
"gamedev",
"graphics",
"libraries",
"math",
"opengl",
"physics",
"realtime",
"simd",
"webgpu",
"zig",
"ziglang"
] | 62,890 | false | 2025-03-21T00:33:31Z | true | true | # [zig-gamedev](https://github.com/zig-gamedev) dev repo
The original repo spawned in July 2021 by [Michal Ziulek](https://github.com/michal-z). This is the main development repo for the [zig-gamedev libraries](https://github.com/zig-gamedev#libraries) and [sample applications](#sample-applications-native-wgpu).
Zig is still in development. Our main branch aims to track zig nightly-ish. See [.zigversion](./.zigversion) for the last known compatible Zig version for any revision.
Libraries now live in their own repositories and are consumed using Zig's package manager. Git submodules are also included in this repo for developer convenience but are not required to build. Users that wish to use the submodules instead of remote packages can replace build.zig.zon with dev.build.zig.zon.
### Build and run the [Samples](#sample-applications-native-wgpu)
To get started on Windows/Linux/macOS try out [physically based rendering (wgpu)](https://github.com/zig-gamedev/zig-gamedev/tree/main/samples/physically_based_rendering_wgpu) sample:
```
zig build physically_based_rendering_wgpu-run
```
To get a list of all available build steps:
```
zig build -l
```
## Sample applications (native wgpu)
Some of the sample applications are listed below. More can be found in [samples](samples/) directory.
1. [physically based rendering (wgpu)](samples/physically_based_rendering_wgpu): This sample implements physically-based rendering (PBR) and image-based lighting (IBL) to achive realistic looking rendering results.<br />`zig build physically_based_rendering_wgpu-run`
<a href="samples/physically_based_rendering_wgpu"><img src="samples/physically_based_rendering_wgpu/screenshot0.jpg" alt="physically based rendering (wgpu)" height="200"></a>
1. [audio experiments (wgpu)](samples/audio_experiments_wgpu): This sample lets the user experiment with audio and observe data that feeds the hardware.<br />`zig build audio_experiments_wgpu-run`
<a href="samples/audio_experiments_wgpu"><img src="samples/audio_experiments_wgpu/screenshot.png" alt="audio experiments (wgpu)" height="200"></a>
1. [bullet physics test (wgpu)](samples/bullet_physics_test_wgpu): This sample application demonstrates how to use full 3D physics engine in your Zig programs.<br />`zig build bullet_physics_test_wgpu-run`
<a href="samples/bullet_physics_test_wgpu"><img src="samples/bullet_physics_test_wgpu/screenshot.jpg" alt="bullet physics test (wgpu)" height="200"></a>
1. [procedural mesh (wgpu)](samples/procedural_mesh_wgpu): This sample shows how to efficiently draw several procedurally generated meshes.<br />`zig build procedural_mesh_wgpu-run`
<a href="samples/procedural_mesh_wgpu"><img src="samples/procedural_mesh_wgpu/screenshot.png" alt="procedural mesh (wgpu)" height="200"></a>
1. [gui test (wgpu)](samples/gui_test_wgpu): This sample shows how to use our [zgui](libs/zgui) library.<br />`zig build gui_test_wgpu-run`
<a href="samples/gui_test_wgpu"><img src="samples/gui_test_wgpu/screenshot.png" alt="gui test (wgpu)" height="200"></a>
## Sample applications (DirectX 12)
Some of the sample applications are listed below. More can be found in [samples](samples/) directory. They can be built and run on Windows and Linux (Wine + VKD3D-Proton 2.8+):
1. [bindless](samples/bindless): This sample implements physically based shading and image based lighting to achieve realistic looking rendering results. It uses bindless textures and HLSL 6.6 dynamic resources.<br />`zig build bindless-run`
<a href="samples/bindless"><img src="samples/bindless/screenshot.png" alt="bindless" height="200"></a>
1. [rasterization](samples/rasterization): This sample application shows how GPU rasterizes triangles in slow motion.<br />`zig build rasterization-run`
<a href="samples/rasterization"><img src="samples/rasterization/screenshot.png" alt="rasterization" height="200"></a>
1. [simple raytracer](samples/simple_raytracer): This sample implements basic hybrid renderer. It uses rasterization to resolve primary rays and raytracing (DXR) for shadow rays.<br />`zig build simple_raytracer-run`
<a href="samples/simple_raytracer"><img src="samples/simple_raytracer/screenshot.png" alt="simple raytracer" height="200"></a>
1. [mesh shader test](samples/mesh_shader_test): This sample shows how to use DirectX 12 Mesh Shader.<br />`zig build mesh_shader_test-run`
<a href="samples/mesh_shader_test"><img src="samples/mesh_shader_test/screenshot.png" alt="mesh shader test" height="200"></a>
|
https://avatars.githubusercontent.com/u/1416077?v=4 | jok | Jack-Ji/jok | 2022-05-13T07:57:55Z | A minimal 2d/3d game framework for @ziglang. | main | 9 | 226 | 8 | 226 | https://api.github.com/repos/Jack-Ji/jok/tags | MIT | [
"gamedev",
"linux",
"macos",
"sdl2",
"webassembly",
"windows",
"ziglang"
] | 25,007 | false | 2025-03-21T22:17:42Z | true | true | [](/../../actions/workflows/windows_native.yml) [](/../../actions/workflows/linux_native.yml) [](/../../actions/workflows/macos_native.yml) [](/../../actions/workflows/webassembly.yml) [](/../../actions/workflows/windows_cross.yml) [](/../../actions/workflows/linux_cross.yml)
# jok
A minimal 2d/3d game framework for zig.
## What you need?
* [Zig Compiler](https://ziglang.org/download/) (Master branch always targets latest zig, use tagged release if you wanna stick to stable version)
* SDL2 Library
* Any code editor you like (consider using [zls](https://github.com/zigtools/zls) for your own favor)
## Features
* Friendly build system, very easy to setup new project
* Able to cross-compile between Windows and Linux (thanks to [ziglang](https://ziglang.org))
* Excellent rendering performance (thanks to SDL2's [geometry rendering](https://wiki.libsdl.org/SDL2/SDL_RenderGeometryRaw))
* Fully integrated Dear-ImGui
* Asset system (via [physfs](https://github.com/icculus/physfs), supports fs/zip/7zip/iso etc)
* 2D batch system
* 2D vector graphics (line/rectangle/quad/triangle/circle/bezier-curve/convex-polygon/polyline/custom-path)
* 2D sprite rendering (scale/rotate/blending/flipping/depth)
* 2D sprite sheet generation/save/load
* 2D animation system
* 2D particle system
* 2D scene management
* 2D physics system (via [chipmunk](https://chipmunk-physics.net/), optional)
* 3D batch system
* 3D skybox rendering
* 3D mesh rendering (gouraud/flat shading)
* 3D glTF 2.0 support
* 3D rigid/skeleton animation rendering/blending
* 3D lighting effect (Blinn-Phong model by default, customizable)
* 3D sprite/billboard rendering
* 3D particle system
* 3D scene management
* TrueType support, atlas generation/save/load
* SVG loading/rendering
* Sound/Music playing/mixing
* Tiled editor support (tmx/tsx loading/rendering)
* Plugin System (register/unregister/hot-reloading)
* Misc little utils, such as easing/timer/signal system
## Supported platforms
* Windows
* Linux
* MacOS
* WebAssembly
TIPS: To eliminate console terminal on Windows platform, override `exe.subsystem` with `.Windows` in your build script.
## How to start?
1. Add *jok* as your project's dependency
Add jok dependency to your build.zig.zon, with following command:
```bash
zig fetch --save git+https://github.com/jack-ji/jok.git
```
2. Use *jok*'s build script to add build step
In your `build.zig`, add:
```zig
const std = @import("std");
const jok = @import("jok");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = jok.createDesktopApp(
b,
"mygame",
"src/main.zig",
target,
optimize,
.{},
);
const install_cmd = b.addInstallArtifact(exe, .{});
b.getInstallStep().dependOn(&install_cmd.step);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(&install_cmd.step);
const run_step = b.step("run", "Run game");
run_step.dependOn(&run_cmd.step);
}
```
If you want to add emscripten support for your project, the build script needs more care:
```zig
const std = @import("std");
const jok = @import("jok");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
if (!target.result.cpu.arch.isWasm()) {
const exe = jok.createDesktopApp(
b,
"mygame",
"src/main.zig",
target,
optimize,
.{},
);
const install_cmd = b.addInstallArtifact(exe, .{});
b.getInstallStep().dependOn(&install_cmd.step);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(&install_cmd.step);
const run_step = b.step("run", "Run game");
run_step.dependOn(&run_cmd.step);
} else {
const webapp = createWeb(
b,
"mygame",
"src/main.zig",
target,
optimize,
.{
.preload_path = "optional/relative/path/to/your/assets",
.shell_file_path = "optional/relative/path/to/your/shell",
},
);
b.getInstallStep().dependOn(&webapp.emlink.step);
const run_step = b.step("run", "Run game");
run_step.dependOn(&webapp.emrun.step);
}
}
```
3. Install SDL2 library:
* Windows Platform
Download SDL2 library from [here](https://libsdl.org/), extract into your hard drive, and create file `.build_config/sdl.json` in your project directory:
```json
{
"x86_64-windows-gnu": {
"include": "D:/SDL2-2.28.5/x86_64-w64-mingw32/include",
"libs": "D:/SDL2-2.28.5/x86_64-w64-mingw32/lib",
"bin": "D:/SDL2-2.28.5/x86_64-w64-mingw32/bin"
}
}
```
If you have multiple projects, you can config path to a global `sdl.json` using environment variable, defaults to `SDL_CONFIG_PATH`.
* Linux Platform
Debian/Ubuntu:
```bash
sudo apt install libsdl2-dev
```
Fedora/CentOS:
```bash
sudo yum install SDL2-devel
```
* MacOS
```bash
brew install sdl2
```
4. Write some code!
You may import and use jok now, here's skeleton of your `src/main.zig`:
```zig
const std = @import("std");
const jok = @import("jok");
pub fn init(ctx: jok.Context) !void {
// your init code
}
pub fn event(ctx: jok.Context, e: jok.Event) !void {
// your event processing code
}
pub fn update(ctx: jok.Context) !void {
// your game state updating code
}
pub fn draw(ctx: jok.Context) !void {
// your drawing code
}
pub fn quit(ctx: jok.Context) void {
// your deinit code
}
```
Noticed yet? That's right, you don't need to write main function, `jok` got your back.
The game is deemed as a separate package to `jok`'s runtime as a matter of fact. Your
only responsibility is to provide 5 public functions:
* init - initialize your game, run only once
* event - process events happened between frames (keyboard/mouse/controller etc)
* update - logic update between frames
* draw - render your screen here (60 fps by default)
* quit - do something before game is closed
You can customize some setup settings (window width/height, fps, debug level etc), by
defining some public constants using predefined names (they're all prefixed with`jok_`).
Checkout [`src/config.zig`](https://github.com/Jack-Ji/jok/blob/main/src/config.zig).
Most of which are still modifiable at runtime.
Now, compile and run your game using command `zig build run`, have fun!
Please let me know if you have any issue or developed something interesting with this little framework.
## NOTE
**Jok** is short for **joke**, which is about how overly-complicated modern graphics programming has become.
People are gradually forgetting lots of computing techniques used to deliver amazing games on simple machines.
With so many tools, engines and computing resources at hand, however, gamedev is not as fun as it used to be.
**Jok** is an offort trying to bring the joy back, it's being developed in the spirit of retro-machines of
1990s (especially PS1), which implies following limitations:
* Custom vertex/fragment shader is not possible
* Only support [affine texture mapping](https://en.wikipedia.org/wiki/Texture_mapping#Affine_texture_mapping)
* No [depth buffer](https://en.wikipedia.org/wiki/Z-buffering)
The limitations demand developers to be both creative and careful about game's design.
## Third-Party Libraries
* [SDL2](https://www.libsdl.org) (zlib license)
* [physfs](https://github.com/icculus/physfs) (zlib license)
* [zig-gamedev](https://github.com/zig-gamedev/zig-gamedev) (MIT license)
* [chipmunk](https://chipmunk-physics.net/) (MIT license)
* [stb headers](https://github.com/nothings/stb) (MIT license)
* [nanosvg](https://github.com/memononen/nanosvg) (zlib license)
* [nativefiledialog](https://github.com/mlabbe/nativefiledialog) (zlib license)
## Built-in Fonts
* [Classic Console Neue](http://webdraft.hu/fonts/classic-console/) (MIT license)
## Games made in jok
* [A Bobby Carrot Game Clone](https://github.com/TheWaWaR/bobby-carrot)
|
https://avatars.githubusercontent.com/u/60377?v=4 | zig-gamekit | prime31/zig-gamekit | 2020-11-12T19:02:04Z | Companion repo for zig-renderkit for making 2D games | main | 3 | 130 | 15 | 130 | https://api.github.com/repos/prime31/zig-gamekit/tags | MIT | [] | 1,043 | false | 2025-03-22T20:13:11Z | true | false | # Zig GameKit
Companion repo and example implementation for [zig-renderkit](https://github.com/prime31/zig-renderkit). `GameKit` provides an example implementation of a game framework built on top of `RenderKit`. It includes the core render loop, window (via SDL), input, Dear ImGui and timing support. You can use it as a base to make a 2D game as-is or create your own 2D framework based on it.
`GameKit` provides the following wrappers around `RenderKit`'s API showing how it can be abstracted away in a real world project: `Texture`, `Shader` and `OffscreenPass`. Building on top of those types, `GameKit` then provides `Mesh` and `DynamicMesh` which manage buffers and bindings for you. Finally, the high level types utilize `DynamicMesh` and cover pretty much all that any 2D game would require: `Batcher` (quad/sprite batch) and `TriangleBatcher`.
Some basic utilities and a small math lib with just the types required for the renderer (`Vec2`, `Vec3`, `Color`, `3x2 Matrix`, `Quad`) are also included.
## Dependencies
GameKit has just one external dependency: SDL. You can install SDL with the package manager of your choice.
### Usage
- clone the repository recursively: `git clone --recursive https://github.com/prime31/zig-gamekit`
- `zig build help` to see what examples are availble
- `zig build EXAMPLE_NAME` to run an example
### Minimal GameKit Project File
```zig
var texture: Texture = undefined;
pub fn main() !void {
try gamekit.run(.{ .init = init, .render = render });
}
fn init() !void {
texture = Texture.initFromFile(std.heap.HeapAllocator, "texture.png", .nearest) catch unreachable;
}
fn render() !void {
gamekit.gfx.beginPass(.{ .color = Color.lime });
gamekit.gfx.draw.tex(texture, .{ .x = 50, .y = 50 });
gamekit.gfx.endPass();
}
```
|
https://avatars.githubusercontent.com/u/13811862?v=4 | cnbt-zig | thechampagne/cnbt-zig | 2023-04-18T12:51:09Z | Zig binding for cNBT an NBT file parser and manipulator library. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/thechampagne/cnbt-zig/tags | Apache-2.0 | [
"zig",
"zig-package"
] | 5 | false | 2023-04-22T00:47:32Z | false | false | # cnbt-zig
[](https://github.com/thechampagne/cnbt-zig/releases/latest) [](https://github.com/thechampagne/cnbt-zig/blob/main/LICENSE)
Zig binding for **cNBT** an NBT file parser and manipulator library.
### References
- [cnbt](https://github.com/chmod222/cNBT)
### License
This repo is released under the [Apache License 2.0](https://github.com/thechampagne/cnbt-zig/blob/main/LICENSE).
|
https://avatars.githubusercontent.com/u/13280758?v=4 | zig-experiments | magiruuvelvet/zig-experiments | 2023-01-08T17:42:19Z | experimenting with zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/magiruuvelvet/zig-experiments/tags | None | [
"zig",
"ziglang"
] | 9 | false | 2023-01-08T17:42:52Z | true | false | experimenting with [zig](https://ziglang.org/)
https://ziglang.org/documentation/master/
Notes:
- works with lldb debugger out of the box (readable symbol names, breakpoints, jumping...)
- allows trailing commas :)
Compile:
- `zig build`
|
https://avatars.githubusercontent.com/u/121678877?v=4 | zig-girepository | paveloom-z/zig-girepository | 2023-01-20T09:56:00Z | Zig bindings for the `girepository` library | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/paveloom-z/zig-girepository/tags | MIT | [
"girepository",
"zig"
] | 23 | false | 2023-01-20T10:14:29Z | true | false | ### Notices
#### Mirrors
Repository:
- [Codeberg](https://codeberg.org/paveloom-z/zig-girepository)
- [GitHub](https://github.com/paveloom-z/zig-girepository)
- [GitLab](https://gitlab.com/paveloom-g/zig/zig-girepository)
#### Prerequisites
Make sure you have installed:
- A development library for `gobject-introspection`
- [Zig](https://ziglang.org) (`v0.10.1`)
#### Build
To build and install the library, run `zig build install`.
To run unit tests, run `zig build test`.
See `zig build --help` for more build options.
#### Integrate
To integrate the bindings into your project:
1) Add this repository as a dependency in `zigmod.yml`:
```yml
# <...>
root_dependencies:
- src: git https://github.com/paveloom-z/zig-girepository
```
2) Make sure you have added the dependencies in your build script:
```zig
// <...>
const deps = @import("deps.zig");
const girepository_pkg = deps.pkgs.girepository.pkg.?;
// <...>
pub fn build(b: *std.build.Builder) !void {
// <...>
// For each step
inline for (steps) |step| {
// Add the library package
step.addPackage(girepository_pkg);
// Link the libraries
step.linkLibC();
step.linkSystemLibrary("gobject-introspection-1.0");
// Use the `stage1` compiler
step.use_stage1 = true;
}
// <...>
}
```
|
https://avatars.githubusercontent.com/u/6332937?v=4 | zigStringUtil | SuSonicTH/zigStringUtil | 2023-08-04T21:56:52Z | a small library with little helpers for String handling | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/SuSonicTH/zigStringUtil/tags | MIT | [
"library",
"string",
"utility",
"zig"
] | 11 | false | 2023-08-04T22:04:51Z | true | false | # zigStringUtil
a small library with little helpers for String handling.
## Builder
can be used to concatinate strings together
## Joiner
simmilar to Builder used to concatenate strings but it can add a prefix, suffix and insert delimiter
## zig module
To use this as a module in you project create a `build.zig.zon` file, adding zigStringUtil as dependency.
The url and hash are from the current master version, tested with zig 0.11.0
```zig
.{
.name = "myProject",
.version = "0.0.1",
.dependencies = .{
.zigStringUtil = .{
.url = "https://github.com/SuSonicTH/zigStringUtil/archive/66577eecdd273b626fe59b6d46b3349331fda632.tar.gz",
.hash = "1220024750ad8df560a590919c57725eda68f68f7756d443aa32a3a8be8ee21905a9",
}
}
}
```
and in your `build.zig` add the module as dependecy
```zig
const zigStringUtil = b.dependency("zigStringUtil", .{
.target = target,
.optimize = optimize,
});
```
and add it as a module to your exe/lib
```zig
//sample exe
const exe = b.addExecutable(.{
.name = "zli",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
//add module
exe.addModule("zigStringUtil", zigStringUtil.module("zigStringUtil"));
```
|
https://avatars.githubusercontent.com/u/13811862?v=4 | sfdir-zig | thechampagne/sfdir-zig | 2023-04-18T22:33:28Z | Zig binding for Single-file dir a directory listing functions. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/thechampagne/sfdir-zig/tags | Apache-2.0 | [
"zig",
"zig-package"
] | 4 | false | 2023-04-22T00:47:01Z | false | false | # sfdir-zig
[](https://github.com/thechampagne/sfdir-zig/releases/latest) [](https://github.com/thechampagne/sfdir-zig/blob/main/LICENSE)
Zig binding for **Single-file dir** a directory listing functions.
### References
- [sfdir](https://github.com/mattiasgustavsson/libs/blob/main/dir.h)
### License
This repo is released under the [Apache License 2.0](https://github.com/thechampagne/sfdir-zig/blob/main/LICENSE).
|
https://avatars.githubusercontent.com/u/8497012?v=4 | awesome-zig | apple-x-co/awesome-zig | 2022-12-16T08:07:42Z | No Description | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/apple-x-co/awesome-zig/tags | None | [
"zig"
] | 1 | false | 2022-12-16T08:26:13Z | false | false | # awesome-zig
## TLS
* [shiguredo/tls13-zig](https://github.com/shiguredo/tls13-zig) - The first TLS1.3 implementation in Zig(master/HEAD) only with std.
## PDF
* [libharu/libharu](https://github.com/libharu/libharu) - libharu - free PDF library |
https://avatars.githubusercontent.com/u/15616419?v=4 | sphagetti_adventure | Gertkeno/sphagetti_adventure | 2022-12-26T21:33:29Z | christmas present for helena | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/Gertkeno/sphagetti_adventure/tags | None | [
"wasm4",
"zig"
] | 94 | false | 2023-11-01T17:25:56Z | true | false | # Sphagetti Adventure
A game for Helena, Christmas 2022.
Written in [Zig 0.11.0](https://ziglang.org/download/) for the
[WASM-4](https://wasm4.org) fantasy console.
## Building
Build the cart by running:
```shell
zig build -Drelease-small=true
```
Then run it with:
```shell
w4 run zig-out/lib/cart.wasm
```
|
https://avatars.githubusercontent.com/u/59750184?v=4 | clip.zig | fremantle-industries/clip.zig | 2023-03-25T01:38:47Z | A declarative CLI programming language | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/fremantle-industries/clip.zig/tags | MIT | [
"cli",
"declarative",
"declarative-cli",
"zig"
] | 2 | false | 2023-03-28T04:46:21Z | true | false | # clip.zig
A declarative CLI programming language
## Development
```sh
make
```
## Test
```sh
make test
```
## Authors
- Alex Kwiatkowski - [email protected]
## License
`clip.zig` is released under the [MIT license](./LICENSE)
|
https://avatars.githubusercontent.com/u/20625305?v=4 | zig_c_cxx_build | axojhf/zig_c_cxx_build | 2023-05-20T13:07:28Z | No Description | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/axojhf/zig_c_cxx_build/tags | MIT | [
"zig"
] | 27 | false | 2023-05-24T10:15:19Z | false | false | # zig_c_cxx_build
Use the zig compilation system to compile C/C++ open source projects.
|
https://avatars.githubusercontent.com/u/508672?v=4 | zig-scratchpad | bburrier/zig-scratchpad | 2022-12-30T23:53:23Z | Exploring basic Zig concepts. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/bburrier/zig-scratchpad/tags | None | [
"zig"
] | 7 | false | 2023-01-03T22:04:42Z | false | false | # Zig Scratchpad
[Zig](https://ziglang.org/) is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software.
<img width="80px" src="docs/ziglang-logo.png">
Exploring basic Zig concepts here.
### Fibonacci
##### Development
- Install zig ([options](https://ziglang.org/learn/getting-started/#installing-zig)) `brew install zig`
- Build and run `zig run src/fib.zig -- 10`
##### Production
- Build executable `zig build-exe src/fib.zig`
- Run executable `./fib 10` |
https://avatars.githubusercontent.com/u/12962448?v=4 | configurator | star-tek-mb/configurator | 2023-02-24T18:51:14Z | Configurator | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/star-tek-mb/configurator/tags | None | [
"config",
"django",
"laravel",
"nginx",
"proxy",
"zig"
] | 6 | false | 2023-07-08T22:34:53Z | true | false | # Overview
Configurator is a template generator
# Purpose
Make my life easier to deploy my apps with nginx
# Build
Tested with Zig `0.11.0-dev.1711+dc1f50e50`
```
zig build
```
Run with
```
zig build run
```
# How to add new config
To add new config look into `main.zig` for example of predefined configurations.
For example your new config will look like:
```zig
pub const NewConfig = struct {
pub const Template = @embedFile("config.template");
var1: []const u8 = "default",
var2: []const u8 = "value",
var3: []const u8 = "or example",
};
```
Then create and place your `config.template` in `src` directory:
```
var1 = {{var1}}
var2 = {{var2}}
var3 = {{var3}}
```
Don't forget to include your `NewConfig` to list of `Configs` in `main.zig`:
```
pub const Configs = .{ NewConfig, Laravel, Django, Proxy };
```
|
https://avatars.githubusercontent.com/u/29982750?v=4 | ZIG-LEARN | rakesh740/ZIG-LEARN | 2023-08-04T06:37:29Z | No Description | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/rakesh740/ZIG-LEARN/tags | None | [
"hacktoberfest",
"zig"
] | 7 | false | 2023-10-01T13:59:25Z | false | false | # ZIG-LEARN
I am trying to learn a new language zig using resources in https://ziglang.org/learn/
|
https://avatars.githubusercontent.com/u/137411855?v=4 | amgine | JosephABudd/amgine | 2023-07-17T17:06:13Z | I'm just learning zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/JosephABudd/amgine/tags | MIT | [
"cypher",
"zig"
] | 13 | false | 2023-11-01T17:12:08Z | true | false | # amgine
## July 26, 2023
This library might be finished.
## July 18, 2023
amgine is a poly numberic substituion cypher. ( Similar to the poly alphabetic substition cyphers children create in grade school for passing secret messages around. )
This project is how I am learning zig and making a zig library. This library is working but I have not tested and used the marshalling.
I got this library to work in a zig application folder's libs/ folder so now I'm trying to use the lib with zigmod and zigmod fetch.
## The Zig Discord Team
[The **Men** and **Women** at the zig discord server](https://discord.gg/zig) have gotten me over most of my mental hurdles with their help. Now I'm thinking the Zig way and I'm really liking Zig.
|
https://avatars.githubusercontent.com/u/6756180?v=4 | 3bc-zig | kassane/3bc-zig | 2023-07-18T18:40:47Z | Raw 3BC bindings for Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/kassane/3bc-zig/tags | GPL-3.0 | [
"3bc-lang",
"ffi",
"zig",
"ziglang"
] | 22 | false | 2023-11-01T17:11:04Z | true | false | # 3bc-zig
Raw 3BC bindings for Zig.
This zig binding is designed for testing interoperability between both languages.
## Whats is [3BC language](https://3bc-lang.org/)?
Low-level language, tiny virtual machine, intermediate representation, embeddable, easy for beginners.
## Requirements
- zig [v0.12 or higher](https://ziglang.org/download)
- git for download 3bc-lang dependency
## Acknowledgements
- **Rodrigo Dornelles** is author of 3BC language. |
https://avatars.githubusercontent.com/u/5579064?v=4 | zig-xplat-cube | carljdp/zig-xplat-cube | 2023-08-11T07:43:11Z | An Experiment - Learning cross-platform Zig lang + OpenGL | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/carljdp/zig-xplat-cube/tags | None | [
"3d",
"3d-engine",
"cross-platform",
"crossplatform",
"engine3d",
"glfw",
"glfw3",
"glsl",
"opengl",
"opengl4",
"zig"
] | 319 | false | 2023-11-01T17:24:25Z | true | false |
# zig-xplat-cube
A Zig based attempt to rotate a cube on multiple platforms.
## Rationale
I want to learn Zig, and I want to learn how to make cross platform applications. I also want to learn how to make 3D graphics. This project is an attempt to do all of those things at once.
## Description
// TODO: add more detailed description
## Table of Contents
// TODO: add table of contents
# Developer Guide
## Quickstart
```shell
git clone https://github.com/carljdp/zig-xplat-cube.git
cd zig-xplat-cube
zig build run
```
## Prerequisites / Dependencies
- `zig`
- `vcpkg` - for installing `glfw` on windows
- `glfw` - for windowing and opengl context
- I have not yet decided between `glad` and `glew` for opengl loading. I'm currently using `glad` because it seems to be the more modern of the two.
- `glfw` is a C library, so we need to use `c_import` to use it in Zig.
# Project Conventions
## Structure
- `src/` - zig source files
- `src/main.zig` - main entry point
- `build.zig` - zig build config
## Configuration
- `.env` - nothing here yet
- `.env.example` - nothing here yet
# Other Stuff
## Disclaimer & Acknowledgements
Used paid versions of both ChatGPT and GitHub Copilot
## License
// TODO: choose license
|
https://avatars.githubusercontent.com/u/55260788?v=4 | zvm | Wraith29/zvm | 2023-04-08T22:20:12Z | Zig Version Manager | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Wraith29/zvm/tags | None | [
"zig"
] | 78 | false | 2023-11-01T17:12:13Z | true | false | # Zig Version Manager
As of right now, this will only work on x86_64 Windows machines,
I am looking to improve this, but it will take a while.
## Usage
* list [-i]
* lists installed versions of zig
* install \<version>
* attempt to install the specified version
* latest
* install latest version
* select \<version>
* select the specified version (if installed)
* current
* outputs current version in use
## Requirements
* `7z` executable on Path
* `pwsh` executable on Path
|
https://avatars.githubusercontent.com/u/473672?v=4 | pong | fabioarnold/pong | 2023-05-02T21:47:15Z | Pong game | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/fabioarnold/pong/tags | MIT | [
"game",
"sdl2",
"zig"
] | 10 | false | 2023-05-02T21:50:24Z | true | true | # Pong
<img alt="Screenshot" src="https://user-images.githubusercontent.com/473672/235794164-dbf07270-7629-4c3e-9a19-4228683c2b44.png" width="320">
# Config
To configure which paddle is controlled by AI edit [config.zig](src/config.zig).
# Build and run
```bash
$ zig build run
```
Tested with [Zig](https://ziglang.org) version `0.12.0-dev.1830+779b8e259`.
|
https://avatars.githubusercontent.com/u/81272124?v=4 | zig | xpdojo/zig | 2023-02-19T13:12:47Z | Zig is an imperative, general-purpose, statically typed, compiled system programming language designed by Andrew Kelley. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/xpdojo/zig/tags | MIT | [
"zig"
] | 1 | false | 2023-02-19T13:13:36Z | false | false | # zig
Zig is an imperative, general-purpose, statically typed, compiled system programming language designed by Andrew Kelley.
|
https://avatars.githubusercontent.com/u/47928703?v=4 | hello-world-zig | eavelasquez/hello-world-zig | 2023-04-10T21:34:45Z | This repository contains exercises for learning the Zig programming language. The exercises are based on the ziglings repository. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/eavelasquez/hello-world-zig/tags | None | [
"zig",
"ziglings"
] | 11 | false | 2023-04-10T21:35:56Z | false | false | # Hello World Zig
This repository contains exercises for learning the [Zig programming language](https://ziglang.org/). The exercises are based on the [ziglings](https://github.com/ratfactor/ziglings) repository.
|
https://avatars.githubusercontent.com/u/5955225?v=4 | advent-of-code-2022 | JamesErrington/advent-of-code-2022 | 2022-12-09T21:33:34Z | Advent of Code 2022 - Go + Zig | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/JamesErrington/advent-of-code-2022/tags | None | [
"advent-of-code-2022",
"golang",
"zig"
] | 42 | false | 2023-11-01T17:11:20Z | false | false | [Advent of Code 2022](https://adventofcode.com/2022)
Orginally in Go, now in Zig and OCaml too.
|
https://avatars.githubusercontent.com/u/6811788?v=4 | monocypher-zig | permutationlock/monocypher-zig | 2023-07-02T22:06:38Z | Zig bindings for the Monocypher cryptography library. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/permutationlock/monocypher-zig/tags | MIT | [
"cryptography",
"monocypher",
"zig"
] | 16 | false | 2023-07-08T04:33:23Z | true | false | # Monocypher-Zig
Monocypher-Zig aims to provide simple Zig bindings for the
[Monocypher](https://github.com/LoupVaillant/Monocypher) cryptography
library. It currently targets the Zig 10.1 release.
For most functions it simply provides a casting
interface to allow Zig code to pass slices rather than pointers
and sizes.
The incremental interface for authenticated encryption
has a more involved implementation that aims to be compatible
with the Zig Standard Library Reader/Writer interface.
The interface for Argon2 password derivation uses a passed
Allocator to allocate the workspace memory, rather than taking a void
pointer.
|
https://avatars.githubusercontent.com/u/54628577?v=4 | zigocs | C0DIC/zigocs | 2023-04-06T14:49:19Z | Документация языка программирования Zig с примерами | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/C0DIC/zigocs/tags | MIT | [
"documentation",
"programming-language",
"russian",
"russian-language",
"zig"
] | 7 | false | 2023-04-06T16:19:01Z | false | false | # zigocs
Документация (неоф.) языка программирования [Zig](https://ziglang.org/) с примерами.
Zig unofficial documentaion in Russian language
## Общая информация
- Вся документация в [docs](./docs)
- В каждой папке имеется мд-страница с документацией и файл с кодом
## Лицензия
Все под MIT-лицензией. Можно делать все, что угодно, но не присваивать проделанную работу себе
|
https://avatars.githubusercontent.com/u/23489037?v=4 | divide-zig | lacc97/divide-zig | 2023-07-02T20:36:21Z | A port of libdivide for the Zig language | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/lacc97/divide-zig/tags | BSL-1.0 | [
"zig"
] | 8 | false | 2023-07-02T20:41:56Z | true | false | # divide-zig
A port of [libdivide](https://github.com/ridiculousfish/libdivide) to Zig.
|
https://avatars.githubusercontent.com/u/60897190?v=4 | ansi | Remy2701/ansi | 2023-06-17T08:36:25Z | Library to manipulate ansi codes in zig! | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Remy2701/ansi/tags | None | [
"ansi",
"zig"
] | 4 | false | 2023-06-17T19:25:53Z | true | false | # ANSI
This library provides abstraction to write ANSI codes, this allows you to
- Set background and foreground color
- Set text mode (Bold, Italic, Strikethrough, ...)
- Erase
- Manipulate the cursor
## Installation
Clone this repository in your libs folder.
```sh
git clone https://github.com/Remy2701/ansi
```
Then add the following line in the `build.zig`:
```zig
const ansi = @import("libs/ansi/build.zig");
pub fn build(b: *Build) !void {
...
exe.addModule("ansi", ansi.module(b));
}
```
## Usage
```zig
const std = @import("std");
const ansi = @import("ansi");
pub fn main() void {
std.debug.print("Hello, {}{}World{}!\n", .{
ansi.Graphics.bold(),
ansi.Foreground.blue(),
ansi.Graphics.reset()
});
}
```
|
https://avatars.githubusercontent.com/u/24578855?v=4 | ztool | deatil/ztool | 2023-08-14T08:52:15Z | ztool 是一个使用 zig 语言开发获取文件摘要的工具 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/deatil/ztool/tags | Apache-2.0 | [
"base64",
"hash",
"md5",
"sha1",
"tools",
"zig"
] | 39 | false | 2023-08-16T02:49:06Z | true | false | # ztool
ztool 是一个使用 zig 语言开发获取文件摘要的工具
### 环境要求
- Zig >= 0.11
### 下载安装
~~~cmd
git clone github.com/deatil/ztool
~~~
### 开始使用
编译测试
~~~cmd
zig build run
~~~
运行
~~~cmd
./ztool -h
./ztool --help
./ztool -t=md5 [-i=in.txt] [-o=out.txt] [-k=key_data] [-s=1]
./ztool --type=md5 [--in=in.txt] [--out=out.txt] [--key=key_data] [--show=1]
~~~
### 参数
~~~zig
type: 类型 b64en, b64de, md5, sha1,
file_md5, file_sha1, file_sha256, file_hmacmd5, file_hmacsha1,
sha224, sha256, sha384, sha512,
sha3_224, sha3_256, sha3_384, sha3_512, hmac_md5
in: 输入文件, 默认为 in.txt
out: 输出文件, 默认为 out.txt
key: Hmac时密钥,默认为空
show: 是否在控制台显示结果,默认否
~~~
### 开源协议
* 本软件包遵循 `Apache2` 开源协议发布,在保留本软件包版权的情况下提供个人及商业免费使用。
### 版权
* 本软件包所属版权归 deatil(https://github.com/deatil) 所有。
|
https://avatars.githubusercontent.com/u/67988550?v=4 | zig-cli-hello-world | bearddan2000/zig-cli-hello-world | 2023-06-24T12:50:16Z | A POC zig program hello world. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/bearddan2000/zig-cli-hello-world/tags | None | [
"cli",
"hello",
"world",
"zig"
] | 1 | false | 2023-06-24T12:50:22Z | false | false | # zig-cli-hello-world
## Description
A POC zig program hello world.
## Tech stack
- zig
## Docker stack
- euantorano/zig
## To run
`sudo ./install.sh -u`
## To stop
`sudo ./install.sh -d`
## For help
`sudo ./install.sh -h`
|
https://avatars.githubusercontent.com/u/4605603?v=4 | advent-of-code-2022 | tiehuis/advent-of-code-2022 | 2022-12-03T02:08:53Z | https://adventofcode.com/2022 | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/tiehuis/advent-of-code-2022/tags | None | [
"advent-of-code",
"zig"
] | 24 | false | 2022-12-03T02:17:56Z | false | false | Solutions for https://adventofcode.com/2022.
```
$ zig version
0.11.0-dev.449+665eba93c
```
Run individual solutions with
```
zig run 1.zig
```
Test cases can be verified using
```
zig test 1.zig
```
|
https://avatars.githubusercontent.com/u/87276646?v=4 | Zig | tomiis4/Zig | 2023-04-15T19:09:16Z | My Zig projects with cheatsheet | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/tomiis4/Zig/tags | None | [
"cheatsheet",
"zig",
"zig-cheatsheet"
] | 7 | false | 2023-05-01T13:32:54Z | false | false | # <a href="https://ziglang.org">Zig</a> Cheatsheet <img width="50em" src="https://avatars.githubusercontent.com/u/27973237?s=160&v=4">
<table>
<td>
* [File](#file)
* [Hello world](#hello-world)
* [Importing packages](#importing-packages)
* [Variables & Types](#variables)
* [structs](#structs)
* [map](#map)
* [Functions](#functions)
* [Logic statements](#logic-statements)
* [if/else](#ifelse)
* [switch/case](#switchcase)
</td>
<td>
* [Loop](#loop)
* [for-i](#for-i)
* [for-in](#for-in)
* [while](#while)
* [Converting](#converting)
* [Build-in iunctions](#build-in-functions)
* [func](#func)
</td>
<td>
* [Pointers](#pointers)
* [Unit testing](#unit-testing)
* [External file](#external-file)
</td>
<td>
* [Remote packages](#remote-packages)
* [Packages](#packages)
* [pkg](#pkg)
* [Project ideas](#project-ideas)
</td>
</table>
## File
### Run file
`zig run file.zig`
### Generate exe file
`zig build-exe file.zig`
## Hello world
```zig
// import print fromm std
const print = @import("std").debug.print;
// create main function
pub fn main() void {
// print
print("Hello, world!\n", .{});
}
```
## Importing packages
```zig
const <package> = @import("<package-name>");
```
## Variables
```zig
// mutable
var <variable-name>: type = <value>;
var <variable-name>: type; // empty
// immutable
const <variable-name>: type = <value>;
// arrays
var arr: [<length>]<type> = [<value>, ...];
var arr: [<length>]<type>; // empty
/*
Type:
bool = %b = true, false
u8, u16, u32, u64, u128 = %d = number in range of x bits, can't be negative
i8, i16, i32, i64, i128 = %d = number in range of x bits, can be negative
f16, f32, f64 = %f = decimal numbers
[] u8 = %.*s = string
*/
```
### Structs
```zig
// create struct
const <Struct-name> = struct {
<key1>: <type>,
<key2>: <type>,
};
// use struct
const <struct-x> = {
<key1>: <value>,
<key2>: <value>,
};
```
### Map
```zig
const HashMap = @import("std").HashMap;
// create map
var <map-name> = HashMap(<type>).init(<length>);
// add item
<map-name>.put(<key>, <value>);
// read item
const <value> = <map-name>.get(<key>);
```
## Functions
```zig
// normal function for one file
fn name() void {
//...
}
// public function
pub fn name() void {
//...
}
// return
fn name() <type> { return x; }
fn name() (<type>, <type>) { return (x, y); }
// parameters
fn name(param1: <type>) { }
fn name(param1, param2: <type>) { } // if param1 have same type as param2
```
## Logic Statements
### If/else
```zig
if (<statement>) {
// ...
}
```
### Switch/case
```zig
switch (operation) {
x => <do-x>,
y => <do-y>,
else => <do-else>,
}
```
## Loop
### For-I
```zig
for (var i: u32 = 0; i<10; i++) {
// ...
}
```
### For-In
```zig
var arr: [10]u8 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
for (arr) |elem, i| {
// ...
}
```
### While
```zig
while (condition) {
// ...
}
```
## Converting
```zig
// str -> int
const str = "123";
const num = try std.parseInt(u32, str);
// int -> str
```
## Build-In Functions
### func
```zig
```
## Pointers
```zig
```
## Unit Testing
```sh
```
```zig
// main.zig
// main_test.zig
```
## External file
```zig
// folder structure
|- main.zig
|
|- example
|- second.zig
// main.zig
// second.zig
```
## Remote packages
### Install packages
```
```
### Import packages
```zig
```
## Packages
### pkg
```zig
// code
```
## TODO
- [ ] Enums
- [ ] std.io
## Project ideas
* [name](link)
|
https://avatars.githubusercontent.com/u/59750184?v=4 | sql.zig | fremantle-industries/sql.zig | 2023-03-25T02:21:35Z | A generic SQL interface for Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/fremantle-industries/sql.zig/tags | MIT | [
"sql",
"zig"
] | 2 | false | 2023-03-28T05:27:13Z | true | false | # sql.zig
A generic SQL interface for Zig
## Development
```sh
make
```
## Test
```sh
make test
```
## Authors
- Alex Kwiatkowski - [email protected]
## License
`sql.zig` is released under the [MIT license](./LICENSE)
|
https://avatars.githubusercontent.com/u/25912761?v=4 | snorlax | r4gus/snorlax | 2023-08-15T22:18:50Z | CouchDB client | master | 1 | 0 | 0 | 0 | https://api.github.com/repos/r4gus/snorlax/tags | None | [
"couchdb",
"couchdb-client",
"database",
"zig",
"ziglang"
] | 23 | false | 2023-08-17T19:39:10Z | true | false | # Snorlax
A __work in progress__ [CouchDB](https://couchdb.apache.org/) client library.
## Getting started
1. Install [Zig](https://ziglang.org/download/) `0.11.0` on your system.
2. Follow the CouchDB [installation instructions](https://docs.couchdb.org/en/stable/install/index.html)
to setup CouchDB on your system.
3. Then check out one of the [examples](examples). After running `zig build` you can find the executables in `zig-out/bin`.
> Note: You have to adjust the examples (e.g. username and password)!
### Adding Snorlax to your application
First add this library as dependency to your `build.zig.zon` file:
```zon
.{
.name = "your-project",
.version = 0.0.1,
.dependencies = .{
.snorlax = .{
.url = "https://github.com/r4gus/snorlax/archive/master.tar.gz",
.hash = "<your hash>",
}
},
}
```
> The easiest way to obtain the hash is to leave it blank or enter a wrong hash and then copy the correct
> one from the error message.
Then within your `build.zig`:
```zig
// Fetch the dependency...
const snorlax_dep = b.dependency("snorlax", .{
.target = target,
.optimize = optimize,
});
// ...and obtain the module
const snorlax_module = snorlax_dep.module("snorlax");
...
// Add this module to your executable
exe.addModule("snorlax", snorlax_module);
```
After you've added the `snorlax` module to your application, you can import it using
`const snorlax = @import("snorlax");`.
## Overfiew
Currently the library supports the following operations:
* Create a new database by using the `createDatabase` function
* Delete a database (and all its documents) by using the `deleteDatabase` function
* Create a new document by using the `createDocument` function
* Find a document based on _selectors_ by using the `find` function
* Read a specific document by using the `read` function
* Update a existing document by using the `update` function
* Delete a existing document by using the `delete` function
Check out the [examples](examples) folder for an overfiew on how to use the library.
|
https://avatars.githubusercontent.com/u/59750184?v=4 | kafka.zig | fremantle-industries/kafka.zig | 2023-03-27T05:48:14Z | A Kafka client for Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/fremantle-industries/kafka.zig/tags | MIT | [
"apache-kafka",
"kafka",
"kafka-client",
"zig"
] | 2 | false | 2023-03-28T04:10:30Z | true | false | # kafka.zig
A Kafka client for Zig
## Test
```sh
make test
```
## Authors
- Alex Kwiatkowski - [email protected]
## License
`kafka.zig` is released under the [MIT license](./LICENSE)
|
https://avatars.githubusercontent.com/u/135145066?v=4 | RLock | dying-will-bullet/RLock | 2023-07-17T15:09:54Z | Reentrant lock in Zig. | master | 1 | 0 | 1 | 0 | https://api.github.com/repos/dying-will-bullet/RLock/tags | MIT | [
"lock",
"mutex",
"threading",
"zig",
"ziglang"
] | 8 | false | 2023-11-01T17:12:17Z | true | true | # RLock
[](https://github.com/dying-will-bullet/RLock/actions/workflows/ci.yaml)

A reentrant lock is a synchronization primitive that may be acquired multiple times by the same thread.
Internally, it uses the concepts of "owning thread" and "recursion level" in addition to the locked/unlocked state used by primitive locks.
In the locked state, some thread owns the lock; in the unlocked state, no thread owns it.
## Example
```zig
const std = @import("std");
const Thread = std.Thread;
const RLock = @import("RLock").RLock;
var counter: usize = 0;
var rlock = RLock.init();
pub fn main() !void {
var threads: [100]std.Thread = undefined;
for (&threads) |*handle| {
handle.* = try std.Thread.spawn(.{}, struct {
fn thread_fn() !void {
for (0..100) |_| {
rlock.lock();
defer rlock.unlock();
counter += 1;
Thread.yield() catch {};
rlock.lock();
defer rlock.unlock();
counter += 1;
}
}
}.thread_fn, .{});
}
for (threads) |handle| {
handle.join();
}
std.debug.assert(counter == 20000);
std.debug.print("counter => {d}\n", .{counter});
}
```
## License
MIT
|
https://avatars.githubusercontent.com/u/6188189?v=4 | aoc22.zig | scnewma/aoc22.zig | 2023-06-28T04:51:04Z | Advent of Code 2022 in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/scnewma/aoc22.zig/tags | None | [
"advent-of-code-2022",
"zig"
] | 24 | false | 2023-11-01T17:24:55Z | true | false | # Advent of Code 2022
Rewriting my [Rust solutions](https://github.com/scnewma/adventofcode22) in [Zig](https://ziglang.org/) to learn the language.
|
https://avatars.githubusercontent.com/u/2906836?v=4 | zig-stm32f7-blink | artronics/zig-stm32f7-blink | 2022-12-18T22:31:59Z | A blink project using nucleo-f767zi board with build and debug configuration | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/artronics/zig-stm32f7-blink/tags | MIT | [
"blinking-leds",
"embedded",
"nucleo-f767zi",
"zig"
] | 5,587 | false | 2022-12-20T20:41:23Z | true | false | ### Project
A blinking LED project using the Zig programming language. With the use of OpenOCD, you can program the chip and debug your project using the provided Visual Studio Code configurations. These configurations include both launch and task configurations, allowing you to run and test your code.
### Building the project
To build and program the board run:
```
zig build flash
```
### Setup
This project is using NUCLEO-F767ZI board but, if you have a different board, you can still use these instructions to create your own project. Simply follow the steps outlined below to build and program your board:
#### Dependencies:
- Zig programming language
- `arm-none-eabi` toolchain. We use Zig to cross-compile our code, but the toolchain comes with other useful tools including `gdb`.
- OpenOCD to program the chip and running debugger server
- STM32CubeMX to generate the startup and linker files
#### Steps
- Use STM32CubeMX program to generator a project.
- Copy the `startup_<chip>.s` and `<ship>.ld` files.
- Download the chip's `SVD` file from ST website.
- Use (regz)[https://github.com/ZigEmbeddedGroup/regz] project from zig-embedded team to generate a registers file.
- This step is optional. The debugger settings in the `launch.json` references this file. This will allow you to search for registers by name and check their values during debugging.
### Credits:
I used source code from:
- https://github.com/rbino/zig-stm32-blink |
https://avatars.githubusercontent.com/u/5454662?v=4 | zemc | fveilly/zemc | 2023-08-30T17:04:53Z | Zig Embedded Containers | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/fveilly/zemc/tags | MIT | [
"containers",
"linked-list",
"zig"
] | 7 | false | 2023-11-01T17:25:51Z | true | false | # ZEmC
Zig Embedded Containers
A collection of embedded containers for Zig inspired by the linux kernel's implementation.
## Circular doubly linked list
```
// Any structure containing ListHead can be added to the list
const Point = struct { x: i32, y: i32, list_ref: ListHead };
// Initialize the head of the list
var list = ListHead.default();
list_init(&list);
var p1: Point = .{ .x = 13, .y = 64, .list_ref = ListHead.default() };
var p2: Point = .{ .x = 14, .y = 65, .list_ref = ListHead.default() };
// Add two elements to the list
list.add(&p1.list_ref);
list.add_tail(&p2.list_ref);
// Iterate over the list
var iter = ListIterator(Point).init(&list, "list_ref");
while (iter.next()) |value| {
value.x += 1;
}
// Iterate over the list and remove all the elements
var rawIter = ListIteratorRaw().init(&list);
while (rawIter.next()) |entry| {
list_del(entry);
}
try expect(list.empty());
```
|
https://avatars.githubusercontent.com/u/3768010?v=4 | advent-of-code-2018 | ManDeJan/advent-of-code-2018 | 2018-12-02T19:59:04Z | https://adventofcode.com/2018 | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/ManDeJan/advent-of-code-2018/tags | None | [
"advent-of-code",
"advent-of-code-2018",
"zig"
] | 2 | false | 2018-12-03T12:14:00Z | false | false | 404 |
https://avatars.githubusercontent.com/u/5048090?v=4 | zigfmt-web | jackdbd/zigfmt-web | 2020-12-10T16:55:08Z | run zig fmt in a wasm module | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/jackdbd/zigfmt-web/tags | MIT | [
"wasm",
"webassembly",
"zig"
] | 964 | true | 2023-10-06T12:34:13Z | true | false | # zigfmt-web
[](https://github.com/jackdbd/zigfmt-web/actions/workflows/ci.yaml)
Write zig code in a `<textarea>`, format it with WebAssembly. Try [me](https://jackdbd.github.io/zigfmt-web/).
## Installation
Clone the repo and jump into it:
```sh
git clone [email protected]:jackdbd/zigfmt-web.git
cd zigfmt-web
```
Install JS dev dependencies (prettier, eslint, etc):
```sh
npm install
```
Use [zigup](https://github.com/marler8997/zigup) to fetch and manage zig compilers:
```sh
zigup fetch master
zigup default master
```
Double check the version of the zig compiler:
```sh
zig version
```
## Develop
Compile the wasm module and move it to the `public` directory:
```sh
npm run build
```
*Note*: the wasm module is generated compiling `src/lib.zig` with `wasm32-freestanding-musl` as the compilation target, and with the release-small build mode.
Serve the `public` directory:
```sh
npm run serve
```
## Deploy
The `public` directory will be deployed to [GitHub pages](https://pages.github.com/), so each `git push` automatically triggers a new deploy.
## WASI
The `src/main.zig` file can be compiled for [wasm32-wasi-musl](https://ziglang.org/documentation/master/#toc-WASI) and run on any WebAssembly runtime. You can compile for WASI with:
```sh
zig build-exe src/main.zig \
-target wasm32-wasi-musl \
-O Debug && \
mv main.wasm wasi-demo
```
Note: compile the WASI demo using `-O Debug` so you can see the print statements from `std.log.debug` and `std.log.info`.
You can execute the demo with a WASI runtime like [wasmtime](https://wasmtime.dev/):
```sh
wasmtime run wasi-demo/main.wasm 'const answer: u8 = 42;'
wasmtime run wasi-demo/main.wasm 'this is not valid zig code'
```
In alternative, you can run this script that uses the Node.js [wasi module](https://nodejs.org/api/wasi.html):
```sh
node --experimental-wasi-unstable-preview1 wasi-demo/main.mjs \
'const answer: u8 = 42;'
node --experimental-wasi-unstable-preview1 wasi-demo/main.mjs \
'this is not valid zig code'
```
Note: the `--experimental-wasi-unstable-preview1` flag should no longer be required from Node.js 20 onwards.
## If you want to know more
### wasm-ld
zig uses [wasm-ld](https://lld.llvm.org/WebAssembly.html), a LLVM-based linker. You can see it when passing the `--verbose-link` flag:
```sh
zig build-lib src/lib.zig \
-target wasm32-freestanding-musl \
-dynamic \
--verbose-link
```
If you have some issues related to the wasm linker, see these links:
- https://gist.github.com/josephg/873a21d4558fd69aeccea19c3df96672
- https://github.com/ziglang/zig/issues/11209
- https://lld.llvm.org/WebAssembly.html
- https://github.com/WebAssembly/tool-conventions/blob/main/Linking.md
### WABT
You can debug the generated wasm module using a few tools from the [WebAssembly Binary Toolkit](https://github.com/WebAssembly/wabt):
See the generated [WebAssemly Text Format (WAT)](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format):
```sh
wasm2wat public/lib.wasm
```
Inspect the symbols in the wasm binary:
```sh
wasm-objdump public/lib.wasm --headers
wasm-objdump public/lib.wasm --details
wasm-objdump public/lib.wasm --full-contents
```
[Decompile the wasm file](https://github.com/WebAssembly/wabt/blob/main/docs/decompiler.md) to a pseudo C-like language:
```sh
wasm-decompile public/lib.wasm
```
[Decompile the wasm file](https://github.com/WebAssembly/wabt/blob/main/wasm2c/README.md) to C:
```sh
wasm2c public/lib.wasm
```
[count opcode usage for instructions](https://webassembly.github.io/wabt/doc/wasm-opcodecnt.1.html):
```sh
wasm-opcodecnt public/lib.wasm
```
|
https://avatars.githubusercontent.com/u/91773180?v=4 | randomstring-zig | zaki3mymy/randomstring-zig | 2023-11-12T11:30:38Z | Generate random string for Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/zaki3mymy/randomstring-zig/tags | MIT | [
"zig"
] | 5 | false | 2023-11-12T15:03:46Z | true | false | # randomstring-zig
Generate random string for Zig.
## Example
```zig
const std = @import("std");
const rs = @import("./randomstring.zig");
pub fn main() !void {
// Allocate a fixed-size buffer on the stack to be used as the initial memory for the allocator.
var buf: [1024]u8 = undefined;
var fba = std.heap.FixedBufferAllocator.init(&buf);
var allocator = fba.allocator();
defer allocator.free(&buf);
var str = try rs.randomString(16, allocator);
std.debug.print("{s}\n", .{str});
}
```
```
# zig run src/main.zig
qBZCsHeyFJujoTxA
``` |
https://avatars.githubusercontent.com/u/18217298?v=4 | rtiow | yhamdoud/rtiow | 2021-12-10T15:34:43Z | A Zig implementation of Ray Tracing in One Weekend. | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/yhamdoud/rtiow/tags | MIT | [
"graphics",
"ray-tracing",
"raytracing",
"zig"
] | 71 | false | 2021-12-20T15:04:17Z | true | false | # Ray Tracing in One Weekend using Zig

This is a Zig implementation of [*Ray Tracing in One Weekend*](https://raytracing.github.io/books/RayTracingInOneWeekend.html) by Peter Shirley.
The structure of the path tracer roughly follows the book, using idiomatic Zig constructs when possible.
Notably, the usage of runtime polymorphism in the material system is substituted with tagged unions.
Some other additions of my own include rendering the results to a window using OpenGL and multithreading.
## Dependencies
- Zig 0.9.0
- GLFW
- Glad (vendored)
## Building
`$ zig build run -Drelease-fast=true` |
https://avatars.githubusercontent.com/u/16837066?v=4 | advent | Kornelijus/advent | 2021-12-01T03:52:15Z | 🎄 My solutions for Advent of Code, including previous years | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/Kornelijus/advent/tags | None | [
"advent-of-code",
"advent-of-code-2021",
"go",
"golang",
"python",
"rust",
"zig"
] | 46 | false | 2022-12-05T21:04:28Z | false | false | # 🎄 Advent of Code
My solutions for Advent of Code, including previous years, for trying out languages new to me.
|
https://avatars.githubusercontent.com/u/63668822?v=4 | injected_fields | ArborealAnole/injected_fields | 2022-01-25T12:10:59Z | injected_fields concept, a form of Explicit Management of Implicit Context (EMIC) | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/ArborealAnole/injected_fields/tags | CC0-1.0 | [
"dependency-injection",
"emic",
"field-injection",
"implicit-parameters",
"implicits",
"object-oriented-programming",
"parameter-injection",
"zig"
] | 56 | false | 2022-01-26T12:44:31Z | false | false | # injected_fields
Injected fields is a possible feature for Zig or any programming language; usage is given in `injection.zig`. Associated with the feature are two auxiliary features called `tenum` as described in `tenums.txt`, and `Access` as described in `Access.txt`. These two features are not necessary for injected fields, e.g. if strings are used to specify field access (see `stringly.zig`, a previous idea).
## Motivation
- separation of context provision logic from application logic
- easier modification of structure context requirements or options without requiring modification of all callsites
- decreased clutter from non-"volatile"/context-type parameters; decreased chance of accidentally changing an argument that is required to be the same through different function calls (such as a `std.mem.Allocator` in `std.array_list.ArrayListUnmanaged`)
- managed container with the same code and flexibility as unmanaged container
- easier delegation of tasks to sub-structure methods without need for excessive parameters or redundant physical pointer fields
## Synopsis
```zig
const TrainNetwork = struct {
const Resources = struct {
using a: *Allocator,
};
resources: Resources,
};
const TransportationAuthority = struct {
// hidden parameter injections required (1 *Allocator):
pub fn at(self: *TransportationAuthority, i: u3) TrainNetwork {
return self.t[i];
}
};
const A = struct {
a: Allocator
@providing(@fields(A)...b...at()...resources...a),
b: TransportationAuthority,
};
```
## Description
Injected fields (aka `using` fields) seem similar to "dynamic scoping" [[1]](https://wiki.c2.com/?DynamicScoping); "implicit parameters" similar to as in Scala 2 [[2]](https://www.reddit.com/r/ProgrammingLanguages/comments/dvq7ld/implicitly_passed_parameters/), Zig [issue #1286](https://github.com/ziglang/zig/issues/1286); "givens" [[3]](https://docs.scala-lang.org/scala3/reference/contextual/givens.html) in Scala 3; "dependency injection"; or "Explicit Management of Implicit Context (EMIC)" [[4]](https://wiki.c2.com/?ExplicitManagementOfImplicitContext). They are explicitly configured in an OOP pattern.
A struct may have a `using` field, which is "virtual" in the sense that it does not actually exist in memory representation of the struct. Rather, this field is required to be provided by configuration in a program that contains instances of the struct. Any parent structure using it can be configured to provide the field.
There must be exactly 1 candidate injection argument for every `using` field or else it is a compile error.
The compiler automatically injects the provided value as arguments/parameters through the necessary function calls. If you somehow get a pointer to an instance of a struct with the `using` field, then the compiler can automatically obtain the correct value for that field.
The `using` fields are always pointers, because they do not have physical storage but refer to an object stored elsewhere. Technically, they could be available on the stack because they are implemented as parameters, but this would be misleading because mutation would not be persistent. So there is an implicit address-of operation for the builtin functions.
If you want to provide a more complex way of obtaining the correct resource, e.g.
- you can call a function on (or method of) the injected field at the use-site.
- you can create an intermediate struct that is stored e.g. on the stack, which obtains with a function call the resource into a field that is `@providing()` for the use-site.
Strictly speaking there seems to be an aspect of parameter injection and an aspect of to-above field aliasing here. Zig [issue #7311](https://github.com/ziglang/zig/issues/7311) seems to be proposing to-below field aliasing limited to one level down.
Unused injected fields are allowed, just as not using a physical field is allowed. Not a strong requirement.
### Benefits
- simplicity
- increases focus on "volatile" parameters (not in the RAM sense)
- maps a field or declaration to a field; so does not cause hidden control flow, only augments explicit control flow in a hidden manner
- equalizes the ease of unmanaged structures to that of managed structures, which was made easy with similarly "hidden" resource/context usage by the OOP pattern
- in one sense the semantics of injected context parameters is more accurate than that of passing contexts through several function calls, because those function calls are often inlined by the compiler
- easier to optimize allocator organization, adapt it incrementally. easy to provide allocators of different types to satisfy different requirements (random access (hugepages useful), sequential access (smaller pages ok), short usage period (arena-type), etc.), merge arena-type allocations with similar usage period. or to ignore that detail until it is useful to optimize it, but not later have extra hassle when it is.
For the last point, a simple example is if you create a `struct` that either uses its own allocator field or uses the `std.heap.page_allocator`. If you ever want to change it to use a provided allocator that is not stored within the struct, you will have to modify every method that uses the allocator, and every callsite.
### Drawbacks and counterarguments
- complexity
- too many hidden parameters passed too deeply in non-inlined function calls
I think the compiler can optimize it by passing the hidden parameter through a static memory location, or single-purpose stack if there are deep non-inlined function call origin possibilities (like using "globals" but in a compiler-enforced correct fashion).
- not a significant optimization vs. physical fields for `struct`s on the stack, given compiler optimizer
- perhaps language feature is not necessary (simulation with metaprogramming)
- less obvious which function calls use a resource at callsites for e.g. currently unmanaged containers that switch to `using` fields
However, the last point is not a fundamental difference from the possibilities in the current language, because any struct that you utilize in your program currently, however deeply in a struct hierarchy, could have e.g. an `Allocator` field or declaration that uses a default allocator without even taking one for a constructor. You would not currently see it using resource parameters in the function call chain. This feature could actually reduce hidden resource usage by increasing the appeal of unmanaged (but managed-like) structures, where at least the resource usage is declared higher in the struct hierarchy.
|
https://avatars.githubusercontent.com/u/107519028?v=4 | annotated-tigerbeetle | better-zig/annotated-tigerbeetle | 2022-08-01T12:21:02Z | tigerbeetle 源码分析 | annotated-v2022-08-01 | 0 | 0 | 0 | 0 | https://api.github.com/repos/better-zig/annotated-tigerbeetle/tags | Apache-2.0 | [
"zig",
"ziglang"
] | 19,867 | true | 2022-08-01T14:08:22Z | true | false | # tigerbeetle 源码分析:
## 源码分析笔记:
- [.annotated/](./.annotated/readme.md)
> 分支:
- `annotated-v2022-08-01`, 当前`打 tag` 的版本, 很老, 代码已经过时. 故在 `main 分支`分析.
# tigerbeetle
_TigerBeetle is a financial accounting database designed for mission critical safety and performance to power the future of financial services._
**Take part in TigerBeetle's \$20k consensus challenge: [Viewstamped Replication Made Famous](https://github.com/coilhq/viewstamped-replication-made-famous)**
Watch an introduction to TigerBeetle on [Zig SHOWTIME](https://www.youtube.com/watch?v=BH2jvJ74npM) for our design decisions regarding performance, safety, and financial accounting primitives:
[](https://www.youtube.com/watch?v=BH2jvJ74npM)
## The Problem - Realtime Processing of Balance Updates
Processing events that impact the balance of an account must be done serially, in the correct order and reliably. For this reason, despite the trend to scale modern applications by distributing work across parallel threads/processes/machines, it remains difficult to scale a ledger or accounting system without sacrificing performance or safety.
For example, processing a balance update event involves:
1. validating the event,
2. processing any business rules that must consider the current balance before processing the event and the new balance after the event,
3. updating the balance
4. persisting the updated balance, and
5. notifying subscribers of the updated balance and that the event has been processed.
While investigating a few existing systems it became clear that the majority of architectures cobble together generic databases (relational or NoSQL, on-disk or in-memory) with business logic enforced in the application code. This separation between data and code, persistence and logic, invites the worst of distributed system problems: network delays, multiple roundtrips for a single balance update, clock skew, or cache incoherency etc.
Furthermore, these systems may achieve performance but at the expense of reliability, especially in the face of hardware failure, corruption and misdirected writes, a compromise that is unacceptable for a system-of-record for financial accounts.
## The Solution - A Purpose-Built Financial Accounting Database
Our survey led us to conclude that, while there are mechanisms available to shard account balances to parallelize updates and improve performance, there are still significant performance gains to be had in designing a database that is purpose built for storing balances and processing updates in a reliable manner.
## ProtoBeetle - 400,000 Transfers per Second
In the month of July 2020, we developed a prototype of TigerBeetle in Node as a performance sketch to measure the basic components of the design (batching, TCP protocol, cryptographic checksums everywhere, fsync journalling, in-memory business logic and hash table operations). **ProtoBeetle ran at 200,000 two-phase transfers per second on our office laptops**, supporting our back-of-the-envelope numbers.
We then integrated ProtoBeetle into [Mojaloop](https://mojaloop.io/) and our reference minimum deployment cluster of **Mojaloop went from 76 TPS on MySQL to 1757 TPS on ProtoBeetle**. A single stateless Mojaloop pod was unable to saturate ProtoBeetle. Most of the throughput was spent converting Mojaloop's individual HTTP requests into TCP batches.
**[Watch a 10-minute talk introducing ProtoBeetle.](https://youtu.be/QOC6PHFPtAM?t=324)**
## AlphaBeetle - 800,000 Transfers per Second
After ProtoBeetle, from September through October 2020, we knuckled down and rewrote TigerBeetle in C/Zig to create the alpha version of TigerBeetle, using [io_uring](https://kernel.dk/io_uring.pdf) as a foundation for fast I/O.
TigerBeetle's Zig implementation of io_uring was [submitted](https://github.com/ziglang/zig/pull/6356) for addition to the Zig standard library.
**[Watch a presentation of TigerBeetle given to the Interledger community on 25 November 2020.](https://www.youtube.com/watch?v=J1OaBRTV2vs)**
## BetaBeetle - High Availability
BetaBeetle, the beta distributed version of TigerBeetle, was developed from January 2021 through August 2021, for strict serializability, fault tolerance and automated leader election with the pioneering [Viewstamped Replication](http://pmg.csail.mit.edu/papers/vr-revisited.pdf) and consensus protocol, plus the CTRL protocol from [Protocol-Aware Recovery for Consensus-Based Storage](https://www.youtube.com/watch?v=fDY6Wi0GcPs).
## TigerBeetle (under active development)
The production version of **TigerBeetle is now under active development**. Our [DESIGN doc](docs/DESIGN.md) provides an overview of TigerBeetle's data structures and our [project board](https://github.com/coilhq/tigerbeetle/projects?type=classic) provides a glimpse of where we want to go.
## QuickStart
**Prerequisites:** The current beta version of TigerBeetle targets macOS and Linux and takes advantage of the latest asynchronous IO capabilities of the Linux kernel v5.6 and newer, via [io_uring](https://kernel.dk/io_uring.pdf). As such it can only be used on macOS or on recent versions of Linux with an updated kernel.
```bash
git clone https://github.com/coilhq/tigerbeetle.git
cd tigerbeetle
scripts/install.sh
```
## Benchmark
With TigerBeetle installed, you are ready to benchmark!
```bash
scripts/benchmark.sh
```
_If you encounter any benchmark errors, please send us the resulting `benchmark.log`._
## Tests
### Unit Tests
To run the unit tests:
```bash
zig/zig build test
```
The [QuickStart](#quickstart) step above will install Zig for you to the root of the `tigerbeetle` directory.
### Simulation Tests
To run TigerBeetle's long-running simulation, called _The VOPR_:
```bash
scripts/vopr.sh
```
_The VOPR_ stands for _The Viewstamped Operation Replicator_ and was inspired by the movie WarGames, by our love of fuzzing over the years, by [Dropbox's Nucleus testing](https://dropbox.tech/infrastructure/-testing-our-new-sync-engine), and by [FoundationDB's deterministic simulation testing](https://www.youtube.com/watch?v=OJb8A6h9jQQ).
_The VOPR_ is [a deterministic simulator](src/simulator.zig) that can fuzz many clusters of TigerBeetle servers and clients interacting through TigerBeetle's Viewstamped Replication consensus protocol, but all within a single developer machine process, with [a network simulator](src/test/packet_simulator.zig) to simulate all kinds of network faults, and with an in-memory [storage simulator](src/test/storage.zig) to simulate all kinds of storage faults, to explore and test TigerBeetle against huge state spaces in a short amount of time, by literally speeding up the passing of time within the simulation itself.
Beyond being a deterministic simulator, _The VOPR_ also features [a state checker](src/test/state_checker.zig) that can hook into all the replicas, and check all their state transitions the instant they take place, using cryptographic hash chaining to prove causality and check that all interim state transitions are valid, based on any of the set of inflight client requests at the time, without divergent states, and then check for convergence to the highest state at the end of the simulation, to distinguish between correctness or liveness bugs.
Check out TigerBeetle's [Viewstamped Replication Made Famous](https://github.com/coilhq/viewstamped-replication-made-famous#how-can-i-run-the-implementation-how-many-batteries-are-included-do-you-mean-i-can-even-run-the-vopr) bug bounty challenge repository for more details on how to run _The VOPR_ and interpret its output.
## Launch a Local Cluster
Launch a TigerBeetle cluster on your local machine by running each of these commands in a new terminal tab:
```
./tigerbeetle init --cluster=0 --replica=0 --directory=.
./tigerbeetle init --cluster=0 --replica=1 --directory=.
./tigerbeetle init --cluster=0 --replica=2 --directory=.
./tigerbeetle start --cluster=0 --replica=0 --directory=. --addresses=3001,3002,3003
./tigerbeetle start --cluster=0 --replica=1 --directory=. --addresses=3001,3002,3003
./tigerbeetle start --cluster=0 --replica=2 --directory=. --addresses=3001,3002,3003
```
Run the TigerBeetle binary to see all command line arguments:
```bash
./tigerbeetle --help
```
## Clients
- [tigerbeetle-node](https://github.com/coilhq/tigerbeetle-node) is a TigerBeetle Node.js client written in TypeScript (and Zig with [Node's N-API](https://nodejs.org/api/n-api.html) for ABI stability).
- [client.zig](./src/vr/client.zig) is a TigerBeetle Zig client.
- [demo.zig](./src/demo.zig) is a lightweight TigerBeetle client for demonstration purposes only, which we used to create [six demos you can work your way through and modify](./docs/DEEP_DIVE.md) to explore TigerBeetle's commands.
## Community
[Join the TigerBeetle community in Discord.](https://discord.com/invite/uWCGp46uG5)
## Performance Demos
Along the way, we also put together a series of performance demos and sketches to get you comfortable building TigerBeetle, show how low-level code can sometimes be easier than high-level code, help you understand some of the key components within TigerBeetle, and enable back-of-the-envelope calculations to motivate design decisions.
You may be interested in:
- [demos/protobeetle](./demos/protobeetle), how batching changes everything.
- [demos/bitcast](./demos/bitcast), how Zig makes zero-overhead network deserialization easy, fast and safe.
- [demos/io_uring](./demos/io_uring), how ring buffers can eliminate kernel syscalls, reduce server hardware requirements by a factor of two, and change the way we think about event loops.
- [demos/hash_table](./demos/hash_table), how linear probing compares with cuckoo probing, and what we look for in a hash table that needs to scale to millions (and billions) of account transfers.
## License
Copyright 2020-2022 Coil Technologies, Inc
Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
https://avatars.githubusercontent.com/u/89497197?v=4 | fennec_precompile | cocoa-xu/fennec_precompile | 2022-06-28T00:41:31Z | Drop-in library for `:elixir_make` for precompiling NIF binaries with Zig as the cross-compiler. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/cocoa-xu/fennec_precompile/tags | Apache-2.0 | [
"elixir",
"elixir-library",
"zig"
] | 103 | false | 2022-12-02T13:52:28Z | false | false | # FennecPrecompile
(This repo is archived, please use [`cc_precompiler`](https://github.com/cocoa-xu/cc_precompiler))
Drop-in library for `:elixir_make` for precompiling NIF binaries with Zig as the cross-compiler.
This work is inspired by ~~(massively copy-and-paste from)~~ [`rustler_precompiled`](https://github.com/philss/rustler_precompiled). However, this library is more focused on crosscompiling C/C++ projects using Zig as a cross-compiler whereas `rustler_precompiled` is focused on crosscompiling Rust projects to NIF using Rust with [`rustler`](https://github.com/rusterlium/rustler).
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `fennec_precompile` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:fennec_precompile, "~> 0.3.0"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at <https://hexdocs.pm/fennec_precompile>.
## Usage
### Setup `elixir_make`
Add `:elixir_make` to the `compilers` list and set `make_precompiler` to `FennecPrecompile` to use `fennec_precompile`.
### Setup fennec_precompile specific config values
`fennec_base_url` should be set to the base URL of the precompiled binaries.
`fennec_nif_filename` will be used to indicate the file name of the compiled shared library.
```elixir
@version "0.1.0"
def project do
[
# ...
version: @version,
compilers: [:elixir_make] ++ Mix.compilers(),
make_precompiler: FennecPrecompile,
fennec_nif_filename: "stb_image_nif",
fennec_base_url: "https://github.com/me/myproject/downloads/releases/v#{@version}"
# ...
]
end
```
A table of supported environment variables, their scopes and examples can be found in the [`Enviroment Variable`](#environment-variable) section.
## Precompile NIFs
Precompiling happens when run `mix elixir_make.precompile`.
```elixir
# optional settings to override the default cache directory
export ELIXIR_MAKE_CACHE_DIR="$(pwd)/cache"
# precompile
mix elixir_make.precompile
# it's also possible to run `mix elixir_make.precompile` with other flags
# other flags will be passed to `:elixir_make`
mix elixir_make.precompile --my-flag
```
What happens when you run `mix elixir_make.precompile`?
- `CC` will be set to `zig cc -target "ARCH-OS-ABI"`
- `CXX` will be set to `zig c++ -target "ARCH-OS-ABI"`
- `CPP` will be set to `zig c++ -target "ARCH-OS-ABI"`
Everything else is the same as when you run `mix compile` (with `:elixir_make`, or `mix compile.elixir_make`).
The following targets will be compiled by default:
- macOS
- x86_64-macos
- aarch64-macos
- Linux
- x86_64-linux-gnu
- x86_64-linux-musl
- aarch64-linux-gnu
- aarch64-linux-musl
- riscv64-linux-musl
- Windows
- x86_64-windows-gnu
A full list of supported targets can be found using `zig targets`.
It's worth noting that some targets may not successfully compile on certain platforms. For example, `x86_64-macos` will not compile on Linux and `x86_64-windows-msvc` will not compile on macOS.
### Specifying targets to compile
To compile for a specific target/a list of targets, set the `FENNEC_PRECOMPILE_TARGETS` environment variable.
```elixir
# for example, to compile for aarch64-linux-musl,riscv64-linux-musl
export ELIXIR_MAKE_CACHE_DIR="$(pwd)/cache"
export FENNEC_PRECOMPILE_TARGETS="aarch64-linux-musl,riscv64-linux-musl"
mix elixir_make.precompile
```
## Fetch Precompiled Binaries
To fetch precompiled binaries, run `mix elixir_make.fetch`.
```elixir
# fetch all precompiled binaries
mix elixir_make.fetch --all
# fetch specific binaries
mix elixir_make.fetch --only-local
# print checksums
mix elixir_make.fetch --all --print
mix elixir_make.fetch --only-local --print
```
## Use zig for native build
This section only relates to the behaviour of the `mix compile` and `mix compile [--args] ...` commands.
For native build, `zig` is not used by default for two reasons.
1. For users who are only interested in using the app their native host, it is not necessary to compile the app using Zig.
2. As this tool aim to be a drop-in replacement for `:elixir_make`, the default behaviour of `mix compile` and `mix compile [--args] ...` of this tool is the same as what would be expected with `:elixir_make`.
However, you can choose to always use `zig` as the compiler by setting environment variable `FENNEC_PRECOMPILE_ALWAYS_USE_ZIG` to `true`.
To be more specific, by default, the environment variables `CC`, `CXX` and `CPP` will not be changed by this tool when running `mix compile` or `mix compile [--args] ...`. When `FENNEC_PRECOMPILE_ALWAYS_USE_ZIG` is `true`, the compiled NIF binaries (for the native host, identified as `ARCH-OS-ABI`) should be the same as the one generated by `mix elixir_make.precompile`.
For example, when running `mix compile` or `mix compile [--args]` on arm64 macOS with this option set to `true`, files in the `_build/${MIX_ENV}/lib/my_app/priv` directory should match the ones in the `my_app-nif-NIF_VERSION-aarch64-macos-VERSION.tar.gz` generated by `mix elixir_make.precompile`.
To install Zig from a package manager, please refer to the officail guide from zig, [Install Zig from a Package Manager](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager).
## Where is the precompiled binaries?
The path of the cache directory is determined in the following order:
1. `$ELIXIR_MAKE_CACHE_DIR`
2. `:filename.basedir(:user_cache, "", ...)`
If the environment variable `ELIXIR_MAKE_CACHE_DIR` is set, the cache directory will be `$ELIXIR_MAKE_CACHE_DIR`. Otherwise, the cache directory will be determined by the following function:
```elixir
cache_opts = if System.get_env("MIX_XDG"), do: %{os: :linux}, else: %{}
cache_dir = :filename.basedir(:user_cache, "", cache_opts)
cache_dir =
System.get_env("ELIXIR_MAKE_CACHE_DIR", cache_dir)
|> Path.join(sub_dir)
```
## Environment Variable
- `FENNEC_PRECOMPILE_TARGETS`
Only used when running `mix elixir_make.precompile`. This environment variable is mostly used in CI or temporarily specify the target(s) to compile.
It is a comma separated list of targets to compile. For example,
```shell
export FENNEC_PRECOMPILE_TARGETS="aarch64-linux-musl,riscv64-linux-musl"
mix elixir_make.precompile
```
If `FENNEC_PRECOMPILE_TARGETS` is not set, the `fennec_precompile` will then check `config/config.exs` to see if there is a `:fennec_targets` key for `my_app`. If there is, the value of the key will be the targets.
```elixir
import Config
config :fennec_precompile, :config, my_app: [
fennec_targets: ["aarch64-linux-musl", "riscv64-linux-musl"]
]
```
`:fennec_targets` in the `project` will only be used in the following cases:
```elixir
def project do
[
# ...
fennec_targets: ["aarch64-linux-musl", "riscv64-linux-musl"]
]
end
```
1. When `:fennec_force_build` is set to `true`. In this case, the `:fennec_targets` acts as a list of compatible targets in terms of the source code. For example, NIFs that are specifically written for ARM64 Linux will fail to compile for other OS or CPU architeture. If the source code is not compatible with the current node, the build will fail.
2. When `:fennec_force_build` is set to `false`. In this case, the `:fennec_targets` acts as a list of available targets of the precompiled binaries. If there is no match with the current node, no precompiled NIF will be downloaded and the app will fail to start.
- `FENNEC_PRECOMPILE_ALWAYS_USE_ZIG`
Only used when running `mix compile` or `mix compile [--args] ...`.
It is a boolean value. When set to `true`, `zig` will be used as the compiler instead of the default `$CC`, `$CXX` or `$CPP`. For more information, please refer to the section above, [Use zig for native build](#use-zig-for-native-build).
```shell
# this is the default, equivalent to run `mix compile` with `:elixir_make`
unset FENNEC_PRECOMPILE_ALWAYS_USE_ZIG
mix compile
# this will force using zig as the compiler
export FENNEC_PRECOMPILE_ALWAYS_USE_ZIG=true
mix compile
```
## License
Copyright 2022 Cocoa Xu
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
https://avatars.githubusercontent.com/u/67346305?v=4 | moetranslate2 | rlapz/moetranslate2 | 2022-04-16T15:57:47Z | A beautiful and simple language translator | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/rlapz/moetranslate2/tags | MIT | [
"translator",
"zig"
] | 115 | false | 2023-04-19T14:07:38Z | true | false | # moetranslate2
A beautiful and simple language translator written in Zig

## Currently Supported:
1. Google Translate API
## How to Install:
Git clone:
```
git clone https://github.com/rlapz/moetranslate2 --recursive --depth 1
```
Zig version: 0.10.x
```
zig build -Drelease-safe -p /usr
# OR
zig build -Drelease-fast -p /usr
```
## How to Uninstall:
```
zig build uninstall -p /usr
```
## How to Use:
```
moetranslate2 [OPT] [SOURCE:TARGET] [TEXT]
-b Brief output.
-f Full/detail output.
-r Raw output (json).
-d Detect language.
-i Interactive input mode.
-h Show help.
```
1. Brief output:
`moetranslate2 -b auto:id "Hello world\!"`
`auto` -> automatic detection
`id` -> Indonesian language code
2. Full/detail output:
`moetranslate2 -f en:id "Hello wrld\!"`
`en` -> English language code
Will show translated WORD/SENTENCE with more information.
3. Interactive input mode:
```
moetranslate2 -i
moetranslate2 -i -f auto:en hello
moetranslate2 -if auto:en
```
4. Show help:
`moetranslate2 -h`
## Language Code:
https://cloud.google.com/translate/docs/languages
## License
MIT
|
https://avatars.githubusercontent.com/u/1831620?v=4 | razdal | m1kc/razdal | 2023-01-05T20:57:28Z | TFTP server with very small memory footprint | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/m1kc/razdal/tags | MIT | [
"embedded",
"minimal",
"tftp",
"tftp-server",
"tftpd",
"zig"
] | 30 | false | 2023-01-05T21:17:19Z | true | false | # razdal
TFTP server with very small memory footprint. Stripped binary is about ~130 Kb, it doesn't need libc, and in theory requires just ~10 Kb of memory to work.
:wrench: Stability: alpha

Restrictions:
* read-only (doesn't accept write requests)
* retransmission not supported
* RRQ blocks until complete
Written in Zig.
|
https://avatars.githubusercontent.com/u/29507195?v=4 | fizzbuzz | 18alantom/fizzbuzz | 2023-10-08T15:37:54Z | Fizz buzz in Zig (w.i.p). | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/18alantom/fizzbuzz/tags | None | [
"zig"
] | 11 | false | 2023-11-01T17:10:52Z | true | false | # Fast Fizz Buzz using Zig
`fizzbuzz.zig` generates [fizz buzz](https://en.wikipedia.org/wiki/Fizz_buzz)
output. This is piped through [pv](http://www.ivarch.com/programs/pv.shtml) to
measure data throughput. The output is finally piped to `/dev/null`.
This code aims to maximize fizz buzz data throughput.
## Exec-env
```
OS: macOS 13.5.2 22G91 arm64
Shell: zsh 5.9
Terminal: iTerm2
CPU: Apple M1 Pro
Memory: 32768MiB
```
**Baseline**: `/dev/zero pv > /dev/null` is 34.6GiB/s
## Runs
_Note: reasoning is mostly a guess._
1. **naive implementation**: `9.89MiB/s` [src](https://github.com/18alantom/fizzbuzz/blob/173578984cae2e13f3f3f3a5dd4369926d96b84a/fizzbuzz.zig)
- `0:01:10 for 700 MiB (n: 100_000_000) at 9.89MiB/s`
2. **use `std.c.printf`**: `127MiB/s`
- `0:00:58 for 7.33 GiB (n: 1_000_000_000) at 127MiB/s` [src](https://github.com/18alantom/fizzbuzz/blob/62fbe6c14ece93f747061e9afb6705a073f78c60/fizzbuzz.zig)
- C std lib [`printf`](https://man7.org/linux/man-pages/man3/fprintf.3.html) directly writes to stdout, [`writer.write`](https://github.com/ziglang/zig/blob/d68f39b5412e0aeb59d71c9f676221212261dc8c/lib/std/fs/file.zig#L1157) consists of several comparisons, and might return errors which pulls in `builtin.returnError`.
3. **use buffered writer, faster custom int formatter**: `192MiB/s` [src](https://github.com/18alantom/fizzbuzz/blob/845f435d12495149a0bf72940dca5d61e30678a7/fizzbuzz.zig)
- `0:00:38 for 7.33 GiB (n: 1_000_000_000) at 192MiB/s`
- Consists of 2 improvements:
1. Used a buffered writer which writes output to a 4MB buffer before flushing it to
stdout using `c.printf`. The buffer size was based off of [this experiment](https://gist.github.com/18alantom/fac21902a1e7b295cac16f3772f42df3#file-fast_zeros-zig) which is probably
still not optimized for whatever lies between printf invocation and stdout receiving
the bytes. But it's still better than calling printf for every line of output.
2. Used a custom int formatter for digit to string conversion. Using
`fmt.bufPrint` makes it slower than the previous run probably cause
error handling and call stack.
4. **use `c.write`**: `205MiB/s`
- `00:00:36 for 7.33 GiB (n: 1_000_000_000) at 205MiB/s` [src](https://github.com/18alantom/fizzbuzz/blob/06a04aaa83a4971885ea0529c9c083ff26a3b975/fizzbuzz.zig)
- Formatting is not required so `c.write` to `STDOUT` can be used directly.
Speed up probably cause no checks for format strings.
5. **use SIMD `@Vector`**: `354MiB/s`
- `00:00:21 for 7.33GiB (n: 1_000_000_000) at 354MiB/s` [src](https://github.com/18alantom/fizzbuzz/blob/bdc1040a03691a85ddcea4798b7cdd880854fdef/fizzbuzz.zig)
- Since Fizz Buzz output shape repeats every 15 iterations, vectorization can be used
to calculate the next set of 8 numbers in a single iteration. In using vectorization,
the write function had to be regressed to using `c.printf` since given
formatting, for now that would be the fastest.
6. **use 1MB output buffer**: `368MiB/s`
- `00:00:20 for 7.33GiB (n: 1_000_000_000) at 368MiB/s` [src](https://github.com/18alantom/fizzbuzz/blob/cba7ea4123e123a6324302c4ad5a0da62107a5e1/fizzbuzz.zig)
- Use `setvbuf` to set stdout to use full buffering (`IOFBF`) with a 1MB buffer. Without
this, writes to stdout are flushed on new lines by default and full buffering should
lead to fewer writes.
7. **??**: `??MiB/s`
|
https://avatars.githubusercontent.com/u/71147926?v=4 | adventOfCode2022 | littleBobbyTablez/adventOfCode2022 | 2023-09-19T16:06:25Z | My Solutions for Advent Of Code 2022 written in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/littleBobbyTablez/adventOfCode2022/tags | None | [
"advent-of-code",
"zig"
] | 67 | false | 2023-11-01T17:11:38Z | false | false | 404 |
https://avatars.githubusercontent.com/u/1575834?v=4 | aoc-2019 | michaeladler/aoc-2019 | 2022-03-24T16:35:23Z | My solutions for the Advent of Code 2019 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/michaeladler/aoc-2019/tags | Apache-2.0 | [
"advent-of-code",
"advent-of-code-2019",
"aoc",
"aoc2019",
"rust",
"zig"
] | 197 | false | 2023-11-01T17:10:54Z | true | false | [](https://github.com/michaeladler/aoc-2019/actions/workflows/rust.yml)
[](https://github.com/michaeladler/aoc-2019/actions/workflows/zig.yml)
# aoc-2019
My first [Advent of Code](https://adventofcode.com/2019).
Started in [Rust](https://www.rust-lang.org/), finished in [Zig](https://ziglang.org/).
|
https://avatars.githubusercontent.com/u/48196342?v=4 | zig-term-colors | BiscuitTin/zig-term-colors | 2024-01-16T17:49:55Z | [WIP] A simple library for ANSI terminal colors and styles in Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/BiscuitTin/zig-term-colors/tags | MIT | [
"ansi",
"colors",
"select-graphic-rendition",
"terminal",
"zig"
] | 286 | false | 2024-01-23T16:54:34Z | true | true | [](https://github.com/BiscuitTin/zig-term-colors/actions/workflows/build-and-test.yml)
[](https://codecov.io/gh/BiscuitTin/zig-term-colors)
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="images/banner-dark.png" />
<source media="(prefers-color-scheme: light)" srcset="images/banner-light.png" />
<img width="620" height="224" src="images/banner-dark.png" />
</picture>
</p>
# Zig terminal colors
A simple library for ANSI terminal colors and styles in Zig.
<details>
<summary>View full demo</summary>
<p align="center">
<img width="800" height="626" src="images/demo.png" />
</p>
</details>
## Goals
### Non-goals
## Related projects
- [ansi-term](https://github.com/ziglibs/ansi-term) - Zig library for dealing with ANSI Terminals (escape codes, styles, etc.)
- [chameleon](https://github.com/tr1ckydev/chameleon) - Terminal string styling for zig.
- [zig-ansi](https://github.com/nektro/zig-ansi) - ANSI utilities for CLI usage in Zig.
- [mibu](https://github.com/xyaman/mibu) - Pure Zig library for low-level terminal manipulation.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
https://avatars.githubusercontent.com/u/231984?v=4 | zig-linereader | taikedz/zig-linereader | 2024-10-10T22:00:55Z | A simple ASCII line reader for Zig, with line searching and self-cleanup | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/taikedz/zig-linereader/tags | LGPL-3.0 | [
"filereader",
"strings",
"zig"
] | 11 | false | 2024-11-04T13:02:52Z | true | true | # Zig LineReader
A general purpose library for Zig.
Provides a one-call utility to read text files and perform line-oriented operations.
|
https://avatars.githubusercontent.com/u/1063891?v=4 | ziglings-exercises | oldratlee/ziglings-exercises | 2024-10-29T03:47:16Z | my exercises of https://codeberg.org/ziglings/exercises | my-fix | 0 | 0 | 0 | 0 | https://api.github.com/repos/oldratlee/ziglings-exercises/tags | MIT | [
"exercises",
"learning-by-doing",
"zig",
"ziglang",
"ziglings",
"ziglings-exercises"
] | 1,372 | false | 2024-11-04T15:52:46Z | true | false | # Ziglings
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 [Zig](https://ziglang.org/) 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
[rustlings](https://github.com/rust-lang/rustlings)
project for the [Rust](https://www.rust-lang.org/) language.
Indirect inspiration comes from [Ruby Koans](http://rubykoans.com/)
and the Little LISPer/Little Schemer series of books.
Ziglings was initiated by [Dave Gauer](https://ratfactor.com/).
## Intended Audience
This will probably be difficult if you've _never_ programmed
before. But no specific programming experience is required. And
in particular, you are _not_ 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:
* https://ziglang.org/learn/
* https://ziglearn.org/
* https://ziglang.org/documentation/master/
* [Zig in Depth! (video series)](https://www.youtube.com/watch?v=MMtvGA1YhW4&list=PLtB7CL7EG7pCw7Xy1SQC53Gl8pI7aDg9t&pp=iAQB)
Also, the [Zig community](https://github.com/ziglang/zig/wiki/Community)
is incredibly friendly and helpful!
## Getting Started
Install a [development build](https://ziglang.org/download/) of
the Zig compiler. (See the "master" section of the downloads
page.)
Verify the installation and build number of `zig` like so:
```
$ zig version
0.14.0-dev.xxxx+xxxxxxxxx
```
Clone this repository with Git:
```
$ git clone https://ziglings.org
$ cd ziglings.org
```
Then run `zig build` and follow the instructions to begin!
```
$ zig build
```
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
**Hint:** 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 **development** builds of the Zig
compiler rather than versioned **release** builds. The last
stable release was `0.13.0`, but Ziglings needs a dev build with
pre-release version "0.14.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 _greater_ 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.14.0-dev.1573
* *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257)
* *2024-09-02* zig 0.14.0-dev.1409 - several changes in std.builtin, see [#21225](https://github.com/ziglang/zig/pull/21225)
* *2024-08-04* zig 0.14.0-dev.1224 - several changes in build system, see [#21115](https://github.com/ziglang/zig/pull/21115)
* *2024-08-04* zig 0.14.0-dev.839 - several changes in build system, see [#20580](https://github.com/ziglang/zig/pull/20580), [#20600](https://github.com/ziglang/zig/issues/20600)
* *2024-06-17* zig 0.14.0-dev.42 - changes in `std.mem.split and tokenize` - see [#15579](https://github.com/ziglang/zig/pull/15579)
* *2024-05-29* zig 0.13.0-dev.339 - rework std.Progress - see [#20059](https://github.com/ziglang/zig/pull/20059)
* *2024-03-21* zig 0.12.0-dev.3518 - change to @fieldParentPtr - see [#19470](https://github.com/ziglang/zig/pull/19470)
* *2024-03-21* zig 0.12.0-dev.3397 - rename std.os to std.posix - see [#5019](https://github.com/ziglang/zig/issues/5019)
* *2024-03-14* zig 0.12.0-dev.3302 - changes in `std.fmt` - floating-point formatting implementation - see [#19229](https://github.com/ziglang/zig/pull/19229)
* *2024-02-05* zig 0.12.0-dev.2618 - changes in `build system` - from `Step.zig_exe` to `Step.graph.zig_exe` - see [#18778](https://github.com/ziglang/zig/issues/18778)
* *2024-01-05* zig 0.12.0-dev.2043 - rename of `std.Build.FileSource` to `std.Build.LazyPath` - see [#16353](https://github.com/ziglang/zig/issues/16353)
* *2023-10-24* zig 0.12.0-dev.1243 - changes in `std.ChildProcess`: renamed exec to run - see [#5853](https://github.com/ziglang/zig/issues/5853)
* *2023-06-26* zig 0.11.0-dev.4246 - changes in compile step (now it can be null)
* *2023-06-26* zig 0.11.0-dev.3853 - removal of destination type from all cast builtins
* *2023-06-20* zig 0.11.0-dev.3747 - `@enumToInt` is now `@intFromEnum` and `@intToFloat` is now `@floatFromInt`
* *2023-05-25* zig 0.11.0-dev.3295 - `std.debug.TTY` is now `std.io.tty`
* *2023-04-30* zig 0.11.0-dev.2704 - use of the new `std.Build.ExecutableOptions.link_libc` field
* *2023-04-12* zig 0.11.0-dev.2560 - changes in `std.Build` - remove run() and install()
* *2023-04-07* zig 0.11.0-dev.2401 - fixes of the new build system - see [#212](https://github.com/ratfactor/ziglings/pull/212)
* *2023-02-21* zig 0.11.0-dev.2157 - changes in `build system` - new: parallel processing of the build steps
* *2023-02-21* zig 0.11.0-dev.1711 - changes in `for loops` - new: Multi-Object For-Loops + Struct-of-Arrays
* *2023-02-12* zig 0.11.0-dev.1638 - changes in `std.Build` cache_root now returns a directory struct
* *2023-02-04* zig 0.11.0-dev.1568 - changes in `std.Build` (combine `std.build` and `std.build.Builder` into `std.Build`)
* *2023-01-14* zig 0.11.0-dev.1302 - changes in `@addWithOverflow` (now returns a tuple) and `@typeInfo`; temporary disabled async functionality
* *2022-09-09* zig 0.10.0-dev.3978 - change in `NativeTargetInfo.detect` in build
* *2022-09-06* zig 0.10.0-dev.3880 - Ex 074 correctly fails again: comptime array len
* *2022-08-29* zig 0.10.0-dev.3685 - `@typeName()` output change, stage1 req. for async
* *2022-07-31* zig 0.10.0-dev.3385 - std lib string `fmt()` option changes
* *2022-03-19* zig 0.10.0-dev.1427 - method for getting sentinel of type changed
* *2021-12-20* zig 0.9.0-dev.2025 - `c_void` is now `anyopaque`
* *2021-06-14* zig 0.9.0-dev.137 - std.build.Id `.Custom` is now `.custom`
* *2021-04-21* zig 0.8.0-dev.1983 - std.fmt.format() `any` format string required
* *2021-02-12* zig 0.8.0-dev.1065 - std.fmt.format() `s` (string) format string required
## Advanced Usage
It can be handy to check just a single exercise:
```
zig build -Dn=19
```
Or run all exercises, starting from a specific one:
```
zig build -Ds=27
```
Or let Ziglings pick an exercise for you:
```
zig build -Drandom
```
You can also run without checking for correctness:
```
zig build -Dn=19 test
```
Or skip the build system entirely and interact directly with the
compiler if you're into that sort of thing:
```
zig run exercises/001_hello.zig
```
Calling all wizards: To prepare an executable for debugging,
install it to zig-cache/bin with:
```
zig build -Dn=19 install
```
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
* [x] Hello world (main needs to be public)
* [x] Importing standard library
* [x] Assignment
* [x] Arrays
* [x] Strings
* [x] If
* [x] While
* [x] For
* [x] Functions
* [x] Errors (error/try/catch/if-else-err)
* [x] Defer (and errdefer)
* [x] Switch
* [x] Unreachable
* [x] Enums
* [x] Structs
* [x] Pointers
* [x] Optionals
* [x] Struct methods
* [x] Slices
* [x] Many-item pointers
* [x] Unions
* [x] Numeric types (integers, floats)
* [x] Labelled blocks and loops
* [x] Loops as expressions
* [x] Builtins
* [x] Inline loops
* [x] Comptime
* [x] Sentinel termination
* [x] Quoted identifiers @""
* [x] Anonymous structs/tuples/lists
* [ ] Async <--- ironically awaiting upstream Zig updates
* [X] Interfaces
* [X] Bit manipulation
* [X] Working with C
* [X] Threading
* [x] Labeled switch
Zig Standard Library
* [X] String formatting
* [X] Testing
* [X] Tokenization
* [X] File handling
## 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:
* Wording of explanations
* Idiomatic usage of Zig
* Additional exercises
Please see [CONTRIBUTING](https://codeberg.org/ziglings/exercises/src/branch/main/CONTRIBUTING.md)
in this repo for the full details.
|
https://avatars.githubusercontent.com/u/39071861?v=4 | AoC2023 | MrPicklePinosaur/AoC2023 | 2023-12-04T09:19:47Z | advent of code 2023 in ziglang | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/MrPicklePinosaur/AoC2023/tags | None | [
"advent-of-code-2023",
"zig"
] | 56 | false | 2023-12-04T10:20:56Z | false | false | <div align="center">
# Advent of Code 2023
</div>
## Writeups
## Day1
I have only had very minor exposure to programming in Zig, and was excited to
learn the language a lot better this year. Some immediate things that stood out
to me was how much was checked by the compiler. It feels like a mini-rust of
sorts. The optional and error types are also highly appreciated. Some slight
annoyances with the langauge include unsued variables being a compile error and
the slightly wacky loops.
In part b, I also discovered that the sentinel value of a pointer or slice is
also included in the type, which I found pretty neat. The saturating
subtracting operator is also some nice sugar.
## Day2
Day 2 involved a bit of parsing. My solution for this just involved string
splitting over and over again. I wonder how efficient this is? Perhaps a better
approach would be to make a single pass across the line using an iterator and
have a state machine to decide what we are parsing?
## Day3
Day 3 in all honesty gave me quite a hard time. This was perhaps due to lack of
understanding of the containers in the standard library, leading to perhaps
some really bad code. I also struggled quite a lot with writing nice code using
zig's loops, which behave slightly different to what you would expect from most
other languages. I would like to revisit this question when I get a bit better
at the language perhaps.
## Day4
Pretty clean solution using hashmap to check for winning numbers. Second part
of question was also a nice 1D DP solution. I did misunderstand the question
and thought you win a copy of the card of the number that you matched, leading
to an unnecessary topological sort implmenatation :P.
|
https://avatars.githubusercontent.com/u/87582318?v=4 | libwebp | koenigskraut/libwebp | 2023-10-24T17:32:32Z | libwebp partially ported to Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/koenigskraut/libwebp/tags | BSD-3-Clause | [
"libwebp",
"webp",
"zig"
] | 12,237 | true | 2023-12-25T06:43:49Z | true | true | # WebP Codec
```
__ __ ____ ____ ____
/ \\/ \/ _ \/ _ )/ _ \
\ / __/ _ \ __/
\__\__/\____/\_____/__/ ____ ___
/ _/ / \ \ / _ \/ _/
/ \_/ / / \ \ __/ \__
\____/____/\_____/_____/____/v1.3.2
```
WebP codec is a library to encode and decode images in WebP format. This package
contains the library that can be used in other programs to add WebP support, as
well as the command line tools 'cwebp' and 'dwebp' to compress and decompress
images respectively.
See https://developers.google.com/speed/webp for details on the image format.
The latest source tree is available at
https://chromium.googlesource.com/webm/libwebp
It is released under the same license as the WebM project. See
https://www.webmproject.org/license/software/ or the "COPYING" file for details.
An additional intellectual property rights grant can be found in the file
PATENTS.
## Building
Zig version required is at least `0.12.0-dev.1808+69195d0cd`. Build process for native target is just
```console
zig build -Doptimize=ReleaseSmall
```
Consider specifying generic target for maximum compatibility, for example:
```console
zig build -Dtarget=x86_64-linux
```
Pass option `zig-decoder` in order to use Zig port. If decoder is the only thing you'll need, you can use `only-decoder` option to deal only with Zig:
```console
zig build -Dzig-decoder -Donly-decoder
```
Also see the general [building documentation](doc/building.md).
## Encoding and Decoding Tools
The examples/ directory contains tools to encode and decode images and
animations, view information about WebP images, and more. See the
[tools documentation](doc/tools.md).
## APIs
See the [APIs documentation](doc/api.md), and API usage examples in the
`examples/` directory.
## Bugs
Please report all bugs to the issue tracker: https://bugs.chromium.org/p/webp
Patches welcome! See [how to contribute](CONTRIBUTING.md).
## Discuss
Email: [email protected]
Web: https://groups.google.com/a/webmproject.org/group/webp-discuss
|
https://avatars.githubusercontent.com/u/30635996?v=4 | zig-nix-deez | mitsuruu/zig-nix-deez | 2023-08-04T18:05:02Z | Template repository for bootstrapping a Zig executable using a Nix Flake | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/mitsuruu/zig-nix-deez/tags | Unlicense | [
"nix",
"nix-flakes",
"zig",
"ziglang"
] | 9 | false | 2023-08-20T21:19:32Z | true | false | # zig-nix-deez
A very basic (yet functional) way of getting Zig and Nix Flakes to work together to build a binary package for you. No bells, no whistles, just a `flake.nix` with a basic `stdenv.mkDerivation` to build a Hello World. |
https://avatars.githubusercontent.com/u/1991931?v=4 | ziggurat | johan-bolmsjo/ziggurat | 2019-10-05T18:24:41Z | Zig Data Structures | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/johan-bolmsjo/ziggurat/tags | MIT | [
"data-structures",
"zig"
] | 35 | false | 2024-05-09T14:56:28Z | false | false | # Ziggurat
Data structures for [zig](https://ziglang.org/).
BEWARE: This is a learning experience!
I have just started this journey. Unless I tire of the language I will port my
favorite data structures and add them to this repo.
Compiles with: zig 0.12
## Running Tests
zig test list_test.zig
zig test -O ReleaseSafe avl_test.zig
|
https://avatars.githubusercontent.com/u/135145066?v=4 | once | dying-will-bullet/once | 2023-06-14T10:28:21Z | OnceCell and Lazy in Zig | master | 1 | 0 | 1 | 0 | https://api.github.com/repos/dying-will-bullet/once/tags | None | [
"global-variables",
"lazy-initialization",
"zig",
"ziglang"
] | 10 | false | 2024-05-29T09:11:17Z | true | true | <h1 align="center"> once ⛳ </h1>
[](https://github.com/Hanaasagi/struct-env/actions/workflows/ci.yaml)

This library implements the concepts of `Cell` and `Lazy` in Rust, which are used for lazy initialization of variables.
## Examples
### `Lazy`: A value which is initialized on the first access.
```zig
const std = @import("std");
const Lazy = @import("once").Lazy;
const allocator = std.heap.page_allocator;
var global_map = Lazy(
// Type of Cell
std.StringHashMap(i32),
// Cell Init Function
struct {
fn f() std.StringHashMap(i32) {
var map = std.StringHashMap(i32).init(allocator);
map.put("a", 1) catch @panic("unable to put a");
return map;
}
}.f,
).init();
pub fn main() !void {
var map_ptr = global_map.get();
try map_ptr.*.put("b", 2);
std.debug.assert(map_ptr.*.get("a").? == 1);
std.debug.assert(map_ptr.*.get("b").? == 2);
}
```
### `OnceCell`: A thread-safe cell which can be written to only once.
```zig
const std = @import("std");
const OnceCell = @import("once").OnceCell;
var shared: usize = 0;
pub fn main() !void {
var cell = OnceCell([]const u8).empty();
std.debug.assert(cell.get() == null);
// Both try to init a cell
var threads: [8]std.Thread = undefined;
for (&threads) |*handle| {
handle.* = try std.Thread.spawn(.{}, struct {
fn thread_fn(c: *OnceCell([]const u8)) !void {
_ = c.getOrInit(struct {
fn f() []const u8 {
shared += 1;
return "Hello";
}
}.f);
}
}.thread_fn, .{&cell});
}
for (threads) |handle| handle.join();
std.debug.assert(std.mem.eql(u8, cell.get().?.*, "Hello"));
// Only init once
std.debug.assert(shared == 1);
}
```
## Installation
## LICENSE
MIT License Copyright (c) 2023, Hanaasagi
|
https://avatars.githubusercontent.com/u/2828351?v=4 | Zig-Intel-Hex | bcrist/Zig-Intel-Hex | 2023-10-28T04:17:10Z | Intel Hex format library in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/bcrist/Zig-Intel-Hex/tags | MIT | [
"encoding",
"ihex",
"intel-hex",
"intelhex",
"zig",
"zig-library",
"zig-package",
"ziglang"
] | 5 | false | 2024-06-22T15:29:41Z | true | true | # Zig-Intel-Hex
Prints binary data into Intel Hex format.
TODO: Parsing
|
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 | # [Z]ig & [Ray]lib & Wa[sm]
## Overview
- Experimentation around Zig, Raylib and Wasm.
- A game in Zig using Raylib bindings and allowing plugins written in Wasm...
- Currently we are able to use Raylib and build a small WAT file.
## Installation
### Requirements
- To use *Zraysm* you will need [Raylib](https://github.com/raysan5/raylib) and [Wasmer](https://github.com/wasmerio/wasmer/releases).
- For information we are testing with the following versions:
- Raylib: Release v5.0
- Wasmer: Release v4.3.2
### Install *Raylib* header and library
- You need to build [Raylib](https://github.com/raysan5/raylib)
- Create a directory called *raylib* (or modify *build.zig*)
- Then copy the `raylib.h`, `raymath.h` and `libraylib.a` into the *raylib/* directory
- As *Raylib* has a `build.zig` file it should be easy to build it with *Zraysm*
### Install *Wasmer* headers and library
- Download [Wasmer](https://github.com/wasmerio/wasmer/releases)
- Create a directory *wasmer*
- go into the directory and untar the previously downloaded release
- we only need `lib/libwasmer.so` and the `include/*` but you can keep other stuff
- After installing *Raylib* and *Wasmer* you should have a tree like:
```
.
├── 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
```
### Run *Zraysm*
- We have an issue using `libwasmer.a` so to run it:
- `zig build && LD_LIBRARY_PATH=./wasmer/lib ./zig-out/bin/zraysm ./src/wat/gcd.wat`
- or you can just do: `zig build run`
- **Note**: only wasm function that takes two i32 arguments and returns one i32 can be called for now
## Changelog
**2024-06-24** Gthvn1 <[email protected]>
* Draw a ship
**2024-06-21** Gthvn1 <[email protected]>
* Read the WAT file as the first argument of `Zraysm`
* Read a WAT file instead of using the string
**2024-06-20** Gthvn1 <[email protected]>
* Run a WAT string into our Zig code using Wasmer
* It is the example in the *wasmer/include/README.md*
**2024-06-17** Gthvn1 <[email protected]>
* Add samples of wasmtime C API
* don't know if we will use wasmtime or another runtime.
**2024-06-15** Gthvn1 <[email protected]>
* 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...
<img align="center" src="https://github.com/gthvn1/zraysm/blob/master/screenshots/first_ship.png">
|
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 | 404 |
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 | None | [
"api",
"zap",
"zig",
"ziglang"
] | 7 | false | 2024-07-23T19:21:52Z | true | true | # zap
Example API using zap and zig |
https://avatars.githubusercontent.com/u/23312691?v=4 | blockchain | lavrd/blockchain | 2017-12-23T22:55:32Z | PoW blockchain implementation | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/lavrd/blockchain/tags | MIT | [
"blockchain",
"blockchain-demo",
"blockchain-demos",
"blockchain-technology",
"demo",
"demo-app",
"example",
"explanation",
"p2p",
"p2p-network",
"pow",
"proof-of-work",
"simple",
"udp",
"zig",
"ziglang"
] | 168 | false | 2024-08-07T05:14:03Z | true | false | # Blockchain
Simple blockchain implementation for demo purposes.
## Usage
See [make targets](./Makefile) for available commands.
```shell
PORT=33400 GENESIS=00000000000000000000000000000000c4a55b5a7d0d89586e37238ca05362389e0dd85157d8652bd24fc483f66c22c0000000000000000000000000000000000000000000000000000000000000000003068fab900100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \
make run
MINING=1 NODES=127.0.0.1:33400 GENESIS=00000000000000000000000000000000c4a55b5a7d0d89586e37238ca05362389e0dd85157d8652bd24fc483f66c22c0000000000000000000000000000000000000000000000000000000000000000003068fab900100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \
make run
```
Or you can use predefined commands:
```shell
make run_ln
make run_fn
```
### Docker
```shell
make build_docker
# -it to use ctrl+c
docker run --rm -it blockchain
```
```shell
make build_docker && docker run --rm -it -e PORT=33400 -e GENESIS=00000000000000000000000000000000c4a55b5a7d0d89586e37238ca05362389e0dd85157d8652bd24fc483f66c22c0000000000000000000000000000000000000000000000000000000000000000003068fab900100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \
--name light-node --net host blockchain
docker run --rm -it -e MINING=1 -e NODES=127.0.0.1:33400 -e GENESIS=00000000000000000000000000000000c4a55b5a7d0d89586e37238ca05362389e0dd85157d8652bd24fc483f66c22c0000000000000000000000000000000000000000000000000000000000000000003068fab900100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \
--name full-node --net host blockchain
```
Or you can use predefined commands:
```shell
make run_docker_ln
make run_docker_fn
```
## Graph
In order to generate blockchain graph use following command:
```shell
make gen_graph
```
### Example

## Troubleshooting
To test UDP server use following command: `echo "test" | nc -u -w 1 127.0.0.1 44600`.
|
https://avatars.githubusercontent.com/u/114303361?v=4 | me | ryuapp/me | 2023-12-28T00:35:01Z | A minimal cat(1) clone for Windows. | main | 3 | 0 | 0 | 0 | https://api.github.com/repos/ryuapp/me/tags | MIT | [
"cli",
"windows",
"zig"
] | 33 | false | 2024-08-19T14:48:10Z | true | true | 
### me
**me** is a minimal cat(1) clone for Windows.\
Print FILE(s) to standard output.
### Usage
```bash
me [OPTION]... [FILE]...
```
### Installation
[Scoop](https://scoop.sh/):
```bash
scoop install https://raw.githubusercontent.com/ryuapp/me/main/me.json
``` |
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 | None | [
"cpf-validador",
"zig"
] | 9 | false | 2024-08-21T13:38:01Z | true | true | # Pequi
Just a fiscal code validator in order to learn Zig
|
https://avatars.githubusercontent.com/u/69948027?v=4 | Zprob | AXiX-official/Zprob | 2024-09-04T13:35:27Z | A simple console progress bar for Zig(no dependencies required). | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/AXiX-official/Zprob/tags | MIT | [
"zig",
"ziglang"
] | 3 | false | 2024-09-04T13:39:57Z | true | true | # Zprob
A simple console progress bar for Zig(no dependencies required).
Only tested on zig 0.13.0.
## Usage
only need import `Zprob.zig`(in `src` folder) and use `Zprob` struct.
run `zig build run` to see `example.zig`'s output.
`example.zig`:
```zig
const std = @import("std");
const Zprob = @import("Zprob.zig");
pub fn main() !void {
// Get a new Zprob instance.
// The capacity is set to 100.
// The output file is set to the standard output.
var zprob = Zprob{ .capacity = 100, .out = &std.io.getStdOut() };
// Reset(initialize) the progress bar.
// Must be called just before the loop.
zprob.Reset();
for (0..100) |i| {
_ = i;
// Because write to the standard output may fail, we use `try`.
// Can't use `defer` here because return value is not `void`.
try zprob.Update(1, "test");
}
// Reuse the Zprob instance.
zprob.Resize(1000);
var b: u32 = 0;
while (b < 1000) : (b += 1) {
var buffer: [10]u8 = undefined;
const curr_number_str = std.fmt.bufPrint(buffer[0..], "{}", .{b}) catch unreachable;
// Update the progress bar with description.
try zprob.Update(1, curr_number_str);
std.time.sleep(10_000_000);
}
zprob.Reset();
b = 0;
while (b < 1000) : (try zprob.Update(1, "")) {
b += 1;
std.time.sleep(10_000_000);
}
}
``` |
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 | <h1 align="center">apricot</h1>
<p align="center">
<a href="https://github.com/OsoGran/apricot/releases/latest"><img src="https://img.shields.io/github/release/OsoGran/apricot/all.svg" alt="Latest release" /></a>
</p>
<p align="center">
<a href="https://github.com/OsoGran/apricot/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="License" /></a>
</p>
`apricot` is a terminal file manager with vim like keybindings, written in C++. [Ranger](https://github.com/ranger/ranger) and [cfiles](https://github.com/mananapr/apricot) have heavily inspired me to create apricot. Apricot is intended to be quick, memory safe, minimal, and easy to use.
<!--- Screenshot? --->
## Dependencies
## Compiling and Installation
To compile, run
|
https://avatars.githubusercontent.com/u/36650528?v=4 | ethereum-node-implementation | Archisman-Mridha/ethereum-node-implementation | 2024-09-16T05:53:12Z | Ethereum execution and consensus client implemented in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Archisman-Mridha/ethereum-node-implementation/tags | None | [
"ethereum",
"ethereum-consensus-client",
"ethereum-execution-client",
"ethereum-node",
"ethereum-zig",
"zig"
] | 47 | false | 2025-02-01T07:14:48Z | false | false | 404 |
https://avatars.githubusercontent.com/u/71959210?v=4 | ziggy-pydust-template | itsmeadarsh2008/ziggy-pydust-template | 2025-02-01T11:49:50Z | A template for building Python extensions in Zig using Pydust toolkit. (use with uv) | develop | 0 | 0 | 0 | 0 | https://api.github.com/repos/itsmeadarsh2008/ziggy-pydust-template/tags | Apache-2.0 | [
"extension",
"python",
"template",
"zig"
] | 283 | true | 2025-02-02T07:34:35Z | false | false | # Ziggy Pydust Template
This repository contains a template for writing and packaging native Python extension modules in Zig using [Pydust](https://github.com/fulcrum-so/ziggy-pydust) framework.
This template includes:
- A Python `uv` project.
- A `src/` directory containing a Pydust Python module.
- Pytest setup for running both Python and Zig unit tests.
- GitHub Actions workflows for building and publishing the package.
- VSCode settings for recommended extensions, debugger configurations, etc.
We recommend heading to [Getting Started](https://pydust.fulcrum.so/latest/getting_started/).
|
https://avatars.githubusercontent.com/u/36650528?v=4 | tcp-server | Archisman-Mridha/tcp-server | 2024-11-23T14:31:28Z | Building a TCP server from scratch in each of : Rust, Zig and C | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/Archisman-Mridha/tcp-server/tags | None | [
"c",
"rust",
"tcp",
"tcp-server",
"zig"
] | 27 | false | 2025-02-02T08:18:22Z | false | false | # Implementing a TCP server from scratch
## Knowledge nuggets
- The UT8 or ASCII encoding of 4,294,967,295 takes 10 bytes - 1 byte per digit. The binary encoding takes 4 bytes; quite the space saving! Conversely, the UTF8 or ASCII encoding of "63" uses just 2 bytes, versus the 4 byte if we're using a **4-byte fixed length**.
> There are variable-length binary encoding scheme, such as the `varint` used by Google's **Protocol Buffer**.
- Some protocols use **both delimiters and some type of prefix**. HTTP, for example, uses delimiters for its headers, but the body's length is typically defined by the text-encoded Content-Length header. Redis also stands out as having a mix of both delimiters (for ease of human-readability) and text-encoded length prefix.
- Elixir and Erlang have strong support for **vectored I/O**.
## REFERENCEs
- [TUN/TAP](https://en.wikipedia.org/wiki/TUN/TAP)
- [TRANSMISSION CONTROL PROTOCOL](https://www.ietf.org/rfc/rfc793.txt)
- [INTERNET PROTOCOL](https://datatracker.ietf.org/doc/html/rfc791)
- [Datagrams](https://en.wikipedia.org/wiki/Datagram)
- [SYN flood attack](https://www.cloudflare.com/en-in/learning/ddos/syn-flood-ddos-attack/)
- [TCP Server in Zig - Part 1 - Single Threaded](https://www.openmymind.net/TCP-Server-In-Zig-Part-1-Single-Threaded/)
|
https://avatars.githubusercontent.com/u/45996170?v=4 | tizen-zig-app | griffi-gh/tizen-zig-app | 2025-02-05T14:48:31Z | [experiment] trying to compile zig for tizen :p | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/griffi-gh/tizen-zig-app/tags | None | [
"galaxy-watch",
"tizen",
"tizen-studio",
"zig",
"zig-build",
"ziglang"
] | 54 | false | 2025-02-09T22:14:33Z | true | true | 404 |
https://avatars.githubusercontent.com/u/69104965?v=4 | lexbor-zig | doccaico/lexbor-zig | 2025-02-18T00:49:49Z | Zig build package and wrapper for Lexbor v2.4.0 | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/doccaico/lexbor-zig/tags | None | [
"lexbor",
"zig"
] | 2,446 | false | 2025-02-26T02:07:34Z | true | true | ### (WIP) lexbor-zig
Experimental Zig build package and wrapper for [Lexbor](https://github.com/lexbor/lexbor/) v2.4.0
Currently, it has only been tested on Windows.
#### Fetch
```
zig fetch --save=lexbor https://github.com/doccaico/lexbor-zig/archive/<git-commit-hash>.tar.gz
```
#### Using as a single static library (it included all modules)
```zig
// build.zig
// const exe = b.addExecutable(.{
// ...
const lexbor = b.dependency("lexbor", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("lexbor", lexbor.module("lexbor"));
// src/main.zig
const std = @import("std");
const core = @import("lexbor").core;
pub fn main() !void {
const array = core.array.create();
const status = core.array.init(array, 32);
try std.testing.expectEqual(status, .ok);
_ = core.array.destroy(array, true);
}
```
#### Using individual modules (e.g. html module)
```zig
// build.zig
// const exe = b.addExecutable(.{
// ...
const lexbor = b.dependency("lexbor", .{
.target = target,
.optimize = optimize,
.html = true,
});
exe.root_module.addImport("lexbor", lexbor.module("lexbor"));
```
See more options: [build.zig](https://github.com/doccaico/lexbor-zig/blob/main/build.zig)
#### How to build a static library (it included all modules)
```
git clone https://github.com/doccaico/lexbor-zig
zig build
```
#### How to build static libraries separately (e.g. html module)
```
git clone https://github.com/doccaico/lexbor-zig
zig build -Dhtml
```
|
https://avatars.githubusercontent.com/u/1915?v=4 | eheap | kivikakk/eheap | 2024-09-19T06:35:11Z | Embedded heap for Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/kivikakk/eheap/tags | GPL-3.0 | [
"zig"
] | 19 | false | 2024-09-27T06:51:46Z | true | true | # eheap
A heap allocator intended for embedded scenarios where memory is at a premium,
but you still want to be able to just throw an `Allocator` at things.
Extracted from/intended for [Ava].
[Ava]: https://sr.ht/~kivikakk/ava/
|
https://avatars.githubusercontent.com/u/22549550?v=4 | zmodb | EloToJaa/zmodb | 2024-08-13T15:49:23Z | Zig modbus library based on libmodbus | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/EloToJaa/zmodb/tags | None | [
"c",
"libmodbus",
"modbus",
"zig"
] | 23 | false | 2024-09-28T11:20:46Z | true | true | 404 |
https://avatars.githubusercontent.com/u/133709987?v=4 | zlam | cartersusi/zlam | 2024-09-05T22:06:52Z | No Description | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/cartersusi/zlam/tags | None | [
"huggingface",
"llama3",
"llm",
"transformers",
"zig"
] | 20 | false | 2024-10-27T14:44:37Z | false | false |
## Setup
```
git clone https://github.com/cartersusi/zlam.git
cd zlam
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Tokens in credentials
huggingface-cli login
git remote add hf https://huggingface.co/cartersusi/zig-LLaMa
chmod +x run_peft.sh
./run_peft.sh
```
|
https://avatars.githubusercontent.com/u/164030498?v=4 | zna | cherninlab/zna | 2024-11-08T23:44:42Z | zna (Zen Navigation Assistant) is a minimal, lightning-fast command-line directory navigator written in Zig. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/cherninlab/zna/tags | MIT | [
"cli",
"zig"
] | 7 | false | 2024-11-22T10:25:00Z | true | false | <img src="logo.svg" alt="zna" width="200"/>
# zna
`zna` (Zen Navigation Assistant) is a minimal, lightning-fast command-line directory navigator written in Zig.
## Installation
### From Binary (recommended)
```bash
# Linux (x86_64)
curl -L https://github.com/cherninlab/zna/releases/latest/download/zna-linux-x86_64 -o zna
chmod +x zna
sudo mv zna /usr/local/bin/
```
### From Source
```bash
git clone https://github.com/cherninlab/zna.git
cd zna
zig build -Drelease-safe
sudo cp zig-out/bin/zna /usr/local/bin/
```
## Usage
```bash
$ zna # Start navigation in current directory
Arrow keys to navigate # ↑↓ to select
Enter to go into dir # Enter directory
q to quit # Quit the program
```
## License
MIT
|
https://avatars.githubusercontent.com/u/68423550?v=4 | aoc2024 | TimStricker/aoc2024 | 2024-12-03T06:58:16Z | Advent of Code 2024 in Zig | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/TimStricker/aoc2024/tags | MIT | [
"advent-of-code",
"advent-of-code-2024",
"advent-of-code-in-zig",
"advent-of-code-zig",
"aoc",
"aoc-2024",
"aoc2024",
"zig",
"ziglang"
] | 62 | false | 2024-12-15T17:50:47Z | false | false | # Advent of Code 2024
My attempt to solve AoC 2024 in [Zig](https://github.com/ziglang/zig/). I am not
yet super familiar with the language, so don't expect the most beautiful,
idiomatic Zig code. This is really just me trying to learn.
## Supported Zig version
I'm using the nightly version of Zig to solve these tasks. At the time of
writing, this is `0.14.0-dev.2465+70de2f3a7`. Note that Zig is still in active
development and new versions might have braking changes, so it is not guaranteed
that the code works with any other version.
## How to run
You can find the solution for each day in the `dayXY` directories. They are all
self-contained and can simply be executed using `zig run`.
As an example, here you can see how to run the solution to day 1:
```
$ zig run day01/main.zig
Total distance: 2742123
Similarity score: 21328497
Task took 8 ms to complete.
```
**Note:** At the moment, the applications assume they are being called from the
repository root. If you call them from anywhere else, they won't be able to find
the input for the day. I might fix this in the future.
Basically all of the solutions contain some tests with the sample input, you
can run these using `zig test <dayXY>/main.zig`.
|
https://avatars.githubusercontent.com/u/9393486?v=4 | tarn | tomcur/tarn | 2024-05-01T10:23:14Z | [mirror] River layout generators | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/tomcur/tarn/tags | GPL-3.0 | [
"riverwm",
"wayland",
"wayland-compositor",
"zig"
] | 92 | false | 2024-12-29T10:52:55Z | true | true | # Tarn
Tarn is a collection of [River](https://codeberg.org/river/river) layout
generators (currently N=1).
## Included layouts
- tarn-dwindle: a dwindling layout with horizontal and vertical dwindle ratios
specifiably separately
## Usage
Tarn provides separate binaries for each layout.
```bash
$ tarn-dwindle -h
```
### tarn-dwindle
You can send layout commands to update the Dwindle layout ratios, for example:
```bash
riverctl map normal Super+Control H send-layout-cmd tarn-dwindle "horizontal-ratio -0.05"
riverctl map normal Super+Control J send-layout-cmd tarn-dwindle "vertical-ratio +0.05"
riverctl map normal Super+Control K send-layout-cmd tarn-dwindle "vertical-ratio -0.05"
riverctl map normal Super+Control L send-layout-cmd tarn-dwindle "horizontal-ratio +0.05"
```
## Installing
Using Nix
```bash
$ nix build git+https://codeberg.org/tomcur/tarn.git
```
You can use the provided flake to install Tarn in a flake-based NixOS configuration. For example:
```nix
{
description = "Your system config";
inputs = {
# ..
tarn = {
url = "git+https://codeberg.org/tomcur/tarn.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, tarn, ... }: {
nixosConfigurations = {
yourSystem =
let
system = "x86_64-linux";
modules = [
{
nixpkgs.overlays = [
(self: super: {
tarn = tarn.packages.${system}.default;
})
]
}
];
in
nixpkgs.lib.nixosSystem {
inherit system modules;
};
};
};
}
```
|
https://avatars.githubusercontent.com/u/76484203?v=4 | zigu | lebenoa/zigu | 2024-01-13T12:06:39Z | Yet another zig updater.. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/lebenoa/zigu/tags | BSL-1.0 | [
"updater",
"zig"
] | 63 | false | 2025-01-15T14:31:19Z | true | true | <div align="center">
# Zigu
Yet another (Zig) (u)pdater
# Dependencies
</div>
### Runtime
- `tar` for extracting compressed archive (Runtime)
### Build
> No build dependencies other than `Zig compiler`
# <div align="center">Usage</div>
```pwsh
Usage:
zigu <command>
Commands:
list Show all available versions
latest Install latest stable version
nightly | master Install latest nightly version
[version] Install specified version.
Will resolve to a latest version with the provided prefix
help Show this help message
Examples:
zigu latest
zigu 0 Will resolve to latest 0.x.x version (i.e. 0.11.0) if any
zigu 0.10 Will resolve to latest 0.10 version (i.e. 0.10.1) if any
zigu 1 Will resolve to latest 1.x.x version if any
```
# Screenshot

|
https://avatars.githubusercontent.com/u/442455?v=4 | cimgui-knobs | dinau/cimgui-knobs | 2025-02-18T14:27:42Z | Knobs library wrapper in C lang. for Dear ImGui | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/dinau/cimgui-knobs/tags | MIT | [
"cimgui",
"cimknobs",
"imgui",
"knobs",
"luajit",
"nim",
"rust",
"warpper",
"zig"
] | 1,979 | false | 2025-02-25T01:17:16Z | false | false | ## CImGui Knobs


This is a port/adaptation of [ImGui-Knobs](https://github.com/altschuler/imgui-knobs), for C language (contributed to [ImGuin](http://github.com/dinau/imguin) project) by [system64MC](https://github.com/system64MC) at [2024/12](https://github.com/dinau/imguin/issues/16#issuecomment-2538066999).
I've just isolated the sources from ImGuin project for maintenance and convenience and added [a simple demo program in C language](demo/c/main.c).

### Usage
---
Add
```txt
cimgui-knobs.cpp
cimgui-knobs.h
imgui-knobs.cpp
imgui-knobs.h
```
to your project and include `cimgui-knobs.h` in some source file.
### Building and runiing demo in C language
---
#### Prerequisites
---
- Windows10 OS or later
- [Msys2/MinGW](https://www.msys2.org/) tools installed. (gcc, make, etc)
```sh
pacman -S mingw-w64-ucrt-x86_64-{gcc,glfw,SDL2,pkgconf} make
```
- Linux OS (Debian/ Ubuntu families)
```sh
$ sudo apt install xorg-dev libopengl-dev libgl1-mesa-dev
$ sudo apt install libglfw3 libglfw3-dev libsdl2-dev
```
#### Building and running demo
---
```sh
git clone --recursive https://github.com/dinau/cimgui-knobs
cd cimgui-knobs/demo/c
make run
```
|
https://avatars.githubusercontent.com/u/565124?v=4 | w4-8x8-fill-patterns | peterhellberg/w4-8x8-fill-patterns | 2024-07-06T21:16:50Z | https://assets.c7.se/games/w4-8x8-fill-patterns/ | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/peterhellberg/w4-8x8-fill-patterns/tags | CC0-1.0 | [
"fantasy-console",
"wasm4",
"zig"
] | 42 | false | 2025-03-04T13:38:53Z | true | true | # w4-8x8-fill-patterns :bucket:
A `.wasm` cart for use in [WASM-4](https://wasm4.org/) written
in [Zig](https://ziglang.org/) :zap:
<https://assets.c7.se/games/w4-8x8-fill-patterns>
> [!Note]
> Based on patterns found at [8x8.me](https://github.com/ace-dent/8x8.me/)
## Usage
| Key | |
|---------------------:|----------------------------------------|
| **Z** | Next palette
| **X** | Invert colors
| **Up/Down** | Switch “gallery”
| **Left/Right** | Switch “pattern” in current “gallery”
| **Held Left Mouse** | Show zoomed in “pattern”
| **Held Right Mouse** | Clear background
## Development
File watcher can be started by calling:
```sh
zig build spy
```
Running the cart in WASM-4:
```sh
zig build run
```
Deploy:
```
make deploy
```
### Tools
#### `bitsy-to-w4-sprites`
A small Go program that converts the `*.bitsy.txt` files from [8x8.me](https://8x8.me/)
into Zig :zap: files compatible with [w4](https://github.com/peterhellberg/w4).
```sh
ACE_DENT_8X8="/home/peter/Code/GitHub/ace-dent/8x8.me"
OUT_DIR="/home/peter/Code/w4/w4-8x8-fill-patterns/src/patterns"
mkdir -p $OUT_DIR
cat $ACE_DENT_8X8/01-Dither/Dither.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Dither.zig
cat $ACE_DENT_8X8/02-Dots/Dots.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Dots.zig
cat $ACE_DENT_8X8/03-Dashes/Dashes.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Dashes.zig
cat $ACE_DENT_8X8/04-Lines/Lines.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Lines.zig
cat $ACE_DENT_8X8/05-Waves/Waves.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Waves.zig
cat $ACE_DENT_8X8/06-Grid/Grid.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Grid.zig
cat $ACE_DENT_8X8/07-Checked/Checked.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Checked.zig
cat $ACE_DENT_8X8/08-Rectilinear/Rectilinear.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Rectilinear.zig
cat $ACE_DENT_8X8/09-Radial/Radial.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Radial.zig
cat $ACE_DENT_8X8/10-Round/Round.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Round.zig
cat $ACE_DENT_8X8/11-Woven/Woven.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Woven.zig
cat $ACE_DENT_8X8/12-Architecture/Architecture.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Architecture.zig
cat $ACE_DENT_8X8/13-Nature/Nature.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Nature.zig
cat $ACE_DENT_8X8/14-Symbols/Symbols.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Symbols.zig
cat $ACE_DENT_8X8/15-Other/Other.bitsy.txt | bitsy-to-w4-sprites -format w4 > $OUT_DIR/Other.zig
```
|
https://avatars.githubusercontent.com/u/44740171?v=4 | zig-ansi-parse | chardoncs/zig-ansi-parse | 2024-10-31T06:17:49Z | Comptime-proof ANSI format parsing library for Zig | main | 1 | 0 | 0 | 0 | https://api.github.com/repos/chardoncs/zig-ansi-parse/tags | MIT | [
"ansi-code",
"ansi-colors",
"ansi-terminal",
"colorization",
"parser",
"zig",
"ziglang"
] | 51 | false | 2025-03-07T03:43:30Z | true | true | # zig-ansi-parse
Comptime-proof ANSI format parsing library for Zig.
[How it works?](https://github.com/chardoncs/zig-ansi-parse/wiki/Syntax)
## Install
1. Fetch it in your project, `<version>` is the version you want
```bash
zig fetch --save https://github.com/chardoncs/zig-ansi-parse/archive/refs/tags/v<version>.tar.gz
```
Or fetch the git repo for latest updates
```bash
zig fetch --save git+https://github.com/chardoncs/zig-ansi-parse
```
2. Configure your `build.zig`.
```zig
const ansi_parse = b.dependency("ansi-parse", .{});
exe.root_module.addImport("ansi-parse", ansi_parse.module("ansi-parse"));
```
## At a glance
```zig
const std = @import("std");
const parseComptime = @import("ansi-parse").parseComptime;
const demo_text = parseComptime(
\\<CYAN>Greetings!</> I'm <B>bold</> and <BLUE;B>blue</>
\\<NYAN>Ignore this</>
\\\<escaped>
\\<!TAB>tabbed<!LF>Ollal<!CR>Hello
\\<!TAB*3>Three tabs
\\
, .{} // Options
);
pub fn main() !void {
std.debug.print(demo_text, .{});
}
```
## Options
| Name | Default value | Description |
|--------------|-----------------|-------------------------|
| branch_quota | 200,000 | (Comptime only) Evaluation branch quota. A larger quota can prevent the compiler from giving up caused by loops |
| out_size | `input.len * 4` | (Comptime only) Capacity of the output string, set a larger value if the output is truncated |
|
https://avatars.githubusercontent.com/u/68057?v=4 | zig_uv | ousttrue/zig_uv | 2022-09-13T12:18:08Z | libuv zig build and uvbook | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/ousttrue/zig_uv/tags | None | [
"libuv",
"zig"
] | 1,932 | false | 2025-03-08T09:59:46Z | true | true | # libuv from zig
`zig-0.13.0`
## zig-0.14.0
```
error: lld-link: undefined symbol: __declspec(dllimport) _CrtSetReportHook
#if debug
add link to ucrtbased
```
## dependencies
`master required` `v1.48.0` has CONTAINING_RECORD issue.
```sh
> zig fetch --save=libuv git+https://github.com/libuv/libuv.git
```
## trobule
### CONTAINING_RECORD cause runtime INVALID INSTRUCTION
patch for src/win/req-inl.h
```c
INLINE static uv_req_t* uv__overlapped_to_req(OVERLAPPED* overlapped) {
// cause illegal instruction
// return CONTAINING_RECORD(overlapped, uv_req_t, u.io.overlapped);
return (uv_req_t*)((char*)overlapped - offsetof(uv_req_t, u.io.overlapped));
}
```
same https://github.com/libuv/libuv/pull/4254
merged 2024/08/06
### error: dependency loop detected
- https://github.com/ziglang/zig/issues/18247
```zig
pub const struct_uv_stream_s = extern struct {
read_cb: uv_read_cb = @import("std").mem.zeroes(uv_read_cb),
};
// 👆👇
pub const uv_read_cb = ?*const fn ([*c]uv_stream_t, isize, [*c]const uv_buf_t) callconv(.C) void;
// workaround
pub const uv_read_cb = ?*const fn (*anyopaque, isize, [*c]const uv_buf_t) callconv(.C) void;
```
## uvbook
- https://docs.libuv.org/en/v1.x/guide/introduction.html
```sh
> zig build -l
install (default) Copy build artifacts to prefix path
uninstall Remove build artifacts from prefix path
c_helloworld Build & run c_helloworld
zig_helloworld Build & run zig_helloworld
> zig build c-helloworld
```
### [Basics of libuv]https://docs.libuv.org/en/v1.x/guide/basics.html
| name | c-win32 | zig |
| ---------------------------------------------------------------------------------- | ------- | --- |
| [helloworld](https://github.com/libuv/libuv/blob/v1.x/docs/code/helloworld/main.c) | o | o |
| [idle-basic](https://github.com/libuv/libuv/blob/v1.x/docs/code/idle-basic/main.c) | o | o |
### [Filesystem](https://docs.libuv.org/en/v1.x/guide/filesystem.html)
| name | c-win32 | zig |
| ------------------------------------------------------------------------------ | ------- | ------------ |
| [uvcat](https://github.com/libuv/libuv/blob/v1.x/docs/code/uvcat/main.c) | o | o translated |
| [uvtee](https://github.com/libuv/libuv/blob/v1.x/docs/code/uvtee/main.c) | o | o translated |
| [onchange](https://github.com/libuv/libuv/blob/v1.x/docs/code/onchange/main.c) | o | o |
### [Networking](https://docs.libuv.org/en/v1.x/guide/networking.html)
| name | c-win32 | zig |
| -------------------------------------------------------------------------------------------- | ------- | -------------------------- |
| [tcp-echo-server](https://github.com/libuv/libuv/blob/v1.x/docs/code/tcp-echo-server/main.c) | o | o translated, TODO: client |
| [udp-dhcp](https://github.com/libuv/libuv/blob/v1.x/docs/code/udp-dhcp/main.c) | o | o translated |
| [dns](https://github.com/libuv/libuv/blob/v1.x/docs/code/dns/main.c) | o | o TODO: not work |
| [interfaces](https://github.com/libuv/libuv/blob/v1.x/docs/code/interfaces/main.c) | o | x @cimport error |
### [Threads](https://docs.libuv.org/en/v1.x/guide/threads.html)
| name | c-win32 | zig |
| ---------------------------------------------------------------------------------------- | --------------- | --- |
| [thread-create](https://github.com/libuv/libuv/blob/v1.x/docs/code/thread-create/main.c) | c | o |
| [locks](https://github.com/libuv/libuv/blob/v1.x/docs/code/locks/main.c) | uv_barrier_wait | |
| [queue-work](https://github.com/libuv/libuv/blob/v1.x/docs/code/queue-work/main.c) | `<unistd.h>` | |
| [queue-cancel](https://github.com/libuv/libuv/blob/v1.x/docs/code/queue-cancel/main.c) | `<unistd.h>` | |
| [progress](https://github.com/libuv/libuv/blob/v1.x/docs/code/progress/main.c) | `<unistd.h>` | |
### [Process](https://docs.libuv.org/en/v1.x/guide/process.html)
| name | c-win32 | zig |
| ------------------------------------------------------------------------------------------------ | ------------ | ------------ |
| [spawn](https://github.com/libuv/libuv/blob/v1.x/docs/code/spawn/main.c) | o | o translated |
| [detach](https://github.com/libuv/libuv/blob/v1.x/docs/code/detach/main.c) | o | |
| [signal](https://github.com/libuv/libuv/blob/v1.x/docs/code/signal/main.c) | `<unistd.h>` | |
| [proc-streams](https://github.com/libuv/libuv/blob/v1.x/docs/proc-streams/locks/main.c) | o | |
| [cgi](https://github.com/libuv/libuv/blob/v1.x/docs/code/cgi/main.c) | o | and cgi/tick |
| [pipe-echo-server](https://github.com/libuv/libuv/blob/v1.x/docs/code/pipe-echo-server/main.c) | o | |
| [multi-echo-server](https://github.com/libuv/libuv/blob/v1.x/docs/code/multi-echo-server/main.c) | o | |
### [Advanced event loops](https://docs.libuv.org/en/v1.x/guide/eventloops.html)
| name | c-win32 | zig |
| -------------------------------------------------------------------------- | ------- | --- |
| [uvstop](https://github.com/libuv/libuv/blob/v1.x/docs/code/uvstop/main.c) | o | x |
### [Utilities](https://docs.libuv.org/en/v1.x/guide/utilities.html)
| name | c-win32 | zig |
| ---------------------------------------------------------------------------------------- | ---------- | ------------------ |
| [ ref-timer ](https://github.com/libuv/libuv/blob/v1.x/docs/code/ref-timer/main.c) | o | |
| [ idle-compute ](https://github.com/libuv/libuv/blob/v1.x/docs/code/idle-compute/main.c) | o | |
| [ uvwget ](https://github.com/libuv/libuv/blob/v1.x/docs/code/uvwget/main.c) | `<curl.h>` | |
| [ plugin ](https://github.com/libuv/libuv/blob/v1.x/docs/code/plugin/main.c) | o | and plugin/hello.c |
| [ tty ](https://github.com/libuv/libuv/blob/v1.x/docs/code/tty/main.c) | o | |
| [ tty-gravity ](https://github.com/libuv/libuv/blob/v1.x/docs/code/tty-gravity/main.c) | o | o translated |
|
https://avatars.githubusercontent.com/u/164466470?v=4 | zig-demo-webserver | scottredig/zig-demo-webserver | 2025-03-12T22:44:55Z | a webserver which hosts a zig build path | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/scottredig/zig-demo-webserver/tags | MIT | [
"zig",
"zig-package"
] | 7 | false | 2025-03-12T23:02:20Z | true | true | # zig-demo-webserver
A webserver which hosts the install directory (where the contents of running `zig build` goes) of a zig project.
See the example folder's build.zig for usage. Intentionally made without bells and wistles, focused on serving the result of a zig build as simply as possible.
|
https://avatars.githubusercontent.com/u/20910059?v=4 | zig_decimal | AS400JPLPC/zig_decimal | 2025-03-01T14:29:42Z | decimal 34 digit ex dcml(8,2) processing decimal numbers | master | 0 | 0 | 0 | 0 | https://api.github.com/repos/AS400JPLPC/zig_decimal/tags | MIT | [
"decimals",
"zig"
] | 6,490 | false | 2025-03-13T11:18:10Z | false | false | # ZIG_REGEX
PCRE2-POSIX
Using "regex" from the new PCRE2-Posix standard<br>
https://github.com/mnemnion/mvzr new regex form ZIG
example:<br>
Pay attention to the flag that is incumbent on you.<br>
/i ignore case<br>
/g global <br>
/m multiline <br>
```
const std = @import("std");
// tools regex
const reg = @import("match");
const allocatorPrint = std.heap.page_allocator;
pub fn main() !void {
const stdin = std.io.getStdIn().reader();
var buf : [3]u8 = undefined;
buf = [_]u8{0} ** 3;
std.debug.print("Macth abc {} \r\n",.{reg.isMatch("p1","^[A-Z]{1,1}[a-zA-Z0-9]{0,}$/g")}) ;
std.debug.print("Macth abc {} \r\n",.{reg.isMatch("p1","^[a-zA-Z]{1,1}[a-zA-Z0-9]{0,}$")}) ;
std.debug.print("Macth digit {} \r\n",.{reg.isMatch(
"423",
"^[1-9]{1,1}?[0-9]{0,}$")}) ;
std.debug.print("Macth tel fr{} \r\n",.{reg.isMatch(
"+(33)6.12.34.56.78",
"^[+]{1,1}[(]{0,1}[0-9]{1,3}[)]([0-9]{1,3}){1,1}([-. ]?[0-9]{2,3}){2,4}$")}) ;
std.debug.print("Macth tel us{} \r\n",.{reg.isMatch(
"+(001)456.123.789",
"^[+]{1,1}[(]([0-9]{3,3})[)]([-. ]?[0-9]{3}){2,4}$")}) ;
std.debug.print("Macth date fr{} \r\n",.{reg.isMatch(
"12/10/1951",
"^(0[1-9]|[12][0-9]|3[01])[\\/](0[1-9]|1[012])[\\/][0-9]{4,4}$")});
std.debug.print("Macth date us{} \r\n",.{reg.isMatch(
"10/12/1951",
"^(0[1-9]|1[012])[\\/](0[1-9]|[12][0-9]|3[01])[\\/][0-9]{4,4}$")});
std.debug.print("Macth date iso{} \r\n",.{reg.isMatch(
"2003-02-25",
"^([0-9]{4,4})[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$")});
// https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression
// chapitre RFC 6532 updates 5322 to allow and include full, clean UTF-8.
std.debug.print("Macth Mail{} \r\n",.{reg.isMatch(
"[email protected]",
"^([-!#-\'*+\\/-9=?A-Z^-~]{1,64}(\\.[-!#-\'*+\\/-9=?A-Z^-~]{1,64})*|\"([]!#-[^-~ \t]|(\\[\t -~]))+\")@[0-9A-Za-z]([0-9A-Za-z-]{0,61}[0-9A-Za-z])?(\\.[0-9A-Za-z]([0-9A-Za-z-]{0,61}[0-9A-Za-z])?)+$")});
//oreilly
std.debug.print("Macth Mail{} \r\n",.{reg.isMatch(
"[email protected]",
"^[A-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[A-Z0-9.-]+$")});
var width :usize = 5;
// unsigned digit
std.debug.print("Macth digit unsigned{} \r\n",.{reg.isMatch(
"123",
std.fmt.allocPrint(allocatorPrint,"^[0-9]{s}{d}{s}$",.{"{1,",width,"}"},) catch unreachable)});
// unsigned digit
std.debug.print("Macth digit {} \r\n",.{reg.isMatch(
"+12345",
std.fmt.allocPrint(allocatorPrint,"^[+-][0-9]{s}{d}{s}$",.{"{1,",width,"}"},) catch unreachable)});
// decimal unsigned scal = 0
std.debug.print("Macth decimal unsigned scal = 0 {} \r\n",.{reg.isMatch(
"12345",
std.fmt.allocPrint(allocatorPrint,"^[0-9]{s}1,{d}{s}$",.{"{",width,"}"},) catch unreachable)});
var scal :usize = 2;
// decimal unsigned scal > 0
std.debug.print("Macth decimal unsigned scal > 0 {} \r\n",.{reg.isMatch(
"12345.02",
std.fmt.allocPrint(allocatorPrint,
"^[0-9]{s}1,{d}{s}[.][0-9]{s}{d}{s}$",.{"{",width,"}","{",scal,"}"}
) catch unreachable)});
_= try stdin.readUntilDelimiterOrEof(buf[0..], '\n');
// decimal signed scal = 0
std.debug.print("Macth decimal signed scal = 0 {} \r\n",.{reg.isMatch(
"+12345",
std.fmt.allocPrint(allocatorPrint,"^[+-][0-9]{s}1,{d}{s}$",.{"{",width,"}"},) catch unreachable)});
// decimal unsigned scal > 0
std.debug.print("Macth decimal signed scal > 0 {} \r\n",.{reg.isMatch(
"+12345.02",
std.fmt.allocPrint(allocatorPrint,
"^[+-][0-9]{s}1,{d}{s}[.][0-9]{s}{d}{s}$",.{"{",width,"}","{",scal,"}"}
) catch unreachable)});
var i: usize = 0 ;
while(i < 5000) : ( i += 1 ) {
_=reg.isMatch(
"1951-10-12",
"^([0-9]{4,4})[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$");
}
buf = [_]u8{0} ** 3;
_= try stdin.readUntilDelimiterOrEof(buf[0..], '\n');
}
```
<BR />
* •upgrade 2024-03-23.<BR />
* •upgrade 2024-06-29.<BR />
← zig version 0.13.0<BR />
* •upgrade 2024-07-01.<BR />
← Test Fluent and PCRE "C" Zregex<BR />
* •upgrade 2024-07-22.<BR />
← Test MVZR and PCRE "C" Zregex<BR />
* •upgrade 2025-03-12.<BR />
← zig version 0.14.0<BR />
* •upgrade 2025-03-13.<BR />
← update normalise and edit-code<BR /> |
https://avatars.githubusercontent.com/u/11492844?v=4 | farbe | fjebaker/farbe | 2024-01-23T21:33:23Z | More Zig (ANSI) colours for the terminal. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/fjebaker/farbe/tags | MIT | [
"ansi",
"cli",
"color",
"rainbow",
"terminal",
"zig"
] | 24 | false | 2025-03-16T15:00:35Z | true | true | # Farbe
Colour for the _terminal_ user.
## References
This project draws enormous inspiration from [tr1ckydev/chameleon](https://github.com/tr1ckydev/chameleon).
|
https://avatars.githubusercontent.com/u/24283234?v=4 | platformer | h2cone/platformer | 2025-03-02T07:11:38Z | 2D platformer. | main | 0 | 0 | 0 | 0 | https://api.github.com/repos/h2cone/platformer/tags | Apache-2.0 | [
"gamedv",
"platformer",
"raylib",
"zig"
] | 14,366 | false | 2025-03-22T13:50:10Z | true | true | # platformer

|
End of preview. Expand
in Data Studio
This was created by converting database of Zigistry to a dataset.
You can check the source code here: https://github.com/Zigistry/Zigistry_complete_dataset/blob/main/Zigistry_complete_dataset.ipynb
dataset_info: features: - name: server dtype: int64 - name: name dtype: string - name: full_name dtype: string - name: description dtype: string - name: watchers_count dtype: int64 - name: forks_count dtype: int64 - name: license dtype: string - name: default_branch dtype: string - name: has_build_zig dtype: int64 - name: has_build_zig_zon dtype: int64 - name: fork dtype: bool - name: open_issues dtype: int64 - name: stargazers_count dtype: int64 - name: tags_url dtype: string - name: updated_at dtype: string - name: created_at dtype: string - name: size dtype: int64 - name: topics sequence: string - name: avatar_url dtype: string splits: - name: train num_bytes: 1328725 num_examples: 3414 download_size: 520172 dataset_size: 1328725 configs: - config_name: default data_files: - split: train path: data/train-*
- Downloads last month
- 87