avatar_url
stringlengths
47
116
name
stringlengths
1
46
full_name
stringlengths
7
60
created_at
stringdate
2016-04-01 08:17:56
2025-05-20 11:38:17
description
stringlengths
0
387
default_branch
stringclasses
44 values
open_issues
int64
0
4.93k
stargazers_count
int64
0
78.2k
forks_count
int64
0
3.09k
watchers_count
int64
0
78.2k
tags_url
stringlengths
0
94
license
stringclasses
27 values
topics
listlengths
1
20
size
int64
0
4.82M
fork
bool
2 classes
updated_at
stringdate
2018-11-13 14:41:18
2025-05-22 08:23:54
has_build_zig
bool
2 classes
has_build_zig_zon
bool
2 classes
zig_minimum_version
stringclasses
50 values
repo_from
stringclasses
3 values
dependencies
listlengths
0
38
readme_content
stringlengths
0
437k
dependents
listlengths
0
21
https://avatars.githubusercontent.com/u/200686?v=4
DrSbaitsoUi
deckarep/DrSbaitsoUi
2024-11-24T23:40:31Z
A front-end for Dr. Sbaitso done in Zig and Raylib.
main
1
5
0
5
https://api.github.com/repos/deckarep/DrSbaitsoUi/tags
MIT
[ "ai", "chatbot", "drsbaitso", "raylib", "soundblaster", "speech-synthesizer", "speechsynthesis", "text-to-speech", "zig", "ziglang" ]
3,071
false
2025-05-19T03:34:24Z
true
true
0.11.0
github
[]
Dr. Sbaitso: Reborn <strong>Welcome to 2024 Dr. Sbaitso. We've been waiting for you.</strong> An unofficial, fan-made modern recreation for retro-computing enthusiasts. HELLO <code>&lt;YOUR NAME HERE&gt;</code>, MY NAME IS DOCTOR SBAITSO. I AM HERE TO HELP YOU. SAY WHATEVER IS IN YOUR MIND FREELY, OUR CONVERSATION WILL BE KEPT IN STRICT CONFIDENCE. MEMORY CONTENTS WILL BE WIPED OFF AFTER YOU LEAVE, SO, TELL ME ABOUT YOUR PROBLEMS. A front-end for Dr. Sbaitso created in <code>Zig</code> and <code>Raylib 5.5</code>: For modern Desktops as a standalone application. For historical context on what Dr. Sbaitso is <a>read the wikipedia article</a>. This will not run without the backend-system which I have not made public yet as it needs more work. This version of Dr. Sbaitso is intended to build just enough of this version that it is nearly indistinguishable from the original however it will never be an exact clone. Additionally, I will eventually build a plugin system for swapping out the voice synthesis with other systems. And furthermore a plugin system for having a true AI powered backend (such as ChatGPT) to control the good Dr.'s mind. While I don't antcipate this project to be terribly complex it should offer a good example of how to use true native OS threading in a GUI-based application such as Raylib. All cross-thread communication happens via the use of thread-safe queues. Anything that potentially blocks the Raylib event loop will occur in an auxillary thread. Additionally, should an auxillary thread need to communicate back to the main Raylib thread there is a "main thread" dispatcher to handle this. Current Features <ol> <li>The Dr.'s <strong>original</strong> voice</li> <li>A native app: No DosBox, DosBox-X, DosBox-Staging, FreeDOS, VirtualBox or x86-Box required!</li> <li>Faithful recreation of the Dr.'s Turbo C DOS environment</li> <li>All of the Dr's original text-to-speech responses</li> <li>Ability to change background color, font, forground color</li> <li>More to come...</li> </ol> How it works <ol> <li>When running in default mode, the game loads up a <code>.json</code> definition file of responses</li> <li>These responses were harvested from the original's binary and should be nearly accurate.</li> <li>Like the original, the app announces the <code>Creative Labs</code> banner, asks for the user's name and greets the user with the canonical introduction.</li> <li>At this point, the user can type any questions or statements to kick off the conversation.</li> <li>Upon submitting a statement or question, the app will attempt to match the user's input with an appropriate response. Responses are not random but round-robin like the original. This simple idea mitigates the end-user from having to hear too many repeated responses.</li> <li>If the user repeats what they typed in, a special response category is used taunting the user about saying the same thing twice. There are actually two categories for this.</li> <li>If the user enters garbage like: <code>@als398$#$#%</code>, a response category for garbage input is used. Detecting garbage is not as straightforward as you would think, so this isn't done yet.</li> <li>If the user curses; (bad words), the app will chastise the user or potentially go into <code>parity</code> error mode like the original Dr. Sbaitso app did. Parity mode is what happens when the Dr. refuses to process your disgusting filth!</li> <li>If still no response is found, a category of <em>generic</em> fallback responses will be used to move the conversation forward and encourage dialog between the user and the good Doctor.</li> <li>Finally, when a valid response is selected the app will dispatch the text to the speech-synthesis engine in a dedicated thread where it will immediately be heard by the end user's audio output and the matching text rendered to the screen.</li> </ol> Enhancements <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Modernized, newer canned responses to make Dr. Sbaitso aware of current times. He will know about new things like: Tik-Tok, Harry Styles and Texting. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Ability to change background color, font color, font style <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Ability to enable/disable CRT shader, or enable/disable CRT monitor border <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Ability to compute the <code>md5</code> or <code>sha1</code> hash of whatever you type in using the <code>.md5</code> or <code>.sha1</code> commands. <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Ability say anything using the <code>.say</code> command. <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Ability say something in reverse using the <code>.rev</code> command. <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Ability to read any file word for word using the <code>.read</code> command. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Ability to swap speech-synthesis backends <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Ability to adjust prosody and or tone, volume, pitch, speed of speech engine <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Ability to plugin in an AI brain like ChatGPT, or other systems <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Various easter-eggs, retro-computing references, etc <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> The Dr. may become impatient if you don't say anything after awhile. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Ask him to tell you a joke! Credits <ul> <li><a>CRT Monitor Graphic - by Halfingr</a></li> </ul> Observations <ol> <li>If he asks for an age: "ARE YOU SERIOUS? HOW OLD ARE YOU?", any user repsponse will be followed up with something like: "WAIT A FEW MORE YEARS, KID" even you type a non integer response. If you type an age: 77 you'll get "I PREFER SOMEONE YOUNGER".</li> <li>In the strings dump of sbaitso.exe some responses are pre-quoted like: "`2TOO LITTLE DATA, SO I MAKE BIG" this causes them to follow up with something special like:</li> <li>1 =&gt; Give user ability to ontinue ew patient uit ....</li> <li>2 =&gt; Adjust screen to 40 characters per line instead of the normal 80</li> <li>3 =&gt; Change the color</li> <li>4 =&gt; Do an age challenge</li> <li>Parity is not included in this list, but that's the only other easter egg.</li> </ol> Building <ul> <li>Currently requires zig <code>0.14.0</code></li> <li>Using regular zig: <code>zig build run</code></li> <li>Using zigup: <code>zigup run 0.14.0 build run</code></li> </ul> Big fat caveat <ul> <li>I have not released the speech engine...so this repo, as-is won't quite work!</li> </ul>
[]
https://avatars.githubusercontent.com/u/26812563?v=4
shamir-zig
aidanaden/shamir-zig
2024-08-24T21:37:41Z
secret sharing (shamir, feldman, pedersen) in zig
main
0
5
0
5
https://api.github.com/repos/aidanaden/shamir-zig/tags
Apache-2.0
[ "shamir-secret-sharing", "zig" ]
88
false
2025-03-12T20:09:56Z
true
true
0.14.0
github
[ { "commit": "71490491b8f1b0741218160b88cf0a87d2a941ce", "name": "yazap", "tar_url": "https://github.com/prajwalch/yazap/archive/71490491b8f1b0741218160b88cf0a87d2a941ce.tar.gz", "type": "remote", "url": "https://github.com/prajwalch/yazap" } ]
shamir-secret-sharing Simple zig implementation of <a>Shamir's Secret Sharing algorithm</a>. 2 implementations exist: <ol> <li> Uses GF(2^8). Implementation inspired by <a>privy-io/shamir-secret-sharing</a> and <a>hashicorp/vault</a>. </li> <li> Uses Ristretto255. Implementation inspired by <a>coinbase/kryptology</a> </li> </ol> Includes a CLI app for independent use of shamir secret sharing. Security considerations <ol> <li>Although the reference implementations have been audited, this implementation was NOT audited and was written for FUN. DO NOT USE THIS IN PRODUCTION.</li> <li>This library is not responsible for verifying the result of share reconstruction. Incorrect or corrupted shares will produce an incorrect value. Thus, it is the responsibility of users of this library to verify the integrity of the reconstructed secret.</li> <li>Secrets should ideally be uniformly distributed at random. If this is not the case, it is recommended to first encrypt the value and split the encryption key.</li> </ol> Importing <ol> <li>Run the following command:</li> </ol> <code>zig fetch --save git+https://github.com/aidanaden/shamir-zig</code> <ol> <li>Add the following to <code>build.zig</code>:</li> </ol> <code>zig const shamir = b.dependency("shamir-zig", .{}); exe.root_module.addImport("shamir", shamir.module("shamir"));</code> Installation Nix <code>sh nix run github:aidanaden/shamir-zig</code> Brew <code>sh brew install aidanaden/tools/shamir</code> Usage We can <code>generate</code> shares from a given secret and later <code>reconstruct</code> the secret from the minimum number of shares (as configured when running <code>generate</code>). Note: for algorithms using Ed25519, the secret is hashed via Sha512 and reduced into a value (32-bytes) within the Ed25519 curve. Reduction is required since the secret can only be reconstructed as a value within the Ed25519 curve. CLI Shamir GF256 ```sh ./zig-out/bin/shamir generate --threshold 4 --total 10 --secret mynamejeff --- output --- secret (hex): 6D796E616D656A656666 shares (4/10 required): C55F6C84575C6B4BB0B639 F464701E29B79D09483736 34345F1C0918C6DC1A593D 3185D736294DAC48D85F8C E392144022D14FCB9DF202 A87636B60C88A103561E29 9E1C2F10E1AFAE3E7732BC DF3C164FFD60A0B4DB3A91 253DC1AFC299E1D63AAFD2 AF08A0E9F9362F13775FFA ``` ```sh ./zig-out/bin/shamir reconstruct -s=34345F1C0918C6DC1A593D,253DC1AFC299E1D63AAFD2,AF08A0E9F9362F13775FFA,C55F6C84575C6B4BB0B639 --- output --- secret (hex): 6D796E616D656A656666 secret (text): mynamejeff ``` Shamir Ed25519 via Ristretto255 ```sh ./zig-out/bin/shamir generate --threshold 4 --total 10 --secret mynamejeff -m s25519 --- output --- secret (hashed): 6D33F29E352F4A76FB61C06E6AC84163760FE73CBDEEA718B366DB62EB0EAAA9 secret (hashed + reduced): 2BEC57FD2D5092059C411411B8058C92750FE73CBDEEA718B366DB62EB0EAA09 shares (4/10 required): 13EA9709CC727E0CA9318D88952857DC09C4623D4BECFA80BB4A11BC3590D90F95A112BB916F7310A1096D8BBFD8F2CE8510DB466591B5C30F5D7C6709BD0C0B A2B0D0804BC85A78FB823D5F0EAC6D1BEE33B571B8B6CFD092256D335527DE052420E113ECA01ED66548E3B3C7DE9E63CF1B577198F2FE1359F36510C372830C 98EAF99A5C2C9DF845C1B60B6BCC98BED71C32D0DD234124F5589ECD705E74010BF0DDB5ABA27E4BBF9244700A382CC37E74B289A8A18A1E5F028635C664730A 7478BA4DCF425D2CB1192F91857A47FA82F5C984547BCC0ABD4DB4477232D408F1FD38D7549982CDF097AA20C8C132B5BB4867030D409F2F8655147B64C4880F 62E6140919560400B327F7D82FE5079CF797A8B4E6330D84C17DF8FCB16DB50B2FACA3B4EFC36A037FDF5779DB6EC4CB403415FD6EE6CB4A6BA4912634595C04 7B5285D171303E01B72F4072A3442196B5106E755A8EAF23ECB1CB5DED882D0927FA83D9626D8397C0F2579857E1456641B9307ABA500D9DF0BEF5A03DBBE402 33923A08169BE52AA63056AC910EDE2D4D009B3BACA107708E8EFD63960DBF011CD27EE4CFBA5AD8AF321B0D210A57DD8A8ED40CFC3100316D791BAA72B28F03 0FD89DF188499DE2E2C4EA7106F82088B44A02BCEAF1685C2C44443079ED4C0EB450E6CD606CD07B07B9115B1C3183B6DC1BAA8AEC63C5F22F07B4121600D707 4E28FAD8EA66FEA1F35BA08C42CEED3B63A8ED732BF6086110142BBDC449EC0BD2B6EB9E56EC92BE4685D1877B6761EEB90F773A0B29A0C062C4053292C6680C 19F93B27B20FAE7F7597A70F6623BB6692499CC24A79BF6D8200C38159DB6E08C613014DBCF76E931B80413BB36B8D44324D948CF8A8747B70D49D9585A49803 ``` ```sh ./zig-out/bin/shamir reconstruct -m s25519 -s=13EA9709CC727E0CA9318D88952857DC09C4623D4BECFA80BB4A11BC3590D90F95A112BB916F7310A1096D8BBFD8F2CE8510DB466591B5C30F5D7C6709BD0C0B,7478BA4DCF425D2CB1192F91857A47FA82F5C984547BCC0ABD4DB4477232D408F1FD38D7549982CDF097AA20C8C132B5BB4867030D409F2F8655147B64C4880F,33923A08169BE52AA63056AC910EDE2D4D009B3BACA107708E8EFD63960DBF011CD27EE4CFBA5AD8AF321B0D210A57DD8A8ED40CFC3100316D791BAA72B28F03,4E28FAD8EA66FEA1F35BA08C42CEED3B63A8ED732BF6086110142BBDC449EC0BD2B6EB9E56EC92BE4685D1877B6761EEB90F773A0B29A0C062C4053292C6680C --- output --- secret: 2BEC57FD2D5092059C411411B8058C92750FE73CBDEEA718B366DB62EB0EAA09 ``` Feldman Ed25519 via Ristretto255 ```sh ./zig-out/bin/shamir generate --threshold 4 --total 10 --secret mynamejeff -m f25519 --- output --- secret (hashed): 6D33F29E352F4A76FB61C06E6AC84163760FE73CBDEEA718B366DB62EB0EAAA9 secret (hashed + reduced): 2BEC57FD2D5092059C411411B8058C92750FE73CBDEEA718B366DB62EB0EAA09 shares (4/10 required): 49814F39B575396032A86C3F6EF9F0EBDBC0A88FEC19CAB98A36414097399B0803B3667FAB8A806FFC4B99438D7E11B329E29C3AC62E4917A96EBAD33C4EAB01 049667BC415BCABB0619AC12A08B9303331A8A3217B51BFE17EFD30677D16B06790F10EDC8B5E124B1F1CA7BF80C29A7F7AEFE8B77B5E02E669BAAABDDC24605 92CD16899DC5FB48314E7512881714B280CEC260E01C43DC9318105DC6E6EB0E507EB0C564C26C724229D68A894F870DC5116F50E68D9B784DBC9A3302F4BD07 EB6BE224F74F1906383AC8BBD4E182FD459A29EF3EEC1AE606A40877E12704069139983309B233A300F7269BF23822E4FF89BF97E62DFFC908C31BD5F4286205 ED8F45DDC5B003B56ED684BD38FE7D577AF752EFA17389016073058487C9D8089EA3F6D862F58221F323749C2473C8C4C98A01B7CDB8110FD08CDB6986B44F0F F7E224EA86853ACB60A68ECA39862C2D69F23620358E144213E6DBB18CA439087E5387849AE26580445838F9A3459B27AE732EA095F7E6D1A8FDB2C84631600B 477E6A586D37E1BE6F7CE83EA87AABF850F909E2B28446659311BF07DBE9C705790F15B3E7F5EFDB3D0130CD733B02EEE19A8CC76DE1A9720914B95F87237F0F 5A8C11E5983CB5C91D259CA58EB1827705E83350754BABFA8D0AE7F1B3FC0303808D134C8B66D150FBA1AD081F7D7146BFCF507BDEF4FFA2C774AF229793090B 0802CE0B329158BCF5DB3258AB2D25D8CC9637DAA8B9C9E262BEA98556262204CD3BE0D6116E6E9E6EF2644DDE787FC08A81B9440250FB50BB9B2AEFFDAF1801 6B3F0CCA128D3315B8D298006E3EDCF9A08DDD3525DA04258DCD20EACD85940FDCAFB5619158459A036EF258327FB1CFC7A3F0E33C5926AA0D9839802D60C609 commitments: 6619F19D0BB5D506EB91979E1DC11F4754FFB35CAC987486F8128A36FB67240A 680D5DFF0FD0D5AD95EF878E9D5427BCFFD4A38BAD5448768CCCFB3B28F5F902 B4B1E9FFE8E15C4D786A40792E9A82F7748841CBEC64D55B50BDCB249BC5CC70 D2E9B85F819DE590B4362B4C8D5462C95EF2DA32CD28D8430CAFAB45FA17E820 ``` ```sh ./zig-out/bin/shamir verify -m f25519 -s 49814F39B575396032A86C3F6EF9F0EBDBC0A88FEC19CAB98A36414097399B0803B3667FAB8A806FFC4B99438D7E11B329E29C3AC62E4917A96EBAD33C4EAB01 -c=6619F19D0BB5D506EB91979E1DC11F4754FFB35CAC987486F8128A36FB67240A,680D5DFF0FD0D5AD95EF878E9D5427BCFFD4A38BAD5448768CCCFB3B28F5F902,B4B1E9FFE8E15C4D786A40792E9A82F7748841CBEC64D55B50BDCB249BC5CC70,D2E9B85F819DE590B4362B4C8D5462C95EF2DA32CD28D8430CAFAB45FA17E820 --- output --- share validity: true ``` ```sh ./zig-out/bin/shamir reconstruct -m f25519 -s=049667BC415BCABB0619AC12A08B9303331A8A3217B51BFE17EFD30677D16B06790F10EDC8B5E124B1F1CA7BF80C29A7F7AEFE8B77B5E02E669BAAABDDC24605,477E6A586D37E1BE6F7CE83EA87AABF850F909E2B28446659311BF07DBE9C705790F15B3E7F5EFDB3D0130CD733B02EEE19A8CC76DE1A9720914B95F87237F0F,6B3F0CCA128D3315B8D298006E3EDCF9A08DDD3525DA04258DCD20EACD85940FDCAFB5619158459A036EF258327FB1CFC7A3F0E33C5926AA0D9839802D60C609,49814F39B575396032A86C3F6EF9F0EBDBC0A88FEC19CAB98A36414097399B0803B3667FAB8A806FFC4B99438D7E11B329E29C3AC62E4917A96EBAD33C4EAB01 --- output --- secret: 2BEC57FD2D5092059C411411B8058C92750FE73CBDEEA718B366DB62EB0EAA09 ``` Pedersen Ed25519 via Ristretto255 ```sh ./zig-out/bin/shamir generate --threshold 4 --total 10 --secret mynamejeff -m p25519 --- output --- secret (hashed): 6D33F29E352F4A76FB61C06E6AC84163760FE73CBDEEA718B366DB62EB0EAAA9 secret (hashed + reduced): 2BEC57FD2D5092059C411411B8058C92750FE73CBDEEA718B366DB62EB0EAA09 shares (4/10 required): 4F68C05ABAF05C8719A63DD4FB956A89535F62A483600B77BF2A6AF23DB84304A342502F83161846C1C0BC27ACF77643B325452BB0227663785C673C35ABED0F2C84B12AA73F387B0A51145A32F97B31E45EDC0168AB4F8D1458A1D58E96C105 CC49BF6CD19DF7F99BB1D0DF8BBE71D299521C743F2DB0A8C553E8AB7B3E83006EB2B8A2F5996EF40C63040E36AB28ED768A69CDFAFFDC3E18BDF77E25E740036BDA64257A15DB50F03ECE29024292EA261AAFF2B488A2FBC98D0F9C921E7603 A4871FCCC96F25AA189442680993A92FBCD5712EE19C57196A0C25910F7E3C03D94313D9201A8156AB1666E2AF15740F59E7DCF63B5AEBFFCEDE47BE3D77E205C05CA67302B95F14D03FBA9EBA2137EA4543ADA629F351A7E668B81936286302 9375125C44F6BC9D0394D0399E054D8BE5AD969730F0161D30A7EBB96FCECD0CD1D6A39F502B16FA2919B28C12F2C589621D1F0832D1791DC212163CEB7A5C08AE2B065035382A231F6D157F26335AA625487632B5BED2E608F384FA8CAD9305 F8628F8C5202B305A8D34074F12409360A859510C22F63D7460CC7804D32930DC22B9F7CDE3E8B19DC5E04B3F1B36EE4C267C58AEC34CE6E6FB3DB00874E510A30139F19FD461DBBF6FE12DF04D4C67192FD9F2AD6C469C95F39A55FEB97C009 F80E4B88E300320D8125E04F77FD13C604E3FF6AD7EFABE81D562FC3B8ABAA0A445346214009220C3172C52FA30DDE43D8D72451F8035160B6E40E464EAD850D45406A2C7924E0AFF59DEB3456BC6CB29DCC0F3BC8F265E5FC983C3CB55F3B0D 979A90B0016233C68869A0669DDA77F54A8CBD9CB3832418B73EAFA92519C203862E17117099F859DAC70396F882D74F3E61F9AC10A678B0D79CD7F08F5EB607F5AD016F9E3F9CFF189E88BB3D3038BF1EFD70CA057FD382C7C5BE9E0FF93306 2AC74EEFD7FEE98583E2123689A0A7324682C39D68B31C94ED7798476E367E0FB3074A938D628FC8B0F77E72DD98F143210793F942B4E67764AA36481ACFCC034626C13127D7373C6850B4BEA29D91E25423ECF54D24373223D94710B71EB700 AB39FCE99366998F671E8C39913AF1DBE39FB012973BDFBF8F5A3D297786110C730F4A3A777363016B558439BE94B443814E70F54885F24F899185112704E40F941F85A9B401FBD5260A00173C5380CF2640226A319B3EEF3C4E8BD3B060E60F 37F7F7A9D1A655A3F74AFF1A45CDA380A17E3714E86A994F23516341B898A10E3BCB35FE3CC68C114900E73377618BDC19E010E1AC609766667ED3E181660502CC3555C53BD31DDD3F2A3378B7D7B62A81641A1235F80C57CD1943D7C2390D08 commitments: BE62A4FDA40E9EE9BDBB7FFF5CC309AB1C3BA96B25DF151566CBF21028E3A952 305355D39AE9C1D3048153FC9B46E9D0264B67F18B49F7C47F9D393BF3E67842 A2D0682D0FB13B0315337C38FB3B6583C7249DCE705A764D2C3B606DBC955D32 0CEF43C0C3A7786FA8F3F918DE1BFFA67679003CAC4254E1DA3DCF11DE3A9E2E ``` ```sh ./zig-out/bin/shamir verify -m p25519 -s CC49BF6CD19DF7F99BB1D0DF8BBE71D299521C743F2DB0A8C553E8AB7B3E83006EB2B8A2F5996EF40C63040E36AB28ED768A69CDFAFFDC3E18BDF77E25E740036BDA64257A15DB50F03ECE29024292EA261AAFF2B488A2FBC98D0F9C921E7603 -c=BE62A4FDA40E9EE9BDBB7FFF5CC309AB1C3BA96B25DF151566CBF21028E3A952,305355D39AE9C1D3048153FC9B46E9D0264B67F18B49F7C47F9D393BF3E67842,A2D0682D0FB13B0315337C38FB3B6583C7249DCE705A764D2C3B606DBC955D32,0CEF43C0C3A7786FA8F3F918DE1BFFA67679003CAC4254E1DA3DCF11DE3A9E2E -- output --- share validity: true ``` ```sh ./zig-out/bin/shamir reconstruct -m f25519 -s=049667BC415BCABB0619AC12A08B9303331A8A3217B51BFE17EFD30677D16B06790F10EDC8B5E124B1F1CA7BF80C29A7F7AEFE8B77B5E02E669BAAABDDC24605,477E6A586D37E1BE6F7CE83EA87AABF850F909E2B28446659311BF07DBE9C705790F15B3E7F5EFDB3D0130CD733B02EEE19A8CC76DE1A9720914B95F87237F0F,6B3F0CCA128D3315B8D298006E3EDCF9A08DDD3525DA04258DCD20EACD85940FDCAFB5619158459A036EF258327FB1CFC7A3F0E33C5926AA0D9839802D60C609,49814F39B575396032A86C3F6EF9F0EBDBC0A88FEC19CAB98A36414097399B0803B3667FAB8A806FFC4B99438D7E11B329E29C3AC62E4917A96EBAD33C4EAB01 --- output --- secret: 2BEC57FD2D5092059C411411B8058C92750FE73CBDEEA718B366DB62EB0EAA09 ``` Code example ```zig test "can split secret into multiple shares" { var secret = std.ArrayList(u8).init(std.testing.allocator); defer secret.deinit(); // Hex value of "secret" try secret.appendSlice(&amp;[_]u8{ 0x73, 0x65, 0x63, 0x72, 0x65, 0x74 }); assert(secret.items.len == 6); <code>const shares = try generate(secret, 3, 2, std.testing.allocator); defer { for (shares.items) |s| { s.deinit(); } shares.deinit(); } assert(shares.items.len == 3); const first_share = shares.items[0]; assert(first_share.items.len == secret.items.len + 1); const second_share = shares.items[1]; var thresholds = [2]std.ArrayList(u8){ first_share, second_share }; const reconstructed = try reconstruct(&amp;thresholds, std.testing.allocator); defer reconstructed.deinit(); assert(std.mem.eql(u8, secret.items, reconstructed.items)); std.debug.print("\nreconstructed (integers): ", .{}); try std.json.stringify(&amp;reconstructed.items, .{ .emit_strings_as_arrays = true }, std.io.getStdErr().writer()); std.debug.print("\nreconstructed (string): ", .{}); try std.json.stringify(&amp;reconstructed.items, .{ .emit_strings_as_arrays = false }, std.io.getStdErr().writer()); </code> } ``` See more in the tests at <a>shamir.zig</a>, <a>feldman.zig</a>, <a>pedersen.zig</a> License Apache-2.0. See the <a>license file</a>.
[]
https://avatars.githubusercontent.com/u/72735402?v=4
vkuroko
evanlin96069/vkuroko
2024-08-23T23:28:01Z
Integrating Kuroko with Source
main
0
5
0
5
https://api.github.com/repos/evanlin96069/vkuroko/tags
0BSD
[ "half-life-2", "kuroko", "portal", "source-engine", "zig" ]
604
false
2025-05-21T14:09:17Z
true
false
unknown
github
[]
vkuroko <a></a> A Source Engine plugin that integrates <a>Kuroko</a> (a dialect of Python). More bindings and TAS support are still being developed. Supported Games <ul> <li>Portal (3420)</li> <li>Portal (4104)</li> <li>Portal (5135)</li> <li>Portal (latest)</li> <li>Half-Life 2 (5135)</li> <li>Half-Life 2 (latest) [Load via addons]</li> </ul> Build Only Windows build. Use <a>zig 0.14.0</a> <code>sh zig build</code>
[]
https://avatars.githubusercontent.com/u/124217829?v=4
prettizy
javiorfo/prettizy
2025-01-07T15:03:01Z
Zig library to prettify JSON and XML strings
master
0
5
0
5
https://api.github.com/repos/javiorfo/prettizy/tags
MIT
[ "json", "prettifier", "xml", "zig", "zig-library", "zig-package" ]
14
false
2025-05-13T17:25:21Z
true
true
0.13.0
github
[]
prettizy <em>Zig library to prettify JSON and XML strings</em> Caveats <ul> <li>Required Zig version: <strong>0.13</strong></li> <li>This library has been developed on and for Linux following open source philosophy.</li> </ul> Usage ```zig const std = @import("std"); const prettizy = @import("prettizy"); pub fn main() !void { // Arena Allocator is recommended to avoid internal leaks var gpa = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer gpa.deinit(); const allocator = gpa.allocator(); <code>const json_string = "{\"name\":\"John\",\"age\":30,\"city\":\"New York\",\"hobbies\":[\"reading\",\"traveling\"], \"obj\":{\"field\":[1,2]}}"; const formatted_json = try prettizy.json.prettify(allocator, json_string, .{}); std.debug.print("{s}\n", .{formatted_json}); const xml_input = "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;&lt;library&gt;&lt;name&gt;City Library&lt;/name&gt;&lt;location&gt;&lt;address&gt;&lt;street&gt;Main St&lt;/street&gt;&lt;number&gt;123&lt;/number&gt;&lt;city&gt;Metropolis&lt;/city&gt;&lt;state&gt;NY&lt;/state&gt;&lt;zip&gt;12345&lt;/zip&gt;&lt;/address&gt;&lt;coordinates&gt;&lt;latitude&gt;40.7128&lt;/latitude&gt;&lt;longitude&gt;-74.0060&lt;/longitude&gt;&lt;/coordinates&gt;&lt;/location&gt;&lt;books&gt;&lt;book id=\"b1\"&gt;&lt;title&gt;The Great Gatsby&lt;/title&gt;&lt;author&gt;&lt;firstName&gt;F. Scott&lt;/firstName&gt;&lt;lastName&gt;Fitzgerald&lt;/lastName&gt;&lt;/author&gt;&lt;publicationYear&gt;1925&lt;/publicationYear&gt;&lt;genre&gt;Fiction&lt;/genre&gt;&lt;isbn&gt;9780743273565&lt;/isbn&gt;&lt;availability&gt;&lt;status&gt;available&lt;/status&gt;&lt;copies&gt;5&lt;/copies&gt;&lt;/availability&gt;&lt;/book&gt;&lt;/books&gt;&lt;/library&gt;"; const formatted_xml = try prettizy.xml.prettify(allocator, xml_input, .{ .tab_space = 4 }); std.debug.print("{s}\n", .{formatted_xml}); </code> } ``` Installation In <code>build.zig.zon</code>: <code>zig .dependencies = .{ .prettizy = .{ .url = "https://github.com/javiorfo/prettizy/archive/refs/heads/master.tar.gz", // .hash = "hash suggested", // the hash will be suggested by zig build }, }</code> In <code>build.zig</code>: <code>zig const dep = b.dependency("prettizy", .{ .target = target, .optimize = optimize, }); exe.root_module.addImport("prettizy", dep.module("prettizy"));</code> Donate <ul> <li><strong>Bitcoin</strong> <a>(QR)</a> <code>1GqdJ63RDPE4eJKujHi166FAyigvHu5R7v</code></li> <li><a>Paypal</a></li> </ul>
[]
https://avatars.githubusercontent.com/u/200686?v=4
freegemas
deckarep/freegemas
2024-12-17T04:55:10Z
Freegemas is an open source version of the well known Bejeweled, built in Zig using SDL2 ported from the original C++ version
main
0
4
0
4
https://api.github.com/repos/deckarep/freegemas/tags
GPL-2.0
[ "bejeweled", "casual-game", "clone", "game", "match-3", "port", "sdl", "sdl2", "zig", "ziglang" ]
28,688
true
2024-12-31T20:49:35Z
true
true
unknown
github
[]
<strong>Freegemas</strong> is a GPL2.0 open source version of the well known Bejeweled, for MacOS and ~GNU/Linux, Windows, Playstation Vita~. It's written in <a>Zig 0.13.0</a> using <a>SDL2</a>. This version is a Zig-based port of the <a>original C++ version by Jose Tomas Tocino</a>. Since the original license is an open source copyleft license this repo is required to use the same exact license. <code> </code> Installation on OS X First, head over to <a>ziglang.org</a> and download <em>Zig 0.13.0</em> or newer. This assumes that you are already using <a>Homebrew</a>. You will need a few libraries to compile Freegemas: <code>brew install sdl2 sdl2_mixer sdl2_ttf sdl2_image </code> Now run the following commands to setup your environment to use Homebrew as a backup location for libraries. After that, clone the repo: <code>git clone https://github.com/deckarep/freegemas.git </code> Do an out-of-source compilation and run the program: <code>cd freegemas zig build run ./freegemas </code> Music licensing The music in the game is <a>Easy Lemon by Kevin MacLeod</a> Licensed under <a>Creative Commons: By Attribution 3.0</a>
[]
https://avatars.githubusercontent.com/u/77690906?v=4
zage
KhoaNguyen55/zage
2025-01-27T16:28:44Z
A work in progress age implementation in zig
main
2
4
2
4
https://api.github.com/repos/KhoaNguyen55/zage/tags
MIT
[ "age-encryption", "zig" ]
219
false
2025-03-23T23:57:43Z
true
true
0.13.0
github
[ { "commit": "refs", "name": "clap", "tar_url": "https://github.com/Hejsil/zig-clap/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/Hejsil/zig-clap" } ]
zage: zig implementation of age The format specification is at <a>age-encryption.org/v1</a>. age was designed by <a>@Benjojo</a> and <a>@FiloSottile</a>. Installation Download executable from <a>here</a>. Build from source Clone the repo: <code>git clone https://github.com/KhoaNguyen55/zage.git</code> Use zig build system: <code>zig build -Dbuild-cli --release=safe</code> Usage For complete usage run <code>zage --help</code> Encrypt With passphrase: <code>zage -p -o &lt;output_file&gt; &lt;input_file&gt;</code> With recipient: <code>zage -r age1ylsp6apgw0e9526s5tgaqj70qerc0286hl95quzg2jq5r30ewqxquaxhpp -o &lt;output_file&gt; &lt;input_file&gt;</code> Decrypt With passphrase: <code>zage -d &lt;input_file&gt;</code> With recipient: <code>zage -d -i private_key &lt;input_file&gt;</code> Zig library <a>Documentation</a> The library is for <code>zig v0.14.0</code> for now. To install as a zig library you can run the <code>zig fetch</code> command: <code>zig fetch --save https://github.com/KhoaNguyen55/zage/archive/refs/tags/&lt;tag&gt;.tar.gz</code> Then add the following to <code>build.zig</code>: <code>const age = b.dependency("age", .{ .target = target, .optimize = optimize, }); exe_mod.addImport("age", age.module("age")); // exe_mod.addImport("age_plugin", age.module("age_plugin")); // uncomment if you're developing a plugin</code> Contributes Report bugs at https://github.com/KhoaNguyen55/zage/issues Contributing: TODO
[]
https://avatars.githubusercontent.com/u/77928207?v=4
micrograd.zig
mattzcarey/micrograd.zig
2024-08-27T17:24:34Z
small (and partial) autograd engine inspired from Karpathy's micrograd and PyTorch, written in Zig
main
1
4
0
4
https://api.github.com/repos/mattzcarey/micrograd.zig/tags
-
[ "autograd", "llm", "llvm", "machine-learning", "micrograd", "pytorch", "zig" ]
9
false
2025-02-18T16:19:19Z
true
true
0.13.0
github
[]
ziggrad A very simple autograd like library built in Zig. Inspired by <code>micrograd</code> by Andrej Karpathy and <code>autograd</code>. Usage install zig and run: <code>bash zig build run</code> <code>bash zig build test</code>
[]
https://avatars.githubusercontent.com/u/70143303?v=4
zerogrep
bo1led-owl/zerogrep
2024-08-12T13:01:28Z
Yet another grep, built with Zig
main
0
4
0
4
https://api.github.com/repos/bo1led-owl/zerogrep/tags
GPL-3.0
[ "cli", "grep-like", "zig" ]
248
false
2025-04-05T08:51:20Z
true
true
unknown
github
[]
Zerogrep A <code>grep</code> with custom regex engine written in Zig Usage <code>zg [flags]... PATTERN FILES... </code> or instead of <code>FILES</code> you can redirect <code>zg</code>'s input and it will read from stdin. For more details see <code>zg --help</code> Supported regex features <ul> <li>Grouping (<code>foo(bar)+baz</code>)</li> <li>Repetition (<code>*</code> and <code>+</code>)</li> <li>Optionals (<code>?</code>)</li> <li>Anchors (<code>^</code> and <code>$</code>)</li> <li>Character groups (<code>[a-zA-Z_]</code>, <code>[^0-9a-zA-Z]</code>)</li> </ul>
[]
https://avatars.githubusercontent.com/u/11700503?v=4
ada-zig
braheezy/ada-zig
2024-12-30T05:30:29Z
Zig bindings for Ada URL library.
main
0
4
0
4
https://api.github.com/repos/braheezy/ada-zig/tags
MIT
[ "zig" ]
2,942
false
2025-05-05T05:17:45Z
true
true
0.14.0
github
[ { "commit": "master", "name": "ada", "tar_url": "https://github.com/braheezy/ada/archive/master.tar.gz", "type": "remote", "url": "https://github.com/braheezy/ada" } ]
Ada Zig <a></a> <a>Ada</a> is a fast and spec-compliant URL parser written in C++. Specification for URL parser can be found from the WHATWG website. This project contains Zig language bindings. That means instead of linking the C library directly in your project and interacting with the C API, <code>adazig</code> does it for you, providing a thin wrapper for familiar Zig use. If you want to interact with the C more directly but still consume it using the Zig build system, see the <a>Ziggified build of Ada</a>. Usage First, add to your <code>build.zig.zon</code>: <code>bash zig fetch --save git+https://github.com/braheezy/ada-zig#3.2.4</code> Then update your <code>build.zig</code>: <code>zig const ada_dep = b.dependency("adazig", .{}); exe.root_module.addImport("ada", ada_dep.module("ada"));</code> Finally, in your source code: ```zig const ada = @import("ada"); pub fn main() void { const ada_url = try ada.Url.init("https://ziglang.org/"); <code>std.debug.print(ada_url.getProtocol()); // prints 'https' </code> } ``` Examples The <a>Usage docs</a> from the Ada library are applicable. ```zig const std = @import("std"); const ada = @import("ada"); pub fn main() !void { const input_url = "https://user:pass@127.0.0.1:8080/path?query=1#frag"; <code>const url = try ada.Url.init(input_url); defer url.free(); std.debug.print("url.host type: {any}\n", .{url.getHostType()}); </code> } ``` There's also <a>Zig docs</a> for the package. Development See <code>zig build --list</code>.
[]
https://avatars.githubusercontent.com/u/24697112?v=4
goreleaser-rust-cross
goreleaser/goreleaser-rust-cross
2024-12-02T19:38:30Z
Docker image for cross-compiling Rust projects with GoReleaser.
main
1
4
0
4
https://api.github.com/repos/goreleaser/goreleaser-rust-cross/tags
MIT
[ "cargo", "cargo-xwin", "cargo-zigbuild", "clang-cl", "cross-compilation", "docker", "goreleaser", "lld", "lld-link", "msvc", "msvcrt", "rust", "windows", "xwin", "zig" ]
45
false
2025-05-16T05:18:26Z
false
false
unknown
github
[]
goreleaser-rust-cross <blockquote> 🚀 Help me to become a full-time open-source developer by <a>sponsoring me on GitHub</a> </blockquote> Docker image for cross-compiling Rust projects with GoReleaser. TODO: <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Add chocolatey Installed tools <ul> <li><code>rustup</code>/<code>cargo</code> (stable - 1.84.0) - you can install other toolchains as needed</li> <li><a><code>cargo-zigbuild</code></a> (thanks to <a><strong>@messense</strong></a>)</li> <li><a><code>zig</code></a></li> <li><a><code>cargo-xwin</code></a> (thanks to <a><strong>@messense</strong></a> and <a><strong>@Jake-Shadle</strong></a>)</li> <li>Microsoft CRT headers and libraries</li> <li>Windows SDK headers and libraries</li> <li>MacOSX11.3.sdk</li> </ul> <blockquote> <strong>By using this software you are consented to accept the license at https://go.microsoft.com/fwlink/?LinkId=2086102</strong> <a><strong>Please ensure you have read and understood the Xcode license terms before continuing.</strong></a> </blockquote> Docker Environment variables <ul> <li><a>GoReleaser</a> variables.</li> <li><code>GPG_KEY</code> (optional) - defaults to /secrets/key.gpg. Ignored if file not found.</li> <li><code>DOCKER_CREDS_FILE</code> (optional) - path to JSON file with docker login credentials. Useful when push to multiple docker registries required.</li> <li><code>DOCKER_FAIL_ON_LOGIN_ERROR</code> (optional) - fail on docker login error.</li> </ul> Login to registry Github Actions Use <a>docker login</a> to auth to repos and mount docker config file. For example: <code>shell docker run -v $(HOME)/.docker/config.json:/root/.docker/config.json ...</code> Docker Creds file To login from within <code>goreleaser-rust-cross</code> container, create creds file. <code>json { "registries": [ { "user": "&lt;username&gt;", "pass": "&lt;password&gt;", "registry": "&lt;registry-url&gt;" // for e.g. ghcr.io } ] }</code> License This work is released under the MIT license. A copy of the license is provided in the <a>LICENSE</a> file.
[]
https://avatars.githubusercontent.com/u/322030?v=4
pakboy
edubart/pakboy
2024-08-11T19:25:05Z
PacMan demake for RIVES in Zig programming language.
main
0
4
0
4
https://api.github.com/repos/edubart/pakboy/tags
MIT
[ "demake", "game", "pacman", "riv", "rives", "zig" ]
679
true
2024-09-12T20:12:37Z
false
false
unknown
github
[]
PakBoy PacMan demake for <a>RIVES</a>. You can play in your browser at its <a>emulator page</a>. Code originally based on https://github.com/floooh/pacman.zig. Build and Run Make sure you have <a>Zig</a> and <a>RIV SDK</a> installed first, then: <code>bash make rivemu pakboy.sqfs</code> Notes The original pacman.zig project used original PacMan ROM assets, which were all removed. The color palette, graphics and sounds were all replaced by some assets crafted with GIMP, while the game logic was untouched. The sound waveforms were all replaced to use RIV standard waveforms. Overall the colors, sprites and sounds are all different. Zig usage I originally went through this project to learn more about Zig, turns out using Zig to make games for RIV emulator is straightforward. We can even cross compile which makes compiling very fast. All the C API is easy to use through <code>@cImport</code> Zig statement. To compile just need to copy <code>riv.h</code> and <code>libriv.so</code> from RIV SDK to the local directory, which the <code>Makefile</code> does automatically. Search for <code>riv</code> in <code>pakman.zig</code> to grasp how it looks like to use the RIV APIs with Zig.
[]
https://avatars.githubusercontent.com/u/21108320?v=4
zig-ring-buffer
SarthakMakhija/zig-ring-buffer
2024-10-04T15:54:52Z
Tiny concurrent RingBuffer in Zig to understand atomics and memory ordering.
main
0
4
0
4
https://api.github.com/repos/SarthakMakhija/zig-ring-buffer/tags
-
[ "ring-buffer", "zig", "ziglang" ]
16
false
2025-05-03T10:54:52Z
true
true
unknown
github
[]
zig-ring-buffer <a></a> Tiny concurrent RingBuffer in Zig to understand atomics and memory ordering. It demonstrates various language concepts: <ul> <li>Memory ordering</li> <li>Compare and exchange operation</li> <li>Structs</li> <li>Pointers</li> <li>Functions and methods</li> <li>Functions as method parameters</li> <li>Memory allocation and de-allocation</li> <li>Error handling</li> <li>Generics (<code>comptime</code>)</li> <li>Unit tests</li> <li>Thread-pool in tests</li> <li>Waiting group in tests</li> </ul>
[]
https://avatars.githubusercontent.com/u/65465380?v=4
zig-s3
algoflows/zig-s3
2025-01-19T17:39:16Z
A simple and efficient Zig native S3 client library, supporting AWS S3 and S3-compatible services like MINIO.
main
1
4
1
4
https://api.github.com/repos/algoflows/zig-s3/tags
MIT
[ "minio", "s3", "s3-bucket", "s3-storage", "zig", "ziglang" ]
101,840
false
2025-05-11T00:01:11Z
true
true
0.13.0
github
[ { "commit": "refs", "name": "dotenv", "tar_url": "https://github.com/dying-will-bullet/dotenv/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/dying-will-bullet/dotenv" } ]
🚧 Under Construction This project is currently under construction and subject to changes. S3 Client for Zig 🚀 <a></a> <a></a> <a></a> A simple and efficient S3 client library for Zig, supporting AWS S3 and S3-compatible services. 📑 Table of Contents <ul> <li><a>Features</a></li> <li><a>Prerequisites</a></li> <li><a>Installation</a></li> <li><a>Quick Start</a></li> <li><a>API Reference</a></li> <li><a>Error Handling</a></li> <li><a>Testing</a></li> <li><a>Development</a></li> <li><a>Contributing</a></li> <li><a>Community</a></li> <li><a>License</a></li> </ul> ✨ Features <ul> <li>✅ Basic S3 operations (create/delete buckets, upload/download objects)</li> <li>🔐 AWS Signature V4 authentication</li> <li>🔌 Support for custom endpoints (MinIO, LocalStack, etc.)</li> <li>📝 Pagination support for listing objects</li> <li>📦 Convenient upload helpers for different content types:</li> <li>String content upload</li> <li>JSON serialization and upload</li> <li>File system file upload</li> <li>🛡️ Memory-safe implementation using Zig's standard library</li> <li>🧪 Comprehensive test suite:</li> <li>Unit tests for all components</li> <li>Integration tests with MinIO</li> <li>Test assets for real-world scenarios</li> </ul> 🔧 Prerequisites <ul> <li>Zig 0.13.0 or newer</li> <li>For integration testing: Docker (optional, for running MinIO)</li> </ul> 📥 Installation Add the package to your <code>build.zig.zon</code>: <code>zig .{ .name = "your-project", .version = "0.1.0", .dependencies = .{ .s3 = .{ .url = "https://github.com/algoflows/zig-s3/archive/v0.2.0.tar.gz", // Don't forget to update hash after publishing .hash = "...", }, }, }</code> Then in your <code>build.zig</code>: <code>zig const s3_dep = b.dependency("s3", .{ .target = target, .optimize = optimize, }); exe.addModule("s3", s3_dep.module("s3"));</code> 🚀 Quick Start ```zig const std = @import("std"); const s3 = @import("s3"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); <code>// Initialize client var client = try s3.S3Client.init(allocator, .{ .access_key_id = "your-key", .secret_access_key = "your-secret", .region = "us-east-1", // Optional: Use with MinIO or other S3-compatible services // .endpoint = "http://localhost:9000", }); defer client.deinit(); // Create bucket try client.createBucket("my-bucket"); // Upload string content var uploader = client.uploader(); try uploader.uploadString("my-bucket", "hello.txt", "Hello, S3!"); </code> } ``` 📚 API Reference S3Client The main client interface for S3 operations. <code>zig const client = try s3.S3Client.init(allocator, .{ .access_key_id = "your-key", .secret_access_key = "your-secret", .region = "us-east-1", .endpoint = "http://localhost:9000", // Optional, for S3-compatible services });</code> 🪣 Bucket Operations <ul> <li><code>createBucket(bucket_name: []const u8) !void</code></li> <li><code>deleteBucket(bucket_name: []const u8) !void</code></li> <li><code>listBuckets() ![]BucketInfo</code></li> </ul> 📦 Object Operations <ul> <li><code>putObject(bucket_name: []const u8, key: []const u8, data: []const u8) !void</code></li> <li><code>getObject(bucket_name: []const u8, key: []const u8) ![]const u8</code></li> <li><code>deleteObject(bucket_name: []const u8, key: []const u8) !void</code></li> <li><code>listObjects(bucket_name: []const u8, options: ListObjectsOptions) ![]ObjectInfo</code></li> </ul> 📤 ObjectUploader A helper for uploading different types of content: ```zig var uploader = client.uploader(); // Upload string content try uploader.uploadString("my-bucket", "hello.txt", "Hello, World!"); // Upload JSON data const data = .{ .name = "example", .value = 42 }; try uploader.uploadJson("my-bucket", "data.json", data); // Upload file from filesystem try uploader.uploadFile("my-bucket", "image.jpg", "path/to/local/image.jpg"); ``` ⚠️ Error Handling The library uses Zig's error union type for robust error handling: | Error Type | Description | | ---------------------------- | ----------------------------------- | | <code>S3Error.InvalidCredentials</code> | Invalid AWS credentials | | <code>S3Error.BucketNotFound</code> | Requested bucket doesn't exist | | <code>S3Error.ObjectNotFound</code> | Requested object doesn't exist | | <code>S3Error.ConnectionFailed</code> | Network or connection issues | | <code>S3Error.InvalidResponse</code> | Unexpected response from S3 service | 🧪 Testing Unit Tests Run the unit test suite: <code>bash zig build test</code> Integration Tests Integration tests require a running MinIO instance: <ol> <li>Start MinIO:</li> </ol> <code>bash docker run -p 9000:9000 minio/minio server /data</code> <ol> <li>Run integration tests:</li> </ol> <code>bash zig build integration-test</code> See <code>tests/integration/README.md</code> for detailed information about the integration tests. 🛠️ Development <ul> <li>Written in Zig 0.13.0</li> <li>Uses only standard library (no external dependencies)</li> <li>Memory safe with proper allocation and cleanup</li> <li>Follows Zig style guide and best practices</li> </ul> 🤝 Contributing <ol> <li>Fork the repository</li> <li>Create your feature branch (<code>git checkout -b feature/amazing-feature</code>)</li> <li>Make your changes</li> <li>Add tests for your changes</li> <li>Run the test suite</li> <li>Create a pull request</li> </ol> 👥 Community <ul> <li>📫 Report issues on <a>GitHub Issues</a></li> <li>💬 Join discussions in <a>GitHub Discussions</a></li> <li>🌟 Star the repository if you find it helpful!</li> </ul> 📄 License MIT License - see <a>LICENSE</a> file for details. 🙏 Acknowledgments <ul> <li>AWS S3 Documentation</li> <li>MinIO Documentation</li> <li>Zig Standard Library</li> </ul>
[]
https://avatars.githubusercontent.com/u/47033578?v=4
Zig-Math-Algorithms
ramsyana/Zig-Math-Algorithms
2024-12-13T07:10:11Z
A collection of mathematical algorithms implemented in Zig, designed to address specific mathematical problems with simple command-line interfaces.
main
0
4
0
4
https://api.github.com/repos/ramsyana/Zig-Math-Algorithms/tags
-
[ "algorithms", "math", "zig", "ziglang" ]
138
false
2025-04-17T02:52:53Z
true
true
unknown
github
[]
Zig Math Algorithms A collection of mathematical algorithms implemented in Zig, designed for educational purposes and showcasing Zig's performance. 🚀 Table of Contents <ul> <li><a>Zig Math Algorithms</a></li> <li><a>🚀 Table of Contents</a></li> <li><a>🔢 Available Algorithms</a></li> <li><a>🚀 Prerequisites</a></li> <li><a>🔧 Running the Algorithms</a></li> <li><a>📚 Purpose</a></li> <li><a>📝 License</a></li> <li><a>🤝 Contributing</a></li> <li><a>📧 Contact</a></li> </ul> 🔢 Available Algorithms Here is the updated markdown table with the <strong>Time Complexity</strong> column removed: | Algorithm | Description | Command | Difficulty | |-----------|-------------|---------|------------| | <strong>Basic Number Operations</strong> | | Armstrong Number Checker | Verifies Armstrong numbers | <code>zig run src/algorithm/math/is_armstrong.zig</code> | Easy | | Digital Root | Recursive digit sum calculation | <code>zig run src/algorithm/math/digital_root.zig</code> | Easy | | Happy Number Checker | Checks if a number is happy | <code>zig run src/algorithm/math/happy_number.zig</code> | Easy | | Integer Square Root | Finds floor(√n) | <code>zig run src/algorithm/math/integer_sqrt.zig</code> | Easy | | Leap Year Checker | Determines if year is leap | <code>zig run src/algorithm/math/leap_year_checker.zig</code> | Easy | | Palindrome Number Checker | Checks if a number is a palindrome | <code>zig run src/algorithm/math/palindrome_number.zig</code> | Easy | | Power of Two Checker | Checks if number is 2ⁿ | <code>zig run src/algorithm/math/power_of_two.zig</code> | Easy | | Prime Number Checker | Checks if a number is prime | <code>zig run src/algorithm/math/prime_checker.zig</code> | Easy | | Reverse Number | Reverses digits of a number | <code>zig run src/algorithm/math/reverse_number.zig</code> | Easy | | Sum of Digits | Calculates digit sum | <code>zig run src/algorithm/math/sum_of_digits.zig</code> | Easy | | <strong>Number Theory</strong> | | Abundant/Deficient Checker | Checks if number is abundant/deficient | <code>zig run src/algorithm/math/abundant_deficient_checker.zig</code> | Easy | | Perfect Number Checker | Checks if a number is perfect | <code>zig run src/algorithm/math/perfect_number_checker.zig</code> | Easy | | Strong Number Checker | Sum of digit factorials check | <code>zig run src/algorithm/math/strong_number_checker.zig</code> | Easy | | GCD and LCM Calculator | Finds GCD and LCM | <code>zig run src/algorithm/math/gcd_lcm_calculator.zig</code> | Medium | | Prime Counter | Counts primes up to n | <code>zig run src/algorithm/math/prime_counter.zig</code> | Medium | | Prime Factorization | Computes prime factors | <code>zig run src/algorithm/math/prime_factorization.zig</code> | Medium | | Euler's Totient Function | Counts coprime numbers | <code>zig run src/algorithm/math/euler_totient.zig</code> | Hard | | <strong>Sequences and Series</strong> | | Factorial Calculator | Calculates n! | <code>zig run src/algorithm/math/factorial.zig</code> | Easy | | Fibonacci Calculator | Calculates nth Fibonacci | <code>zig run src/algorithm/math/fibonacci.zig</code> | Easy | | Lucas Numbers | Generates Lucas numbers | <code>zig run src/algorithm/math/lucas_numbers.zig</code> | Easy | | Sequence Generator | Arithmetic/Geometric sequences | <code>zig run src/algorithm/math/sequence_generator.zig</code> | Easy | | Collatz Conjecture | Steps to reach 1 | <code>zig run src/algorithm/math/collatz_conjecture.zig</code> | Medium | | Trailing Zeros in Factorial | Counts trailing zeros in n! | <code>zig run src/algorithm/math/factorial_trailing_zeroes.zig</code> | Medium | | Catalan Calculator | Calculates nth Catalan | <code>zig run src/algorithm/math/catalan.zig</code> | Hard | | <strong>Advanced Mathematics</strong> | | Binomial Coefficient | Pascal's triangle coefficients | <code>zig run src/algorithm/math/binomial_coefficient.zig</code> | Medium | | Matrix Multiplication | Performs matrix multiplication | <code>zig run src/algorithm/math/matrix_multiplication.zig</code> | Medium | | Monte Carlo Pi | Estimates π using Monte Carlo simulation | <code>zig run src/algorithm/math/monte_carlo_pi.zig</code> | Medium | | Quadratic Solver | Solves quadratic equations (ax² + bx + c = 0) | <code>zig run src/algorithm/math/quadratic_solver.zig</code> | Medium | | Cantor Set Generator | Generates Cantor set | <code>zig run src/algorithm/math/cantor_set.zig -- 0 1 3</code> | Hard | | Chinese Remainder | Solves linear congruences | <code>zig run src/algorithm/math/chinese_remainder.zig</code> | Hard | | Extended Euclidean | GCD and Bézout coefficients | <code>zig run src/algorithm/math/euclidean_algorithm_extended.zig</code> | Hard | | Linear Interpolation | Linear interpolation | <code>zig run src/algorithm/math/linear_interpolation.zig</code> | Hard | | Cartesian to Polar | Converts cartesian to polar coordinates | <code>zig run src/algorithm/math/cartesian_to_polar.zig</code> | Medium | | Fast Fibonacci | Optimized Fibonacci calculation | <code>zig run src/algorithm/math/fibonacci_fast.zig</code> | Medium | | Fibonacci Dynamic Programming | DP approach for Fibonacci | <code>zig run src/algorithm/math/fibonacci_dynamic_programming.zig</code> | Medium | | Fibonacci Binet Formula | Binet's formula for Fibonacci | <code>zig run src/algorithm/math/fibonacci_bnet_formula.zig</code> | Medium | | Fermat's Factorization | Integer factorization method | <code>zig run src/algorithm/math/fermats_factorization.zig</code> | Hard | | Fast Fourier Transform | FFT implementation | <code>zig run src/algorithm/math/fft.zig</code> | Hard | | Greatest Common Divisor | Alternative GCD implementation | <code>zig run src/algorithm/math/greatest_common_divisor.zig</code> | Medium | | Karatsuba Multiplication | Fast multiplication algorithm | <code>zig run src/algorithm/math/karatsuba.zig</code> | Hard | | Knapsack Problem | Dynamic programming solution | <code>zig run src/algorithm/math/knapsack.zig</code> | Hard | | Large Factorials | Big number factorial calculation | <code>zig run src/algorithm/math/large_factorials.zig</code> | Hard | | Modular Exponentiation | Fast modular exponentiation | <code>zig run src/algorithm/math/modular_exponentiation.zig</code> | Medium | | Newton-Raphson Method | Root-finding algorithm | <code>zig run src/algorithm/math/newton_raphson.zig</code> | Hard | | Pascal's Triangle | Generate Pascal's triangle | <code>zig run src/algorithm/math/pascals_triangle.zig</code> | Medium | | Polynomial Addition | Add two polynomials | <code>zig run src/algorithm/math/polynomial_add.zig</code> | Medium | | Series Sum | Calculate sum of series | <code>zig run src/algorithm/math/series_sum.zig</code> | Easy | | Sieve of Eratosthenes | Prime number generation | <code>zig run src/algorithm/math/sieve_of_eratosthenes.zig</code> | Medium | 🚀 Prerequisites <ul> <li><strong>Zig Compiler</strong>: </li> <li> Latest version recommended. Install via: <code>shell sh -c "$(curl -fsSL https://ziglang.org/download/index.json | jq -r '.master.url')"</code> </li> </ul> 🔧 Running the Algorithms To run any algorithm, use the Zig run command followed by the specific algorithm file path and any required arguments. For example: ```shell zig run src/algorithm/math/prime_checker.zig or zig test src/algorithm/math/prime_checker.zig ``` More information is available in the respective file comment header. 📚 Purpose This repository provides a collection of mathematical algorithms implemented in Zig, showcasing the language's capabilities and performance. Each module is designed to be easily run and tested, making it a useful resource for learning and experimentation. 📝 License MIT License Copyright (c) 2025 Ramsyana Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 🤝 Contributing Contributions are welcome! Here's how to contribute: - Fork the repository - Create your feature branch (git checkout -b feature/AmazingFeature) - Commit your changes (git commit -m 'Add some AmazingFeature') - Push to the branch (git push origin feature/AmazingFeature) - Open a pull request 📧 Contact Ramsyana - ramsyana[at]mac[dot]com I'm a system engineering enthusiast. Feel free to fork, clone, open issues, or contribute to this project. Don’t hesitate to reach out with any questions, suggestions, or collaboration ideas!
[]
https://avatars.githubusercontent.com/u/53349189?v=4
bitmatch
freakmangd/bitmatch
2024-08-13T22:01:35Z
Bitmatching in zig
main
0
4
0
4
https://api.github.com/repos/freakmangd/bitmatch/tags
MIT
[ "zig", "zig-package" ]
14
false
2024-08-30T05:08:38Z
true
true
unknown
github
[]
bitmatch Simple zig library based off of the rust crate <a>bitmatch</a>. <code>zig const match = bitmatch("00oo_aabb", 0b0011_1001) orelse return error.ExpectedNonNull; try std.testing.expectEqual(0b11, match.o); try std.testing.expectEqual(0b10, match.a); try std.testing.expectEqual(0b01, match.b);</code> Installing <code>zig fetch --save git+https://github.com/freakmangd/bitmatch</code> <code>build.zig</code>: <code>zig const bitmatch = b.dependency("bitmatch", .{}); exe.root_module.addImport("bitmatch", bitmatch.module("root"));</code> Features The main functions of the library are <code>bitmatch</code> and <code>bitmatchPacked</code>. Both functions take a match string and a byte to match against. The match string must be comptime known. <code>bitmatch</code> returns <code>?struct</code>. Each field is of type <code>u8</code>. <code>bitmatchPacked</code> returns <code>?packed struct(u8)</code>. Each field is the smallest int type required to hold all bits matched by the field's identifier. ```zig // non-packed const match = bitmatch("aaaa_b010", 0b1000_1010) orelse return error.ExpectedNonNull; try std.testing.expect(@TypeOf(match.a) == u8); try std.testing.expect(@TypeOf(match.b) == u8); try std.testing.expectEqual(0b0000_1000, match.a); try std.testing.expectEqual(0b0000_0001, match.b); // packed const match = bitmatchPacked("aaaa_b010", 0b1000_1010) orelse return error.ExpectedNonNull; try std.testing.expect(@TypeOf(match.a) == u4); try std.testing.expect(@TypeOf(match.b) == u1); try std.testing.expectEqual(0b1000, match.a); try std.testing.expectEqual(0b1, match.b); // no identifiers const match = bitmatch("0001_1010", 0b0001_1010) orelse return error.ExpectedNonNull; try std.testing.expectEqual(0, @sizeOf(@TypeOf(match))); ``` Match bits 0s and 1s in the match string are the only characters that decide whether a byte matches the pattern defined. <code>zig // This match returns null as were expecting the last bits to be 1011 // the match fails here -----------v if (bitmatch("aaaa_1011", 0b1010_1001)) |_| return error.ExpectedNull;</code> Identifiers An "identifier" refers to an alphabetic character inside the match string, they are allowed to be in the range a-z and A-Z. An identifier captures the bits that share their position. All identifiers will be fields of the return value. There is a max of 8 identifiers per match string as this library assumes 8 bits in a byte. ```zig const match = bitmatch("aaaa_bbbb", 0b0101_1010) orelse return error.ExpectedNonNull; try std.testing.expectEqual(0b0101, match.a); try std.testing.expectEqual(0b1010, match.b); const match = bitmatch("abcd_efgh", 0b0101_1010) orelse return error.ExpectedNonNull; try std.testing.expectEqual(0b0, match.a); try std.testing.expectEqual(0b1, match.b); try std.testing.expectEqual(0b0, match.c); // ... try std.testing.expectEqual(0b0, match.h); // identifiers are case-sensitive const match = bitmatch("aaaa_AAAA", 0b0000_1111) orelse return error.ExpectedNonNull; try std.testing.expectEqual(0b0000, match.a); try std.testing.expectEqual(0b1111, match.A); ``` Identifiers can be split as many times as is necessary, they will capture the bits that share their position and concat them. <code>zig const match = bitmatch("aa_bb_aa_bb", 0b10_01_00_11); try std.testing.expectEqual(0b10_00, match.a); try std.testing.expectEqual(0b01_11, match.b);</code> Underscores Underscores in match strings are ignored, and are more lenient than zig's integer literal underscores. You can have as many as you want for the purposes of increasing readability. These match strings function the same: <code>"aaaabbbb"</code>, <code>"aaaa_bbbb"</code> <code>"a_a____aa_bb__b_b_"</code> Wildcards The <code>?</code> character is used as a wildcard, matching either a 0 or 1 without capturing it. <code>zig const match = bitmatch("???_aa_???", 0b010_01_101) orelse return error.ExpectedNonNull; try std.testing.expectEqual(0b01, match.a);</code> If the match string is less than 8 characters, the match string is left-padded with wildcards, making <code>"aa01"</code> equivalent to <code>"????aa01"</code> <code>zig const match = bitmatch("aa01", 0b0000_1101) orelse return error.ExpectedNonNull; try std.testing.expectEqual(0b11, match.a);</code> More Examples See the bottom of <code>src/init.zig</code> for more testable examples. You can run them with <code>zig build test</code>.
[]
https://avatars.githubusercontent.com/u/104794884?v=4
jellyfish
OsakiTsukiko/jellyfish
2024-10-10T08:25:59Z
A simple one-source zig IDE targeted towards algorithmics.
main
0
4
0
4
https://api.github.com/repos/OsakiTsukiko/jellyfish/tags
MIT
[ "editor", "monaco-editor", "zig" ]
3,887
false
2025-03-12T22:35:21Z
true
true
unknown
github
[ { "commit": "main.tar.gz", "name": "scroll", "tar_url": "https://github.com/OsakiTsukiko/scroll/archive/main.tar.gz.tar.gz", "type": "remote", "url": "https://github.com/OsakiTsukiko/scroll" }, { "commit": "2.5.0-beta.2.tar.gz", "name": "zig-webui", "tar_url": "https://github.com...
Jellyfish 🪼 A simple <b>one-source</b> zig <b>IDE</b> targeted towards algorithmics. 🪼 📖 About This is mainly a project to further develop my skills in <code>zig</code> and <code>web technologies</code> and try out <code>webui</code>. It is very targeted towards algorithmics and will probably never become more than that (but I do have other fun stuff in the oven 😋). Any contributions are welcome as long as they do not drastically change the scope of the project. 🔧 HOW TO BUILD For now we only support <code>linux</code> but <code>windows</code> and <code>macos</code> should be out soon. (<code>macos</code> could be made to run with minimal tweaks) 🐧 Linux ⚙️ Prerequisites <code>zig 0.13.0 bun (nodejs could also work with some tweaks) wget tar firefox (can be changed inside main.zig)</code> ⚡ Running <code>bash git clone https://github.com/OsakiTsukiko/jellyfish cd jellyfish cd ui bun install bun add-zig-linux bun run run</code> 🪟 Windows SOON 🍏 MacOS SOON 🗺️ TODO: <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Monaco Editor - [X] <code>ZIG</code> highlighting <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> More Themes <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Multiplayer <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Zig - [X] Run <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Compile (and download?) - [X] Compiler arguments <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Custom zig arguments - [X] Pre command wrapper <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> ?testing <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Cross Platform - [X] Linux <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Windows <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> MacOS - [X] Package: - [X] Indexed Archive (Scroll) <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Quality Of Life Impv. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Disable CTRL + S <a>🪼 GALLERY</a>
[]
https://avatars.githubusercontent.com/u/193787365?v=4
zup
openSVM/zup
2025-01-06T04:44:16Z
zig api server
main
0
4
0
4
https://api.github.com/repos/openSVM/zup/tags
-
[ "bunjs", "high-load", "high-performance", "nodejs", "zig", "zig-http", "zig-package" ]
219
false
2025-05-08T15:25:51Z
true
true
unknown
github
[]
Zup Server A high-performance HTTP and WebSocket server framework written in Zig, designed for building scalable web applications with built-in parallel computing capabilities via SPICE integration. Features <ul> <li>🚀 Multi-threaded HTTP server with automatic CPU core detection</li> <li>🔌 WebSocket support with automatic upgrade handling</li> <li>💪 Keep-alive connection support for improved performance</li> <li>🔄 Integration with SPICE for parallel computing tasks</li> <li>📊 Built-in benchmarking tools</li> <li>🧪 Comprehensive test suite</li> </ul> Installation <ol> <li>Ensure you have Zig 0.11.0 or later installed</li> <li>Clone the repository: <code>bash git clone https://github.com/yourusername/zup.git cd zup</code></li> </ol> Building Build the project using Zig's build system: <code>bash zig build</code> This will create the following executables in <code>zig-out/bin/</code>: - <code>server</code>: The main server executable - <code>example-server</code>: An example server implementation - <code>benchmark</code>: Benchmarking tool Usage Running the Server Start the server on localhost:8080: <code>bash zig build run</code> Or run directly: <code>bash ./zig-out/bin/server</code> Example Server Run the example server implementation: <code>bash zig build example</code> Running Tests Run the test suite: <code>bash zig build test</code> Run framework-specific tests: <code>bash zig build test-framework</code> Benchmarking Run HTTP benchmarks: <code>bash zig build bench</code> API Documentation HTTP Server The core server provides a simple interface for handling HTTP requests: ```zig const std = @import("std"); const Server = @import("main.zig").Server; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); <code>const address = try std.net.Address.parseIp("127.0.0.1", 8080); var server = try Server.init(allocator, address); defer server.deinit(); try server.start(); </code> } ``` WebSocket Support The server automatically handles WebSocket upgrades and provides a simple message-based API: ```zig // WebSocket frame handling example const ws = @import("websocket.zig"); // Echo server implementation while (true) { const frame = try ws.readMessage(stream); defer allocator.free(frame.payload); <code>switch (frame.opcode) { .text, .binary =&gt; try ws.writeMessage(stream, frame.payload), .close =&gt; break, else =&gt; {}, } </code> } ``` Framework Module The framework module provides additional utilities for building web applications: ```zig const framework = @import("framework"); // Initialize router var router = try framework.Router.init(allocator); defer router.deinit(); // Add routes try router.get("/", handleRoot); try router.post("/api/data", handleData); ``` Performance The server is designed for high performance: - Multi-threaded architecture utilizing all available CPU cores - Keep-alive connection support - Efficient WebSocket implementation - Integration with SPICE for parallel computing tasks Contributing Contributions are welcome! Please feel free to submit a Pull Request. License This project is licensed under the MIT License - see the LICENSE file for details.
[]
https://avatars.githubusercontent.com/u/554766?v=4
gamedev-playground
zoeesilcock/gamedev-playground
2025-01-12T08:16:38Z
Playground for exploring ways of making game development a more pleasurable experience.
master
0
4
0
4
https://api.github.com/repos/zoeesilcock/gamedev-playground/tags
-
[ "game-development", "zig" ]
3,524
false
2025-05-18T10:03:36Z
true
true
0.14.0
github
[ { "commit": "v0.2.1+3.2.10", "name": "sdl", "tar_url": "https://github.com/castholm/SDL/archive/v0.2.1+3.2.10.tar.gz", "type": "remote", "url": "https://github.com/castholm/SDL" }, { "commit": "master", "name": "imgui", "tar_url": "https://github.com/ocornut/imgui/archive/master....
Gamedev Playground Playground for exploring ways of making game development a more pleasurable experience. Editor This approach aims to do as much of the editing directly in-game and offload to external editors for more complicated tasks. Hovering over entities with the mouse will highlight them. Clicking on them will bring up the inspector which shows all components and their fields and allows editing them. Double clicking on an entity will open it's sprite in Aseprite. This works particularly well together with hot reloading since you can double click a sprite, edit it, save it, and instantly see the result in-game. Keys <ul> <li>P: Toggle pause.</li> <li>F: Toggle fullscreen.</li> <li>C: Toggle collider outlines.</li> <li>F1: Switch between FPS display modes (none, number, or number and graph).</li> <li>F2: Toggle the memory usage graph.</li> <li>E: Toggle editor.</li> <li>Alt/Option: Clicking on an entity grabs the color and/or type of the clicked element.</li> <li>S: Save level.</li> <li>L: Load level.</li> </ul> Hot reloading Both the code and the assets automatically update in-game when modified. For code this is achieved by having the entire game code inside a shared library with a thin executable that takes care of reloading the shared library when it changes. For assets the executable lets the game know when assets have changed so that it can react to that in whatever way that makes sense, in this case it simply reloads the assets without interrupting the game. Build We build <a>Dear ImGui</a> from source and use <a>Dear Bindings</a> to generate C bindings which we then use directly from Zig. It is important to regenerate the bindings whenever updating the Dear ImGui dependency. This can be done by running the following build step: <code>zig build generate_imgui_bindings</code>
[]
https://avatars.githubusercontent.com/u/7220778?v=4
mcm
darkyzhou/mcm
2024-09-06T14:01:35Z
Generate well-formed commit messages based on your staged changes
main
0
4
0
4
https://api.github.com/repos/darkyzhou/mcm/tags
MIT
[ "commit", "commit-message", "conventional-commits", "git", "llm", "zig" ]
317
false
2025-01-13T12:08:13Z
true
true
unknown
github
[ { "commit": "67e35c75c5d11caf398bccae39d14d7187d1a952.zip", "name": "zig-toml", "tar_url": "https://github.com/sam701/zig-toml/archive/67e35c75c5d11caf398bccae39d14d7187d1a952.zip.tar.gz", "type": "remote", "url": "https://github.com/sam701/zig-toml" }, { "commit": "refs", "name": "m...
MCM - Make Commit Message A command-line tool that generates well-formed commit messages based on your staged changes and then commits with them. To use MCM, you need <code>git</code> installed and access to an LLM service. Key Features <ul> <li>🤖 AI-powered commit message generation based on staged changes</li> <li>📏 Adherence to <a>Conventional Commits</a> specification for consistency</li> <li>🧠 Context-aware messages that capture the essence of your changes</li> <li>💡 Custom hints to customize AI-generated messages</li> <li>📝 Built-in editor integration for easy review and modification</li> </ul> Installation <ol> <li>Create a configuration file at <code>$HOME/.config/mcm/config.toml</code> with your API key:</li> </ol> ```toml Specify your OpenAI API key here. For more configuration options, see the "Configuration" section below. api_key = "your_api_key" ``` <ol> <li>Download the appropriate binary for your system from <a>releases</a>.</li> </ol> Usage Run MCM in your git repository after staging your changes by <code>git add</code>: ```bash Generate a commit message and edit it in the editor: $ mcm You could also provide a hint for the AI to generate a more specific commit message: $ mcm --hint "make it shorter" $ mcm --hint "mention also the dependency updates" $ mcm --hint "the scope should be dns/providers" ``` Limitations <ul> <li>Only OpenAI and OpenAI-compatible endpoints are supported.</li> <li>Only models and endpoints that supports <a>Structured Output</a> are supported. For OpenAI endpoint, only the latest <code>gpt-4o</code> and <code>gpt-4o-mini</code> are supported.</li> </ul> Roadmap <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Support more LLM providers like Anthropic, Cloudflare, etc. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Support more languages besides English. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Improve default system prompt for LLM. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Publish the package to various package managers like Homebrew, Nixpkgs, etc. Configuration MCM uses a TOML configuration file located at <code>$HOME/.config/mcm/config.toml</code>. Here are the available configuration options: ```toml Required: Your API key for the LLM service api_key = "your_api_key_here" Optional: Base URL for the API (default: "https://api.openai.com/v1") base_url = "https://api.openai.com/v1" Optional: AI model to use (default: "gpt-4o-mini") model = "gpt-4o-mini" Optional: Custom system prompt for the AI (default: see <code>src/config.zig#default_system_prompt</code>) Currently we force the LLM's output to follow the structure defined in <code>src/request.zig#llm_json_schema</code>, maybe we could make it also configurable in the future. system_prompt = """ The prompt """ Optional: Path to your preferred text editor If not specified, MCM checks environment variables <code>VISUAL</code> and <code>EDITOR</code>. path_to_editor = "/usr/bin/vi" Optional: List of file patterns to ignore when generating commit messages (default: see <code>src/config.zig#AppConfig</code>) Refer to git-diff documentation for name format ignored_files = [ "<em>.lock</em>", "<em>-lock.</em>", ] ```
[]
https://avatars.githubusercontent.com/u/20110944?v=4
zvterm
ringtailsoftware/zvterm
2024-12-08T19:36:46Z
Zig binding for libvterm, a terminal emulator core
main
0
4
1
4
https://api.github.com/repos/ringtailsoftware/zvterm/tags
NOASSERTION
[ "libvterm", "terminal", "terminal-emulator", "zig", "zig-package" ]
1,614
false
2025-03-17T21:21:22Z
true
true
unknown
github
[]
ZVTerm A Zig wrapper for <a>libvterm</a>, exposing a small subset in a native Zig API. Build with zig 0.14.0 (Just enough to build a working toy terminal emulator) See <code>examples/helloworld.zig</code> for usage. See <code>sdlzvterm/</code> for a janky terminal implementation in SDL. ```zig // setup an 80x24 terminal var term = try ZVTerm.init(allocator, 80, 24); defer term.deinit(); // get a writer to send data to the terminal var writer = term.getWriter(); // write terminal escape codes try writer.print("\x1b[10;10HHello world", .{}); <code>// read back the screen state for each x,y position for (0..term.height) |y| { for (0..term.width) |x| { const cell = term.getCell(x, y); // paint cell.char:u8 using cell.fg and cell.bg colours ... } } </code> ``` To build and run the simple demo, <code>zig build helloworld </code> To build and run the SDL demo terminal, <code>cd sdlzvterm zig build run </code> Use First we add the library as a dependency in our <code>build.zig.zon</code> file. <code>zig fetch --save git+https://github.com/ringtailsoftware/zvterm.git</code> And add it to <code>build.zig</code> file. ```zig const zvterm_dep = b.dependency("zvterm", .{ .target = target, .optimize = optimize, }); exe.root_module.addImport("zvterm", zvterm_dep.module("zvterm")); ``` Status There's plenty to add in order to make a real terminal emulator. libvterm is capable, but the zig API needs extending to do more <ul> <li>unicode</li> <li>bell</li> <li>more selective damage callbacks to know which areas of screen to redraw</li> </ul>
[ "https://github.com/ringtailsoftware/commy", "https://github.com/ringtailsoftware/zig-wasm-audio-framebuffer" ]
https://avatars.githubusercontent.com/u/113083639?v=4
znoise
zig-gamedev/znoise
2024-11-03T23:25:49Z
Zig build package and bindings for https://github.com/Auburn/FastNoiseLite
main
1
4
4
4
https://api.github.com/repos/zig-gamedev/znoise/tags
MIT
[ "bindings", "fastnoiselite", "gamedev", "noise-generator", "zig" ]
29
false
2025-05-06T22:04:50Z
true
true
unknown
github
[]
<a>znoise</a> Zig build package and bindings for <a>FastNoiseLite</a> Getting started Example <code>build.zig</code>: ```zig pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ ... }); <code>const znoise = b.dependency("znoise", .{}); exe.root_module.addImport("znoise", znoise.module("root")); exe.linkLibrary(znoise.artifact("FastNoiseLite")); </code> } ``` Now in your code you may import and use znoise: ```zig const znoise = @import("znoise"); pub fn main() !void { ... { const gen = znoise.FnlGenerator{}; const n2 = gen.noise2(0.1, 0.2); const n3 = gen.noise3(1.0, 2.0, 3.0); <code> var x: f32 = 1.0; var y: f32 = 2.0; var z: f32 = 3.0; gen.domainWarp3(&amp;x, &amp;y, &amp;z); } { const gen = znoise.FnlGenerator{ .seed = 1337, .frequency = 0.01, .noise_type = .opensimplex2, .rotation_type3 = .none, .fractal_type = .none, .octaves = 3, .lacunarity = 2.0, .gain = 0.5, .weighted_strength = 0.0, .ping_pong_strength = 2.0, .cellular_distance_func = .euclideansq, .cellular_return_type = .distance, .cellular_jitter_mod = 1.0, .domain_warp_type = .opensimplex2, .domain_warp_amp = 1.0, }; const n = gen.noise2(0.1, 0.2); } </code> } ```
[ "https://github.com/Game4all/unnamed-voxel-tracer", "https://github.com/JadonBelair/voxel_renderer", "https://github.com/zig-gamedev/zig-gamedev" ]
https://avatars.githubusercontent.com/u/163546630?v=4
oauth2
zon-dev/oauth2
2024-08-10T09:43:35Z
Implementation of OAuth 2.0 in Zig.
main
0
4
1
4
https://api.github.com/repos/zon-dev/oauth2/tags
-
[ "authorization", "oauth2", "oauth2-client", "oauth2-server", "zig", "ziglang" ]
14
false
2025-04-10T07:27:49Z
true
true
unknown
github
[ { "commit": null, "name": "zinc", "tar_url": null, "type": "relative", "url": "../zinc" }, { "commit": "refs", "name": "url", "tar_url": "https://github.com/zon-dev/url/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/zon-dev/url" } ]
OAuth2 An extensible, strongly-typed implementation of OAuth 2.0 in Zig. It supports the following grants: <ul> <li>Authorization code grant</li> <li>Client credentials grant</li> <li>Device authorization grant</li> <li>Implicit grant</li> <li>Refresh grant</li> <li>Resource owner password credentials grant</li> </ul> The following RFCs are implement in plan: <ul> <li><a>RFC6749 "OAuth 2.0"</a></li> <li><a>RFC6750 " The OAuth 2.0 Authorization Framework: Bearer Token Usage"</a></li> <li><a>RFC7519 "JSON Web Token (JWT)"</a></li> <li><a>RFC7636 "Proof Key for Code Exchange by OAuth Public Clients"</a></li> <li><a>RFC8628 "OAuth 2.0 Device Authorization Grant</a></li> </ul>
[]
https://avatars.githubusercontent.com/u/47111091?v=4
norn
smallkirby/norn
2024-11-24T08:49:55Z
The x64 Operating System written in Zig language from scratch. Under development.
master
1
4
0
4
https://api.github.com/repos/smallkirby/norn/tags
MIT
[ "os", "zig" ]
737
false
2025-05-11T11:17:24Z
true
true
0.14.0
github
[]
Norn Development ```bash Run on QEMU zig build run -Dlog_level=debug --summary all -Druntime_test -Doptimize=Debug Unit Test zig build test --summary all -Druntime_test=true ``` Options | Option | Type | Description | Default | |---|---|---|---| | <code>debug_exit</code> | Flag | Add <code>isa-debug-exit</code> device. When enabled, Norn can terminate QEMU with arbitrary exit code. | <code>false</code> | | <code>debug_intr</code> | Flag | Print all interrupts and exceptions for debugging. | <code>false</code> | | <code>debug_syscall</code> | Flag | Print context for the unhandled or ignored syscalls. | <code>false</code> | | <code>init_binary</code> | String | Path to the init binary within rootfs. | <code>/sbin/init</code> | | <code>log_level</code> | String: <code>debug</code>, <code>info</code>, <code>warn</code>, <code>error</code> | Logging level. Output under the logging level is suppressed. | <code>info</code> | | <code>no_kvm</code> | Flag | Disable KVM. | <code>false</code> | | <code>optimize</code> | String: <code>Debug</code>, <code>ReleaseFast</code>, <code>ReleaseSmall</code> | Optimization level. | <code>Debug</code> | | <code>runtime_test</code> | Flag | Run runtime tests. | <code>false</code> | | <code>wait_qemu</code> | Flag | Make QEMU wait for being attached by GDB. | <code>false</code> | LICENSE <a>Licensed under the MIT License</a> unless otherwise specified.
[]
https://avatars.githubusercontent.com/u/24245170?v=4
shared-memory-zig
Peter-Barrow/shared-memory-zig
2024-12-09T17:49:04Z
Unified interface to shared memory on Linux, macOS and Windows
main
0
4
1
4
https://api.github.com/repos/Peter-Barrow/shared-memory-zig/tags
MIT
[ "shared-memory", "zig", "zig-package" ]
40
false
2025-05-04T18:41:37Z
true
true
unknown
github
[ { "commit": "aa24df42183ad415d10bc0a33e6238c437fc0f59", "name": "known_folders", "tar_url": "https://github.com/ziglibs/known-folders/archive/aa24df42183ad415d10bc0a33e6238c437fc0f59.tar.gz", "type": "remote", "url": "https://github.com/ziglibs/known-folders" }, { "commit": "7b434a47c2b8...
Shared Memory Zig <strong>Overview</strong> This library implements a unified interface to shared memory on Linux, macOS and Windows Features <ul> <li>Cross-platform support (Linux, FreeBSD, Windows)</li> <li>Multiple implementation strategies (memfd, POSIX shm, Windows file mapping)</li> <li>Type-safe shared memory segments</li> <li>Automatic memory layout management with headers</li> <li>Built-in existence checking</li> </ul> Installation Add the following to you <code>build.zig.zon</code>, replacing the url with the latest archive, for example <code>https://github.com/Peter-Barrow/shared-memory-zig/archive/699c748fbb143733183760cc7e83ded098eac6d1.zip</code> and then replacing the hash with the latest commit hash. <code>zig .{ .name = "my-project", .version = "0.0.0", .dependencies = .{ .shared_memory = .{ .url = "", .hash = "", }, }, }</code> Or alternatively run: <code>shell zig fetch --save git+https://github.com/Peter-Barrow/shared-memory-zig.git</code> Add the following to your <code>build.zig</code> <code>zig const shared_memory = b.dependency("shared_memory", .{}).module("shared_memory"); const exe = b.addExecutable(...); // This adds the shared-memory-zig module to the executable which can then be imported with `@import("shared-memory-zig")` exe.root_module.addImport("shared-memory-zig", shared_memory);</code> Dependencies For compatibility with Windows this requires <a>zigwin32</a> This codebase also uses the <a>known-folders</a> library to get the runtime directory on Linux and FreeBSD when using the <code>memfd</code> backend. Example Create a shared struct ``` zig const shmem = @import("shared_memory"); const TestStruct = struct { id: i32, float: f64, string: [20]u8, }; const shm_name = "/test_struct_with_string"; var shm: SharedStruct = try SharedStruct.create(shm_name, alloca); defer shm.close(); shm.data.* = .{ .x = 42, .y = 3.14 }; // Open the shared memory in another "process" var shm2 = try SharedStruct.open(shm_name, alloca); defer shm2.close(); try std.testing.expectEqual(@as(i32, 42), shm2.data.x); try std.testing.expectApproxEqAbs(@as(f64, 3.14), shm2.data.y, 0.001); ``` Create a shared array of comptime known length ``` zig const shmem = @import("shared_memory"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const alloca = switch (tag) { .linux, .freebsd =&gt; gpa.allocator(), else =&gt; null, }; const array_size = 20; var expected = [_]i32{0} ** array_size; for (0..array_size) |i| { expected[i] = @intCast(i * 2); } const shm_name = "/test_array"; const SharedI32 = SharedMemory([array_size]i32); var shm: SharedI32 = try SharedI32.create(shm_name, alloca); defer shm.close(); for (shm.data, 0..) |<em>item, i| { item.</em> = @intCast(i * 2); } // Open the shared memory in another "process" var shm2 = try SharedI32.open(shm_name, alloca); defer shm2.close(); for (shm2.data, 0..) |item, i| { try std.testing.expectEqual(@as(i32, @intCast(i * 2)), item); } try std.testing.expectEqualSlices(i32, &amp;expected, shm2.data); } ``` Create an array with runtime known length ``` zig const shmem = @import("shared_memory"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const alloca = switch (tag) { .linux, .freebsd =&gt; gpa.allocator(), else =&gt; null, }; const array_size = 20; var expected = [_]i32{0} ** array_size; for (0..array_size) |i| { expected[i] = @intCast(i * 2); } const shm_name = "/test_array"; const SharedI32 = SharedMemory([]i32); var shm: SharedI32 = try SharedI32.createWithLength(shm_name, array_size, alloca); defer shm.close(); for (shm.data, 0..) |<em>item, i| { item.</em> = @intCast(i * 2); } // Open the shared memory in another "process" var shm2 = try SharedI32.open(shm_name, alloca); defer shm2.close(); for (shm2.data, 0..) |item, i| { try std.testing.expectEqual(@as(i32, @intCast(i * 2)), item); } try std.testing.expectEqualSlices(i32, &amp;expected, shm2.data); ```
[]
https://avatars.githubusercontent.com/u/1625198?v=4
psx-emu-zig
Ryp/psx-emu-zig
2024-09-18T18:21:06Z
PSX emulator written in Zig
master
0
4
0
4
https://api.github.com/repos/Ryp/psx-emu-zig/tags
MIT
[ "emulator", "psx", "zig" ]
211
false
2025-04-03T06:00:16Z
true
true
0.14.0
github
[ { "commit": null, "name": "vulkan_zig", "tar_url": null, "type": "relative", "url": "external/vulkan-zig" }, { "commit": null, "name": "vulkan_headers", "tar_url": null, "type": "relative", "url": "external/Vulkan-Headers" } ]
PSX Emulator This is WIP. How to run <code>bash git clone --recurse-submodules https://github.com/Ryp/psx-emu-zig zig build run</code>
[]
https://avatars.githubusercontent.com/u/25912761?v=4
crypto
r4gus/crypto
2024-10-11T20:11:51Z
Cryptographic algorithms in Zig
master
0
3
0
3
https://api.github.com/repos/r4gus/crypto/tags
MIT
[ "cryptography", "vrf", "zig", "ziglang" ]
37
false
2024-10-18T22:53:16Z
true
true
unknown
github
[]
Crypto Cryptographic algorithms in <a>Zig</a>. Algorithms <ul> <li>Verifiable Random Functions (VRFs) <a>RFC 9381</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> ECVRF-P256-SHA256-TAI <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> ECVRF-P256-SHA256-SSWU <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> ECVRF-EDWARDS25519-SHA512-TAI <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> ECVRF-EDWARDS25519-SHA512-ELL2</li> <li>Zero-Knowledge Proof <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Schnorr Non-interactive Zero-Knowledge Proof <a>RFC 8235</a></li> <li>Deterministic Random Bit Generator (DRBG) <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> XDRBG <a>iacr</a></li> </ul> Verifiable Random Functions (VRFs) A Verifiable Random Function (VRF) [RFC9381](https://datatracker.ietf.org/doc/rfc9381/) can be seen as a public-key version of a cryptographic hash function with the following properties: - A private-key is used to calculate a hash value. - The hash value can be verified using the corresponding public-key. - The hash is unpredictable and can't be skewed. A key application of the VRF is to provide privacy against offline dictionary attacks on data stored in a hash-based data structure. VRFs can be used as verifiable random numbers with the following properties: - *Uniqueness*: There is exactly one result for every computation - *Collision Resistance*: It is (almost) impossible to find two inputs that result in the same hash. - *Pseudo-randomness*: A hash is indistinguishable from a random value. - *Unpredictability*: If the input is unpredictable, the output is uniformly distributed. --- A VRF comes with a key generation algorithm that generates a VRF key-pair. ```zig const crypto = @import("crypto"); const vrf = crypto.EcvrfP256Sha256Tai; const kp = try vrf.KeyPair.generate(); ``` The Prover uses the secret key to construct a proof pi that beta is the correct hash output. ```zig const alpha = "test"; const pi = try kp.prove(alpha, null); ``` The VRF hash output beta can be directly obtained from the proof value pi. ```zig const beta = try vrf.proofToHash(pi); ``` The proof pi allows a Verifier holding the public key to verify that beta is the correct VRF hash of input alpha under the given private key. This requires that the Prover and the Verifier exchange public keys beforehand. Then, the Prover submits alpha, beta, and pi to the Verifier. The Verifier can verify the correctness by calling `verify`. On success, verify will return beta. ```zig // For demonstration purposes we (the Prover) also call verify. const beta2 = try kp.public_key.verify(alpha, pi, null); if (!std.mem.eql(u8, beta[0..], beta2[0..])) { // handle error... } ``` &gt; **Proofs Provide No Secrecy for the VRF Input** &gt; &gt; The VRF proof pi is not designed to provide secrecy and, in general, &gt; may reveal the VRF input alpha. Anyone who knows the public-key and pi is able &gt; to perform an offline dictionary attack to search for alpha, by &gt; verifying guesses for alpha using VRF_verify. This is in contrast to &gt; the VRF hash output beta, which, without the proof, is pseudorandom &gt; and thus is designed to reveal no information about alpha. Note: the key exchange, as well as the submission of alpha, beta and pi are out of scope. XDRBG TODO
[]
https://avatars.githubusercontent.com/u/105325988?v=4
Kobold
TalonFloof/Kobold
2024-09-11T15:06:40Z
🚧WIP🚧
main
0
3
0
3
https://api.github.com/repos/TalonFloof/Kobold/tags
LGPL-3.0
[ "hobby-kernel", "hobby-os", "kernel", "operating-system", "zig" ]
523
false
2025-05-03T17:27:14Z
false
false
unknown
github
[]
404
[]
https://avatars.githubusercontent.com/u/193787365?v=4
supabase-zig
openSVM/supabase-zig
2025-01-10T10:56:53Z
supabase zig client
main
0
3
0
3
https://api.github.com/repos/openSVM/supabase-zig/tags
Unlicense
[ "supabase-client", "supabase-db", "supabse", "zig", "zig-package", "zig-supabase" ]
12
false
2025-01-23T21:30:30Z
true
false
unknown
github
[]
supabase-zig A Zig client library for <a>Supabase</a>, providing a type-safe and memory-efficient way to interact with your Supabase backend. Features <ul> <li>🔐 <strong>Authentication</strong>: Full support for email/password authentication</li> <li>📊 <strong>Database Operations</strong>: Powerful query builder for database interactions</li> <li>🗄️ <strong>Storage</strong>: File upload, download, and management capabilities</li> <li>🔄 <strong>Realtime</strong>: Subscribe to database changes in real-time</li> <li>🛠️ <strong>RPC</strong>: Call Postgres functions directly</li> <li>⚡ <strong>Performance</strong>: Zero-allocation where possible, with careful memory management</li> <li>🔒 <strong>Type Safety</strong>: Leverage Zig's compile-time features for type-safe operations</li> </ul> Installation Add this library to your <code>build.zig.zon</code>: <code>zig .{ .name = "your-project", .version = "0.1.0", .dependencies = .{ .supabase = .{ .url = "https://github.com/your-username/supabase-zig/archive/refs/tags/v0.1.0.tar.gz", // Add the appropriate hash here }, }, }</code> Quick Start ```zig const std = @import("std"); const supabase = @import("supabase"); pub fn main() !void { // Initialize allocator var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); <code>// Create Supabase client const config = supabase.SupabaseConfig.init( "YOUR_SUPABASE_URL", "YOUR_SUPABASE_ANON_KEY", ); var client = try supabase.SupabaseClient.init(allocator, config); defer client.deinit(); // Example: Query data var query = try client.from("todos") .select("*") .limit(10); defer query.deinit(); const result = try client.executeQuery(query); defer result.deinit(); </code> } ``` Authentication ```zig // Sign up const session = try client.signUp("user@example.com", "password123"); defer session.deinit(allocator); // Sign in const session = try client.signIn("user@example.com", "password123"); defer session.deinit(allocator); // Sign out try client.signOut(session.access_token); ``` Database Operations The query builder provides a fluent interface for database operations: ```zig // Select with filters var query = try client.from("users") .select("id, name, email") .eq("active", "true") .limit(20); // Insert data const user = JsonValue{ .object = .{ .name = "John Doe", .email = "john@example.com", }}; try client.batchInsert("users", &amp;[_]JsonValue{user}); // Update data try client.batchUpdate("users", &amp;[_]JsonValue{updated_user}); // Delete data try client.batchDelete("users", &amp;[_][]const u8{"user_id_1", "user_id_2"}); ``` Storage Operations ```zig // Initialize storage client var storage = try StorageClient.init(allocator, client, "bucket_name"); defer storage.deinit(); // Upload file try storage.upload("path/to/file.txt", file_data); // Download file const data = try storage.download("path/to/file.txt"); defer allocator.free(data); // List files const files = try storage.list(null); defer { for (files) |*file| file.deinit(allocator); allocator.free(files); } ``` Error Handling The library uses Zig's error union type for robust error handling: <code>zig const result = client.signIn("user@example.com", "password123") catch |err| switch (err) { error.AuthError =&gt; handle_auth_error(), error.NetworkError =&gt; handle_network_error(), error.InvalidCredentialsError =&gt; handle_invalid_credentials(), else =&gt; handle_other_error(), };</code> Memory Management This library follows Zig's memory management principles: <ul> <li>All resources must be explicitly freed using <code>deinit()</code></li> <li>Memory is allocated using the provided allocator</li> <li>No global state or hidden allocations</li> </ul> Contributing Contributions are welcome! Please feel free to submit a Pull Request. License [Add your chosen license here]
[]
https://avatars.githubusercontent.com/u/24832873?v=4
zig-mnist
cernockyd/zig-mnist
2024-09-12T08:53:45Z
trains a MNIST classifier (CPU only)
main
0
3
0
3
https://api.github.com/repos/cernockyd/zig-mnist/tags
-
[ "machine-learning", "mnist", "zig", "zig-program", "ziglang" ]
27
false
2025-03-13T01:07:05Z
true
true
unknown
github
[]
MNIST Neural Classifier from scratch A classifier of MNIST created as subgoal of implementing Rumelhart et al. 1986 paper on backpropagation. Get started get data <code>bash curl -L -o data.zip https://www.kaggle.com/api/v1/datasets/download/oddrationale/mnist-in-csv mkdir data &amp;&amp; tar xf data.zip -C data</code> run <code>bash zig build run -Doptimize=ReleaseFast</code>
[]
https://avatars.githubusercontent.com/u/91746947?v=4
huge_alloc
ozgrakkurt/huge_alloc
2024-10-21T17:05:17Z
Memory allocator for allocating (huge) pages of memory
main
0
3
1
3
https://api.github.com/repos/ozgrakkurt/huge_alloc/tags
Apache-2.0
[ "allocator", "allocators", "data", "database", "datatools", "zig", "ziglang" ]
45
false
2024-11-18T10:11:13Z
true
true
unknown
github
[ { "commit": "master", "name": "zstd", "tar_url": "https://github.com/allyourcodebase/zstd/archive/master.tar.gz", "type": "remote", "url": "https://github.com/allyourcodebase/zstd" } ]
huge_alloc Memory allocator for allocating (huge) pages of memory. This is a library that provides two allocators: - HugePageAlloc is designed to minimize page faults and TLB cache misses. - BumpAlloc is a simple bump allocator that can be used to group allocations together and to optionally impose an allocation budget. Use case Intended use case is to create an HugePageAlloc per thread in a thread-per-core application to be used as the base allocator. Then create BumpAlloc instances per operation to limit memory usage, group small allocations together and reduce alloc/free call overhead. Benchmarks This repository has some benchmarks that can be run with <code>make run_bench</code>. The benchmark allocates some arrays and fills them with random numbers. Then compresses/decompresses these arrays and does some vertical and horizontal summation on them. This is intended to simulate some workload like loading some columnar data (like Apache Arrow) from some files (like Parquet) from disk, decompressing them then doing some light computation. The goal of this library is to minimize page faults and benchmarks demonstrate that it does. Example result with ~8GB memory budget and randomly sized individual buffer allocations. | allocator | user_time | system_time | wall_time | page_faults | voluntary context switches | involuntary context switches | | --------- | --------- | ----------- | --------- | ----------- | -------------------------- | ---------------------------- | | HugeAlloc + BumpAlloc | 180.27 | 1.36 | 0:16.13 | 8233 | 372 | 10022 | | HugeAlloc (1GB Huge Pages) + BumpAlloc | 174.96 | 1.51 | 0:16.38 | 3216 | 2818 | 27215 | | std.heap.page_allocator + std.heap.ArenaAllocator | 177.80 | 82.90 | 0:22.65 | 403162 | 3002 | 11303 | | std.heap.GeneralPurposeAllocator + std.heap.ArenaAllocator | 181.99 | 82.80 | 0:22.59 | 407992 | 97 | 22968 | License Licensed under either of <ul> <li>Apache License, Version 2.0 (<a>LICENSE-APACHE</a> or http://www.apache.org/licenses/LICENSE-2.0)</li> <li>MIT license (<a>LICENSE-MIT</a> or http://opensource.org/licenses/MIT)</li> </ul> at your option. Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
[ "https://github.com/ozgrakkurt/filterz" ]
https://avatars.githubusercontent.com/u/108661125?v=4
zig-sweeper
Frost-Phoenix/zig-sweeper
2025-01-28T21:19:30Z
Minesweeper in zig using raylib
main
0
3
0
3
https://api.github.com/repos/Frost-Phoenix/zig-sweeper/tags
MIT
[ "game", "minesweeper", "raylib", "raylib-zig", "zig" ]
142
false
2025-05-01T18:24:33Z
true
true
unknown
github
[ { "commit": "master", "name": "raylib-zig", "tar_url": "https://github.com/Not-Nik/raylib-zig/archive/master.tar.gz", "type": "remote", "url": "https://github.com/Not-Nik/raylib-zig" } ]
Zig-sweeper A Windows XP inspired Minesweeper game in Zig, using Raylib for graphics. Features <ul> <li>All 3 classic minesweeper modes:<ul> <li>beginner: 9x9 with 10 bombs</li> <li>intermediate: 16x16 with 40 bombs</li> <li>expert: 30x16 with 99 bombs</li> </ul> </li> <li>Custom grid.</li> <li>Scalable window.</li> <li>Custom camera that allows zooming into the grid.</li> <li>Clicking on cells with the correct number of flags will open surrounding cells.</li> </ul> Building You will need Zig version <code>0.13.0</code> to compile this project. <code>bash zig build</code> The compiled program will be in <code>./zig-out/bin/zig-sweeper</code>. Nix Try it out directly! <code>bash nix run 'github:frost-phoenix/zig-sweeper' -- --help</code> Or install it in your flake <ul> <li>First you need to import it in your flake inputs ```nix</li> </ul> flake.nix { inputs = { zig-sweeper.url = "github:frost-phoenix/zig-sweeper"; # ... }; # ... } ``` <ul> <li>Then, you can add it to your pkgs list <code>nix { inputs, ... }: { home.packages = [ inputs.zig-sweeper.packages.${system}.default # ... ]; # ... }</code></li> </ul> Usage You can run it directly using the following command: <code>bash zig build run -- --help</code> If you use this method, all arguments you pass to the program must be placed after <code>--</code>. ``` Usage: zig-sweeper [difficulty] [custom_grid_options] [options] Difficulties: beginner 9x9 with 10 bombs intermediate 16x16 with 40 bombs expert 30x16 with 99 bombs custom Custom grid options: between 5 and 115 between 5 and 70 must be less than nb_cols * nb_rows General Options: -s, --scale Set window scale (default 2, max 5) -h, --help Print this help message and exit Keybinds: Quit Generate new grid Open all cells Reset grid zoom and position Mouse: left click Open cell right click Flag cell middle click Drag grid when zoomed in wheel scroll Zoom grid in/out ``` Screenshots | | | |:-------------------------:|:-------------------------:| | beginner | intermediate | expert TODO See <a>TODO.md</a>. Acknowledgments A huge thanks to: <ul> <li><a>Not-Nik</a>, who made the incredible <a>raylib-zig</a> bindings.</li> <li><a>Cloudef</a>, who created the amazing <a>zig2nix</a> tool and was super helpful in getting it working.</li> </ul> License See <a>LICENSE</a>
[]
https://avatars.githubusercontent.com/u/190158618?v=4
multiformats-zig
zen-eth/multiformats-zig
2024-11-30T04:53:13Z
Zig implementation of the multiformats https://github.com/multiformats/multiformats.
main
3
3
1
3
https://api.github.com/repos/zen-eth/multiformats-zig/tags
MIT
[ "cid", "multiaddr", "multiaddress", "multibase", "multicodec", "multiformats", "multihash", "zig" ]
1,788
false
2025-05-16T11:46:44Z
true
true
0.11.0
github
[]
<a></a> Multiformats zig This is the zig implementation of the multiformats <a>spec</a>. Build <code>bash git clone --recurse-submodules git@github.com:zen-eth/multiformats-zig.git cd multiformats-zig zig build test --summary all</code> Generate the code <code>bash zig build-exe src/generate.zig ./generate</code> Add to your project <code>bash zig fetch --save https://github.com/zen-eth/multiformats-zig/archive/main.tar.gz</code> Usage <code>zig const multiformats = @import("multiformats-zig");</code> Benchmark <code>bash git clone --recurse-submodules git@github.com:zen-eth/multiformats-zig.git cd multiformats-zig zig build bench --release=fast -Dcode=7</code> tip: The <code>code</code> parameter in the command can refer to the declaration in the <code>MultiBaseCodec.fromCode()</code> in the source file <code>src/multibase.zig</code>. License MIT
[]
https://avatars.githubusercontent.com/u/179144860?v=4
jwt.zig
furpu/jwt.zig
2024-08-28T22:49:57Z
Zig JSON Web Token package.
main
4
3
0
3
https://api.github.com/repos/furpu/jwt.zig/tags
MIT
[ "jsonwebtoken", "jwt", "zig", "zig-library", "zig-package" ]
43
false
2025-01-21T00:43:35Z
true
true
0.14.0-dev.1232+61919fe63
github
[ { "commit": "4297ee5c845a8486191806fa102302695d3ff941", "name": "cricket", "tar_url": "https://github.com/furpu/cricket.zig/archive/4297ee5c845a8486191806fa102302695d3ff941.tar.gz", "type": "remote", "url": "https://github.com/furpu/cricket.zig" } ]
jwt.zig Zig implementation of JSON Web Tokens (<a>RFC 7519</a>). Claims Claim verification is not implemented yet. Future work includes adding features to verify <code>aud</code>, <code>exp</code>, <code>iat</code> and <code>nbf</code> claims as described in <a>Section 4</a> of the RFC. Algorithms | Supported | alg Parameter | Description | |:---------:|---------------|-------------| | ✅ | none | No digital signature or MAC value included | | ✅ | HS256 | HMAC using SHA-256 hash algorithm | | ✅ | HS384 | HMAC using SHA-384 hash algorithm | | ✅ | HS512 | HMAC using SHA-512 hash algorithm | | ✅ | ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm | | ✅ | ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm | | ❌ | ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm | | ❌ | PS256 | RSASSA-PSS using SHA-256 hash algorithm | | ❌ | PS384 | RSASSA-PSS using SHA-384 hash algorithm | | ❌ | PS512 | RSASSA-PSS using SHA-512 hash algorithm | | ❌ | RS256 | RSASSA-PKCS1-v1_5 using SHA-256 hash algorithm | | ❌ | RS384 | RSASSA-PKCS1-v1_5 using SHA-384 hash algorithm | | ❌ | RS512 | RSASSA-PKCS1-v1_5 using SHA-512 hash algorithm |
[]
https://avatars.githubusercontent.com/u/46653655?v=4
zlog
BitlyTwiser/zlog
2024-08-11T16:15:59Z
A personal blog for the lazy, written purely in zig and html
main
0
3
0
3
https://api.github.com/repos/BitlyTwiser/zlog/tags
-
[ "blog-engine", "static-site-generator", "zig", "ziglang" ]
45
false
2025-03-24T06:31:04Z
true
true
unknown
github
[ { "commit": "v0.8.0.tar.gz", "name": "zap", "tar_url": "https://github.com/zigzap/zap/archive/v0.8.0.tar.gz.tar.gz", "type": "remote", "url": "https://github.com/zigzap/zap" }, { "commit": "0151bb37714d93688f31e3d7a3d0369106818f26.tar.gz", "name": "koino", "tar_url": "https://git...
zlog A personal blog for the lazy, written purely in Zig, Markdown, and HTML See it in action: https://bitlytwiser.com Goals: The goal of this project is a small, simple blog written purely in zig, markdown, and some HTML using some type of static site generation tool. There are certainly <em>much</em> better ways to perform a blog, but this was my take on it and having some fun with Zig and Zap :) Build: Adjustments: You can adjust the base CSS html/styles.css to fit your needs and the 404 page to be what you wish. Otherwise, the code will generate the rest based on the data in the <code>posts</code> folder. All you must do is add a post and the rest will be created for you :) Notes/Usage: <ol> <li>Home/Contact are standard files. You can change these however you like, but do not remove/rename them. :)</li> <li>Adding new blog posts, you must add the link into the <code>home.md</code> markdown like so:</li> </ol> ``` Articles <ul> <li><a>Post 1: Test</a></li> <li><a>Post 2: Building a Static Site Generator</a></li> <li><a>Post 3: Exploring Rust and Go</a></li> </ul> ``` This is the only step that is not automatic. I figured, perhaps someone does not want articls and blogs, so I stopped auto injecting things into the home to allow for it to be generic. If you hate this, let me know. <ol> <li>Provide the title you wish and then just link the markdown location. Everything will be built in (routes etc..)</li> <li>Restart the webserver and all changes/articles etc.. will be present straight away.</li> </ol> Uniquness: <ol> <li>Change the nav bar and styles.css to customize the site for your needs if you so wish</li> <li>Change the 404.html to be whatever you want (unless you love the totally awesome page that currently exists!)</li> </ol> Bugs: <ul> <li>Using koino to parse the markdown -&gt; HTML. There seems to be a bug if the first line in the markdown is not a space or other text. (i.e.) you cannot have the first line start with a markdown character like # etc.. else it will break rendering.</li> </ul>
[ "https://github.com/malaow3/PokeBin" ]
https://avatars.githubusercontent.com/u/717754?v=4
zig-x86-baremetal
HRuivo/zig-x86-baremetal
2024-09-15T13:45:23Z
Barebones x86 kernel written in Zig.
main
0
3
0
3
https://api.github.com/repos/HRuivo/zig-x86-baremetal/tags
MIT
[ "baremetal", "freestanding", "zig" ]
6
false
2024-12-07T06:29:09Z
true
false
unknown
github
[]
zig-x86-baremetal Barebones x86 kernel written in <a>Zig</a> with a custom build system to run in Qemu. Heavily based on the amazing Austin Hanson article. <a>Bare Metal Zig</a> Zig Version <code>zig 0.14.0</code> Build and run To build the kernel: <code>zig build-exe src/freestanding.zig -target x86-freestanding -T linker.ld</code> You can run the kernel with Qemu: <code>qemu-system-x86_64 -kernel kernel</code>
[]
https://avatars.githubusercontent.com/u/123812634?v=4
wyhash
NikoMalik/wyhash
2025-01-29T22:04:23Z
wyhash implementation in zig
main
0
3
0
3
https://api.github.com/repos/NikoMalik/wyhash/tags
MIT
[ "wyhash", "zig", "zig-lib", "zig-package", "zig-wyhash", "ziglang" ]
8
false
2025-03-10T21:25:13Z
true
true
unknown
github
[]
WYHASH - Zig Implementation 🚀 Overview Wyhash is a fast, high-quality, portable non-cryptographic hash function known for its exceptional speed and randomness quality. This repository provides a native Zig implementation of Wyhash.Project is also open for people to add to and improve. Please check the issues to view requested features Why Wyhash? <ul> <li>✅ Extremely fast performance across different architectures</li> <li>✅ High-quality randomness and strong avalanche effect</li> <li>✅ Minimal code size and efficient memory usage</li> <li>✅ Used in databases, networking, and high-performance applications</li> </ul> 🛠 Basic Usage ```zig const wyhash = @import("wyhash"); const std = @import("std"); pub fn main() !void { const r: u64 = 0x001020120; <code>const res = wyhash._whash("🔥Hello World!", r); std.debug.print("wyhash(\"🔥Hello World!\", {}) = {}\n", .{ r, res }); </code> } ``` 📦 Installation <em>Add this to your build.zig.zon</em> ```zig .dependencies = .{ .wyhash = .{ .url = "https://github.com/NikoMalik/wyhash/archive/refs/heads/main.tar.gz", //the correct hash will be suggested by zig } } ``` <em>And add this to you build.zig</em> ```zig const wyhash = b.dependency("wyhash", .{ .target = target, .optimize = optimize, }); exe_mod.addImport("wyhash", wyhash.module("wyhash")); ``` You can then import the library into your code like this <code>zig const wyhash = @import("wyhash")</code> 📦 Installation/2 ```bash git clone https://github.com/NikoMalik/wyhash.git mv wyhash /path/to/your/project/directory ``` 🔥 Benchmarks Wyhash is one of the fastest hash functions available. Benchmarks against MurmurHash3, XXHash, and CityHash show superior performance in most cases. 👥 Credits Original Wyhash: Wang Yi Repo: https://github.com/wangyi-fudan/wyhash
[]
https://avatars.githubusercontent.com/u/9116281?v=4
syslog
g41797/syslog
2024-10-07T15:30:47Z
Zig syslog client
main
0
3
0
3
https://api.github.com/repos/g41797/syslog/tags
MIT
[ "rfc5424", "syslog", "syslog-client", "tcp", "udp", "zig", "zig-library", "zig-package" ]
408
false
2025-01-30T00:19:37Z
true
true
unknown
github
[ { "commit": "master.tar.gz", "name": "mailbox", "tar_url": "https://github.com/g41797/mailbox/archive/master.tar.gz.tar.gz", "type": "remote", "url": "https://github.com/g41797/mailbox" }, { "commit": "805ce63eec48373ec497542f18f19d7c484b9b2e", "name": "network", "tar_url": "http...
Zig syslog client [![CI](https://github.com/g41797/syslog/actions/workflows/ci.yml/badge.svg)](https://github.com/g41797/syslog/actions/workflows/ci.yml)[![Wiki](https://img.shields.io/badge/Wikipedia-%23000000.svg?style=for-the-badge&amp;logo=wikipedia&amp;logoColor=white)](https://en.wikipedia.org/wiki/Syslog) &nbsp; &nbsp; &nbsp; This is a <a>syslog</a> client library for Zig: | | | |-----------|:------------------------------------------------------------------:| | Protocols | UDP, TCP | | RFC | Subset of <a>RFC5424</a> | | Tested on | Mac, Windows, Linux | For the curious: <a>IT Explained: Syslog</a> Hello, Zig! When client code calls <code>zig logger.write_info("Hello, Zig!");</code> <a>syslog client</a> sends following text message to syslog receiver process: <blockquote> &lt;190&gt;1 2024-10-09T09:07:11+00:00 BLKF zigprocess 18548 1 - Hello, Zig! </blockquote> Let's see what this message consist of: | Value | RFC Definition | Description | |:-----------:|:---------------:|:-------------------------------------------------------| | 190 | PRIVAL | <a>Priority</a> | | 1 | VERSION | Always 1 | | 2024-10-09T09:07:11+00:00 | TIMESTAMP | FULL-DATE "T" FULL-TIME | | BLKF | HOSTNAME | Hostname or '-' | | zigprocess | APP-NAME | Application name provided by caller | | 18548 | PROCID | Process ID or '-' | | 1 | MSGID | Message ID - sequential number generated automatically | | - | STRUCTURED-DATA | Always '-' | | Hello, Zig! | MSG | Message | Priority <blockquote> <code> Priority = Facility * 8 + Severity </code> </blockquote> <strong>Facility</strong> represents the machine process that created the Syslog event | rfc5424.Facility | Value | Description | |:----------------------| :---: | :--- | | .kern | 0 | kernel messages | | .user | 1 | random user-level messages | | .mail | 2 | mail system | | .daemon | 3 | system daemons | | .auth | 4 | security/authorization messages | | .syslog | 5 | messages generated internally by syslogd | | .lpr | 6 | line printer subsystem | | .news | 7 | network news subsystem | | .uucp | 8 | UUCP subsystem | | .cron | 9 | clock daemon | | .authpriv | 10 | security/authorization messages (private) | | .ftp | 11 | ftp daemon | | .local0 | 16 | local use 0 | | .local1 | 17 | local use 1 | | .local2 | 18 | local use 2 | | .local3 | 19 | local use 3 | | .local4 | 20 | local use 4 | | .local5 | 21 | local use 5 | | .local6 | 22 | local use 6 | | .local7 | 23 | local use 7 | <strong>Severity</strong> describes the severity level of the syslog message in question. | Level | rfc5424.Severity | Description | | :---: |:-----------------| :--- | |0| .emerg | system is unusable | |1| .alert | action must be taken immediately | |2| .crit | critical conditions | |3| .err | error conditions | |4| .warning | warning conditions | |5| .notice | normal but significant condition | |6| .info | informational | |7| .debug | debug-level messages | Quiz What are <em>Facility</em> and <em>Severity</em> of <strong>"Hello, Zig!"</strong> message? For leisure time <ul> <li><a>What is Syslog?</a></li> <li><a>syslog-ng Open Source Edition</a></li> <li><a>The rocket-fast system for log processing</a></li> <li><a>Old brave syslogd</a></li> <li><a>Kafka syslog connector</a></li> <li><a>Nats syslog connector</a></li> </ul> Installation Add <em>syslog</em> to build.zig.zon: <code>bach zig fetch --save=syslog git+https://github.com/g41797/syslog</code> Add <em>syslog</em> to build.zig: ```zig const syslog = b.dependency("syslog", .{ .target = target, .optimize = optimize, }); <code>const lib = b.addStaticLibrary(..); lib.root_module.addImport("syslog", syslog.module("syslog")); const lib_unit_tests = b.addTest(...); lib_unit_tests.root_module.addImport("syslog", syslog.module("syslog")); </code> ``` Import <em>syslog</em>: <code>zig const syslog = @import("syslog");</code> Usage Configuration syslog uses following configuration: ```zig pub const SyslogOpts = struct { // application: name: []const u8 = "zigprocess", fcl: rfc5424.Facility = .local7, <code>// transport: proto: Protocol = .udp, addr: []const u8 = "127.0.0.1", port: u16 = 514, </code> }; ``` Initialization <code>zig var logger: syslog.Syslog = .{}; try logger.init(std.testing.allocator, .{ .name = "runner", .fcl = .daemon .port = 12345, }); defer logger.deinit();</code> After initialization you can call syslog on different threads. Logging There are two groups of APIs: - write: message is straight text <code>zig pub inline fn write_&lt;severity&gt;(slog: *Syslog, msg: []const u8) !void {...} .... logger.write_debug("Hello, Zig!");</code> - print: message will be formatted before send <code>zig pub inline fn print_&lt;severity&gt;(slog: *Syslog, comptime fmt: []const u8, msg: anytype) !void {...} .... const name = "World"; logger.print_debug("Hello, {s}!", .{name});</code> Filtering Set filter: <code>zig // disable send messages with .info &amp; .debug severities logger.setfilter(.info);// disable send messages with .info &amp; .debug severities</code> Reset filter: <code>zig logger.setfilter(null);</code> License <a>MIT</a>
[]
https://avatars.githubusercontent.com/u/40296771?v=4
jzvm
pprettysimpple/jzvm
2024-10-14T06:33:49Z
JVM Implementation in Zig
master
0
3
0
3
https://api.github.com/repos/pprettysimpple/jzvm/tags
GPL-3.0
[ "jvm", "pet-project", "zig" ]
107
false
2025-04-19T15:42:00Z
true
true
unknown
github
[]
JVM Implementation in Zig This is a pet project that implements a JVM (Java Virtual Machine) in Zig. It is not guaranteed to work and is under active development. Use at your own risk. Project Overview Class Loader The class loader provides "raw" class files with minimal resolution of constant pool fields. It acts as a simple parser that converts Java .class files into a machine-readable structure. The loader does not perform extensive linking or initialization; it simply makes the class file available for use by the runtime. Decoder The decoder is responsible for decoding individual JVM bytecode instructions. It converts raw bytes into a structured format that is easier to work with for the interpreter. This abstraction simplifies the process of handling JVM instructions during execution. Interpreter The interpreter is the core of the JVM. It describes how each JVM instruction is executed and manages the call stack. Currently, the interpreter is single-threaded, though it is meant to be thread-local in the future once threading support is implemented. Driver The driver represents the entire state of the JVM. It manages both the class loader and the interpreter. The interpreter communicates with the driver to resolve classes and manage execution flow. String Handling The string.zig file is a placeholder for what will eventually become the string pool. For now, it contains a single function responsible for creating java.lang.String objects from UTF-8 byte slices (and idk if I'm doing this in correct way). Runtime Entities (<code>rt</code>) The rt (runtime) folder contains entities that exist at runtime: <ul> <li>Class: A runtime representation of a Java class. It owns the raw class file data.</li> <li>Object: A runtime object, currently holding fields only. In the future, it will support monitors and other JVM object-related features.</li> <li>Array: A runtime representation of Java arrays, distinct from the Class entity.</li> <li>Heap: A global (or rather thread-local) memory allocator and reference-counting system for managing objects and arrays.</li> </ul> Common Structures The common.zig file defines important types used across the JVM, such as Ty, Value, and TyValue: <ul> <li>Ty: An enum representing the type of any JVM value.</li> <li>Value: An untagged union used for the operand stack and other places where JVM values are stored.</li> <li>TyValue: A pair of type (Ty) and value (Value), used in places where both the type and value of an operand need to be known explicitly.</li> </ul> Reference Counting The JVM uses a combination of BitStack (for operand stacks) and DynamicBitSet (for local variables) to track whether values are reference-counted. If a value is reference-counted, the reference count is decremented when it is removed from the stack or local variables. Same happens inside of Object and Array. Future Plans This goes in order: - Function calls - Exceptions support (better do it quicker, while I can) - More opcodes - Native method calls (and JNI) - Threads Build and Run <blockquote> Requirements: For now, only the hardcoded absolute paths will be scanned for this class name. Add your one to main.zig. </blockquote> To build the project, ensure you have Zig (version 0.13.0) installed, then run: <code>bash zig build</code> To execute a Java class using the JVM: <code>bash zig build -Doptimize=ReleaseSafe run -- name/of/the/Class</code> Contribution This is a personal project and is not guaranteed to be stable or complete. Contributions are welcome, but please be aware of its experimental nature.
[]
https://avatars.githubusercontent.com/u/598416?v=4
wggr
marionauta/wggr
2024-10-23T21:58:12Z
Funtions to draw colors, rectangles, sprites and text onto a CGContext.
main
0
3
0
3
https://api.github.com/repos/marionauta/wggr/tags
MIT
[ "coregraphics", "graphics-programming", "raylib", "zig" ]
43
false
2025-01-14T17:46:31Z
true
true
unknown
github
[]
wggr <em>(pronounced wagger) — <strong>W</strong>atch <strong>G</strong>ame <strong>GR</strong>aphics</em> A set of functions to ease drawing colors, rectangles, sprites and text onto a <a><code>CGContext</code></a>. This library contains bindings to some of Apple's Core Graphics framework functions. This library also contains easier to use functions that match the <a><code>raylib</code></a> API. This library is not intended to be a replacement of either Core Graphics nor raylib.
[]
https://avatars.githubusercontent.com/u/146390816?v=4
tracy
allyourcodebase/tracy
2024-12-18T20:56:55Z
Tracy ported to the zig build system
master
0
3
2
3
https://api.github.com/repos/allyourcodebase/tracy/tags
NOASSERTION
[ "zig", "zig-package" ]
28,467
true
2025-05-21T22:23:09Z
true
true
0.14.0
github
[ { "commit": "master", "name": "wayland", "tar_url": "https://github.com/allyourcodebase/wayland/archive/master.tar.gz", "type": "remote", "url": "https://github.com/allyourcodebase/wayland" }, { "commit": null, "name": "wayland_protocols", "tar_url": null, "type": "remote", ...
<a></a> Tracy Profiler This is <a>Tracy</a>, packaged for <a>Zig</a>. Installation Install Zig 0.14.0 and then run the following command: <code>bash zig build install-profiler ./zig-out/bin/tracy-profiler</code> You can also directly run the Tracy Profiler with the "run" step: <code>bash zig build run</code> System Dependencies Most systems will already have the necessary dependencies installed by default. Client <ul> <li><code>ws2_32</code> (windows)</li> <li><code>dbghelp</code> (windows)</li> <li><code>advapi32</code> (windows)</li> <li><code>user32</code> (windows)</li> <li><code>execinfo</code> (freeBSD)</li> </ul> Profiler &amp; Other Tools <ul> <li><code>ws2_32</code> (windows)</li> <li><code>dbghelp</code> (windows, tracy-update only)</li> <li><code>ole32</code> (windows)</li> <li><code>uuid</code> (windows)</li> <li><code>shell32</code> (windows)</li> <li><code>AppKit</code> (macOS)</li> <li><code>UniformTypeIdentifiers</code> (macOS)</li> <li><code>libGL</code> (linux)</li> <li><code>libEGL</code> (linux, not required when using <code>-Dlegacy</code>)</li> <li><code>libxkbcommon</code> (linux, not required when using <code>-Dlegacy</code>)</li> <li><code>libdbus-1</code> (linux, can be disabled with <code>-Dno-fileselector</code> or <code>-Dportal=false</code>)</li> <li><code>libgtk+-3.0</code> (linux, only required when using <code>-Dportal=false</code>)</li> </ul> System Integrations Tracy has been ported with support for Zig's <a>System Integration Options</a>. Cross Compilation Windows Cross compiling to windows works out of the box. It can even connect to a client that is running a different host (Linux). <code>bash zig build -Dtarget=x86_64-windows zig build run -Dtarget=x86_64-windows -fwine # run the tracy profiler with Wine</code> MacOS Cross compiling to macos can successfully produce a binary. Whether it is functional has not been tested. <code>bash zig build -Dtarget=aarch64-macos -Dno-fileselector file zig-out/bin/tracy-profiler</code> Linux Cross compiling to Linux is currently not possible because of the dependency on <code>libGL</code> and <code>libEGL</code>.
[ "https://github.com/Games-by-Mason/ZCS", "https://github.com/Games-by-Mason/tracy_zig", "https://github.com/Marco-Christiani/zigrad", "https://github.com/kristoff-it/superhtml", "https://github.com/kristoff-it/zine", "https://github.com/leecannon/zig-coreutils", "https://github.com/llogick/zigscient", ...
https://avatars.githubusercontent.com/u/3088277?v=4
ChibiHash-zig
thevilledev/ChibiHash-zig
2024-11-27T21:33:50Z
ChibiHash in Zig - a small, fast 64-bit hash function
main
0
3
0
3
https://api.github.com/repos/thevilledev/ChibiHash-zig/tags
MIT
[ "hash-functions", "zig", "zig-package" ]
12
false
2025-03-11T19:47:52Z
true
false
unknown
github
[]
ChibiHash64-Zig A Zig port of <a>ChibiHash64</a> - a small, fast 64-bit hash function. See the article <a>ChibiHash: A small, fast 64-bit hash function</a> for more information. All credit for the algorithm goes to <a>N-R-K</a>. Features <ul> <li>Simple 64-bit hash function</li> <li>Supports both v1 and v2 of the hash function</li> <li>HashMap implementation</li> <li>Thoroughly tested with known test vectors</li> </ul> Usage ``` const std = @import("std"); const ChibiHash64v1 = @import("chibihash64_v1.zig"); const ChibiHash64v2 = @import("chibihash64_v2.zig"); // Basic hashing v1 const hash = ChibiHash64v1.hash("Hello, world!", 0); // Using HashMap v1 var map = ChibiHash64v1.HashMap([]const u8, i32).init(allocator); defer map.deinit(); // Basic hashing v2 const hash = ChibiHash64v2.hash("Hello, world!", 0); // Using HashMap v2 var map = ChibiHash64v2.HashMap([]const u8, i32).init(allocator); defer map.deinit(); ``` See <code>example/example.zig</code> for a complete example. Run it with <code>zig build run-example</code>. License MIT.
[]
https://avatars.githubusercontent.com/u/24779436?v=4
jaime
egegungordu/jaime
2025-01-04T00:06:30Z
A fast, lightweight Japanese IME engine for Zig projects that converts romaji to hiragana, kanji, and full-width characters. Supports Google 日本語入力-style input patterns with an easy-to-use API.
main
4
3
0
3
https://api.github.com/repos/egegungordu/jaime/tags
MIT
[ "hiragana", "ime", "input-method-engine", "kanji", "romaji", "text-conversion", "transliteration", "zig" ]
18,215
false
2025-05-15T06:53:24Z
true
true
0.13.0
github
[]
Jaime A headless Japanese IME (Input Method Editor) engine for Zig projects that provides: <ul> <li>Romaji to hiragana/katakana conversion</li> </ul> eiennni → えいえんに <ul> <li>Full-width character conversion</li> </ul> abc123 → abc123 <ul> <li>Dictionary-based word conversion</li> </ul> かんじ → 漢字 <ul> <li>Built-in cursor and buffer management</li> </ul> Based on Google 日本語入力 behavior. On the **terminal** with libvaxis [View repository](https://github.com/egegungordu/ja-ime-terminal-demo) On the **web** with webassembly [Online demo](https://jaime-wasm.pages.dev/) Zig Version The minimum Zig version required is 0.13.0. Licensing Information This project includes the <strong>IPADIC dictionary</strong>, which is provided under the license terms stated in the accompanying <code>COPYING</code> file. The IPADIC license imposes additional restrictions and requirements on its usage and redistribution. If your application cannot comply with the terms of the IPADIC license, consider using the <code>ime_core</code> module with a custom dictionary implementation instead. Integrating jaime into your Zig Project You can add jaime as a dependency in your <code>build.zig.zon</code> file in two ways: Development Version ```bash Get the latest development version from main branch zig fetch --save git+https://github.com/egegungordu/jaime ``` Release Version ```bash Get a specific release version (replace x.y.z with desired version) zig fetch --save https://github.com/egegungordu/jaime/archive/refs/tags/vx.y.z.tar.gz ``` Then instantiate the dependency in your <code>build.zig</code>: <code>zig const jaime = b.dependency("jaime", .{}); exe.root_module.addImport("kana", jaime.module("kana")); // For simple kana conversion exe.root_module.addImport("ime_core", jaime.module("ime_core")); // For IME without dictionary exe.root_module.addImport("ime_ipadic", jaime.module("ime_ipadic")); // For IME with IPADIC dictionary</code> Usage The library provides three modules for different use cases: 1. Kana Module - Simple Conversions For simple romaji to hiragana conversions without IME functionality: ```zig const kana = @import("kana"); // Using a provided buffer (no allocations) var buf: [100]u8 = undefined; const result = try kana.convertBuf(&amp;buf, "konnnichiha"); try std.testing.expectEqualStrings("こんにちは", result); // Using an allocator (returns owned slice) const result2 = try kana.convert(allocator, "konnnichiha"); defer allocator.free(result2); try std.testing.expectEqualStrings("こんにちは", result2); ``` 2. IME IPADIC Module - Full Featured IME For applications that want to use the full-featured IME with the IPADIC dictionary: ```zig const ime_ipadic = @import("ime_ipadic"); // Using owned buffer (with allocator) var ime = ime_ipadic.Ime(.owned).init(allocator); defer ime.deinit(); // Using borrowed buffer (fixed size, no allocations) var buf: [100]u8 = undefined; var ime = ime_ipadic.Ime(.borrowed).init(&amp;buf); // Common IME operations const result = try ime.insert("k"); const result2 = try ime.insert("o"); const result3 = try ime.insert("n"); try std.testing.expectEqualStrings("こん", ime.input.buf.items()); // Dictionary Matches if (ime.getMatches()) |matches| { // Get suggested conversions from the dictionary // Returns []WordEntry containing possible word matches } try ime.applyMatch(); // Apply the best dictionary match to the current input // Cursor Movement and Editing ime.moveCursorBack(1); // Move cursor left n positions ime.moveCursorForward(1);// Move cursor right n positions try ime.insert("y"); // Insert at cursor position ime.clear(); // Clear the input buffer try ime.deleteBack(); // Delete one character before cursor try ime.deleteForward(); // Delete one character after cursor ``` <blockquote> <span class="bg-yellow-100 text-yellow-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-yellow-900 dark:text-yellow-300">WARNING</span> The IPADIC dictionary is subject to its own license terms. If you need to use a different dictionary or want to avoid IPADIC's license requirements, use the <code>ime_core</code> module with your own dictionary implementation. </blockquote> 3. IME Core Module - Custom Dictionary For applications that want to use IME functionality with their own dictionary implementation: ```zig const ime_core = @import("ime_core"); // Create your own dictionary loader that implements the required interface const MyDictLoader = struct { pub fn loadDictionary(allocator: std.mem.Allocator) !Dictionary { // Your dictionary loading logic here } <code>pub fn freeDictionary(dict: *Dictionary) void { // Your dictionary cleanup logic here } </code> }; // Use the IME with your custom dictionary var ime = ime_core.Ime(MyDictLoader).init(allocator); defer ime.deinit(); ``` WebAssembly Bindings For web applications, you can build the WebAssembly bindings: ```bash Build the WebAssembly library zig build ``` The WebAssembly library uses the IPADIC dictionary by default. For a complete example of how to use the WebAssembly bindings in a web application, check out the <a>web example</a>. The WebAssembly library provides the following functions: ```javascript // Initialize the IME init(); // Get pointer to input buffer for writing input text getInputBufferPointer(); // Insert text at current position // length: number of bytes to read from input buffer insert(length); // Get information about the last insertion getDeletedCodepoints(); // Number of codepoints deleted getInsertedTextLength(); // Length of inserted text in bytes getInsertedTextPointer(); // Pointer to inserted text // Cursor movement and editing deleteBack(); // Delete character before cursor deleteForward(); // Delete character after cursor moveCursorBack(n); // Move cursor back n positions moveCursorForward(n); // Move cursor forward n positions ``` Example usage in JavaScript: ```javascript // Initialize init(); // Get input buffer const inputPtr = getInputBufferPointer(); const inputBuffer = new Uint8Array(memory.buffer, inputPtr, 64); // Write and insert characters one by one const text = "ka"; for (const char of text) { // Write single character to buffer const bytes = new TextEncoder().encode(char); inputBuffer.set(bytes); // Insert and get result insert(bytes.length); // Get the inserted text const insertedLength = getInsertedTextLength(); const insertedPtr = getInsertedTextPointer(); const insertedText = new TextDecoder().decode( new Uint8Array(memory.buffer, insertedPtr, insertedLength) ); // Check if any characters were deleted const deletedCount = getDeletedCodepoints(); console.log({ inserted: insertedText, deleted: deletedCount, }); } // Final result is "か" ``` Testing To run the test suite: <code>bash zig build test --summary all</code> Features <ul> <li>Romaji to hiragana/full-width character conversion based on Google 日本語入力 mapping</li> <li>Basic hiragana (あ、い、う、え、お、か、き、く...)<ul> <li>a -&gt; あ</li> <li>ka -&gt; か</li> </ul> </li> <li>Small hiragana (ゃ、ゅ、ょ...)<ul> <li>xya -&gt; や</li> <li>li -&gt; ぃ</li> </ul> </li> <li>Sokuon (っ)<ul> <li>tte -&gt; って</li> </ul> </li> <li>Full-width characters<ul> <li>k -&gt; k</li> <li>1 -&gt; 1</li> </ul> </li> <li>Punctuation<ul> <li>. -&gt; 。</li> <li>? -&gt; ?</li> <li>[ -&gt; 「</li> </ul> </li> </ul> Contributing Contributions are welcome! Please feel free to open an issue or submit a Pull Request. Acknowledgments <ul> <li>Based on <a>Google 日本語入力</a> transliteration mappings</li> <li><a>mozc</a> - Google's open source Japanese Input Method Editor, which provided valuable insights for IME implementation</li> <li>The following projects were used as a reference for the codebase structure:</li> <li><a>chipz - 8-bit emulator in zig</a></li> <li><a>zg - Unicode text processing for zig</a></li> </ul> Further Reading &amp; References For those interested in the data structures and algorithms used in this project, or looking to implement similar functionality, the following academic papers provide excellent background: <ul> <li><a>Efficient dictionary and language model compression for input method editors</a> - Describes techniques for compressing IME dictionaries while maintaining fast lookup times</li> <li><a>Space-efficient static trees and graphs</a> - Introduces fundamental succinct data structure techniques that enable near-optimal space usage while supporting fast operations</li> <li><a>最小コスト法に基づく形態素解析における CPU キャッシュの効率化</a> - Discusses CPU cache optimization techniques for morphological analysis using minimum-cost methods</li> <li><a>Vibrato</a> - Viterbi-based accelerated tokenizer</li> <li><a>Vaporetto: 点予測法に基づく高速な日本語トークナイザ</a> - Presents a fast tokenization approach using linear classification and point prediction methods and three novel score preprocessing techniques</li> <li><a>Vaporetto</a> - Implementation of the pointwise prediction tokenizer described in the paper above</li> </ul>
[]
https://avatars.githubusercontent.com/u/45130910?v=4
neocities-zig
Ratakor/neocities-zig
2024-09-04T17:57:57Z
Zig CLI and API for neocities.org
master
0
3
1
3
https://api.github.com/repos/Ratakor/neocities-zig/tags
ISC
[ "api", "cli", "neocities", "zig" ]
26
false
2025-04-28T04:12:46Z
true
true
0.13.0
github
[]
neocities-zig neocities-zig is a CLI and a library for the <a>Neocities</a> REST <a>API</a>. CLI Installation <a>AUR</a> (Arch Linux) <code>git clone https://aur.archlinux.org/neocities-zig-bin.git cd neocities-zig-bin makepkg -si</code> Manual Installation Grab one of the <a>release</a> according to your system. Zsh completions are available <a>here</a>. Building Requires zig 0.13.0. <code>git clone https://github.com/ratakor/neocities-zig.git cd neocities-zig zig build -Doptimize=ReleaseSafe</code> Configuration Config File When launching <code>neocities</code> for the first time you will be granted with a menu where you can enter your username and password. This will get an api key from neocities and save it in a config file so you won't have to connect again. Environment Variables <ul> <li>NEOCITIES_API_KEY: use this if you don't want a config file.</li> <li>NEOCITIES_USERNAME: only used for setting up the config file.</li> <li>NEOCITIES_PASSWORD: only used for setting up the config file.</li> </ul> Library Installation Add it to an existing project with this command: <code>zig fetch --save https://github.com/ratakor/neocities-zig/archive/master.tar.gz</code> Add the module to build.zig like that: <code>zig const neocities = b.dependency("neocities", .{}); exe.root_module.addImport("Neocities", neocities.module("neocities"));</code> And import it on a file.zig: <code>zig const Neocities = @import("Neocities");</code> Check <a>src/main.zig</a> for a detailed example on how to use the library. CLI Usage ``` Usage: neocities [options] Commands: upload | Upload files to your Neocities website. delete | Delete files from your Neocities website. info | Display information about a Neocities website. list | List files from your Neocities website. key | Display the API key. logout | Remove the API key from the configuration file. help | Display information about a command. version | Display program version. ```
[]
https://avatars.githubusercontent.com/u/46927550?v=4
zig-sqlite
conscious-puppet/zig-sqlite
2025-01-13T15:44:47Z
A toy SQLite implementation in Zig
master
0
3
0
3
https://api.github.com/repos/conscious-puppet/zig-sqlite/tags
-
[ "database", "sqlite", "zig" ]
20
false
2025-03-05T19:28:33Z
true
true
unknown
github
[]
A toy SQLite implementation in Zig Following the <a>Let's Build a Simple Database</a> tutorial to understand the database internals. Notes on Zig: <ul> <li><a>Segmentation Fault from GeneralPurposeAllocator</a></li> <li><a>Allocation is not Initialization</a></li> </ul>
[]
https://avatars.githubusercontent.com/u/184997771?v=4
ectf-osu-2025
OSU-embedded-security-club/ectf-osu-2025
2024-11-11T07:14:36Z
It's ziggin time *procedes to zig all over the place*
main
0
3
0
3
https://api.github.com/repos/OSU-embedded-security-club/ectf-osu-2025/tags
-
[ "ectf", "embedded", "max78000", "zig" ]
3,425
false
2025-04-28T21:30:53Z
false
false
unknown
github
[]
OSU Satellite TV for MITRE eCTF 2025 <a></a> <a></a> <a></a> <a></a> This repo contains all the code and documentation for team <code>scriptohio</code> from The Ohio State University in <a>MITRE's eCTF 2025</a>. Highlights of our design: <ul> <li>🔐 <strong>Strong cryptography</strong></li> <li>💃 The <a>Salsa20</a> stream cipher is used for lightning quick symmetric encryption and decryption</li> <li>🌲 Our <em>binary hash key derivation tree</em> efficiently compresses unique keys per timestamp to create a subscription over a time interval 🕐</li> <li>📝 All frames are signed and verified with <a>Ed25519</a> to ensure decoders only read frames from the encoder they came from</li> <li>⚡ <strong>Written in Zig</strong></li> <li>📦 Expansive standard library which includes everything a programmer might need, from string manipulation to secure cryptography</li> <li>🧪 Unit testing framework built in, allowing for critical sections to have their correctness verified</li> <li>🚫 Memory safety protections against common issues like indexing out of bounds, double free, integer overflows, and more</li> <li>🚧 Build system with incredible interoperability with C code. We still use the MSDK, and there are no HAL rewrites in sight 👀</li> </ul> Layout 🌎 | Icon | Description | | ---- | ---------------------------------------------------------- | | 👥 | Created by our team | | 👔 | Created by MITRE for the competition, and unmodified by us | <ul> <li>👥 <code>benches/</code> - Custom benchmarks to test the speed of the design 🐍</li> <li>👥 <code>decoder/</code> - Firmware for the decoder ⚡</li> <li>👥 <code>design/</code> - Host design including encoder 🐍</li> <li>👥 <code>docs/</code> - Documentation on the system design and security 📖</li> <li>👔 <code>tools/</code> - Host tools to interact with the decoder 🐍</li> <li>👥 <code>Taskfile.yml</code> - Command runner definitions 📄</li> <li>👥 <code>flake.nix</code> - Convenient <a>Nix</a> development environment ❄️</li> </ul> Usage A <a>Taskfile</a> is available to easily run common tasks <code>* 1-gen-secrets: Generate secrets * 2-build-firmware: Build the firmware image * 3-flash: Flash the built firmware image onto the Decoder * 4-gen-subscription: Generate a subscription * 5-subscribe: Take a subscription file and send it to the Decoder * 6-list: Asks the Decoder to list the subscriptions that it currently has * 7-uplink: Encodes sample frames with the custom encoder function and sends them to the satellite * 8-satellite: Broadcasts all frames received from the uplink to all listening TVs on the host computer * 9-tv: Receives encoded frames from the satellite and decodes with a Decoder connected to the host computer * bench-decoder: Benchmark the decoder * bench-encoder: Benchmark the encoder * bench-subscription: Benchmark creating a subscription on the decoder * docs: Build documentation design file into PDF and SVG artifacts * stress-decoder: Use MITRE's stress test to benchmark the decoder * stress-encoder: Use MITRE's stress test to benchmark the encoder</code> On a clean repo, plug in the MAX78000, enter firmware writing mode (the LED should be flashing blue), and run the following command: <code>task 1-gen-secrets 2-build-firmware 3-flash 4-gen-subscription 5-subscribe 6-list</code> Then, iterating on the design is typically done with the following command: <code>task 2-build-firmware 3-flash</code> Documentation 📖 <a></a> The design document is available to read <a>as a PDF</a>, or inline below: View the PDF inline Code Documentation 📖 Our Zig code makes use of documentation comments which can be read as a webpage. To view it, navigate to the <code>decoder</code> directory and run the following <code>$ zig build docs $ python -m http.server -d docs</code> Then navigate to <a>http://localhost:8000</a> in your browser.
[]
https://avatars.githubusercontent.com/u/4930991?v=4
codingbunker-zig-meetup
inge4pres/codingbunker-zig-meetup
2025-01-09T08:41:12Z
Slides and code used for the CodingBunker meetup: "Zig: Cosa, Come e Perche".
main
0
3
0
3
https://api.github.com/repos/inge4pres/codingbunker-zig-meetup/tags
-
[ "software-engineering", "zig" ]
12
false
2025-02-07T08:10:44Z
true
true
unknown
github
[]
Zig: cosa, come e perche <blockquote> <span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span> Contenuto in Italiano 🇮🇹 </blockquote> <a>Evento</a> | <a>Slides</a> Questo progetto usa <a>Zig 0.13</a> Eseguire i tests Per vedere in azione il codice mostrato durante il talk: <code>shell zig build test</code> <code>shell zig test src/syntax.zig zig test src/comptime.zig</code> E' possibile (compilare ed) eseguire tests in isolamento aggiungendo il parametro <code>--test-filter=&lt;test-pattern</code>, esempio: <code>shell zig build test -- "defer"</code> ooppure: <code>shell zig test syntax.zig --test-filter=defer</code> Eseguire la build del progetto <code>shell zig build</code>
[]
https://avatars.githubusercontent.com/u/131738078?v=4
zkinder
TheHonestHare/zkinder
2024-08-16T05:34:00Z
A pattern matching library for zig
main
0
3
0
3
https://api.github.com/repos/TheHonestHare/zkinder/tags
-
[ "zig", "zig-library", "zig-package" ]
32
false
2025-01-20T00:48:19Z
true
true
unknown
github
[]
A library that implements pattern matching in fully userland zig. Tested on zig version 0.14.0-dev.1391+e084c46ed but should probably work on master Code example ```zig const ki = @import("zkinder"); const bind = ki.bind; const __ = ki.__; const thing: struct { age: u32, birth: u64, pos: struct { x: u8, y: u8 } } = .{.age = 3, .birth = 2, .pos = .{.x = 90, .y = 20}}; const m = ki.match(&amp;thing); // bind puts the value of the variable in the result const res = m.arm(.{.age = 3, .birth = bind("hello"), .pos = .{.x = bind("x"), .y = 20}}); try std.testing.expectEqual(2, res.?.hello); try std.testing.expectEqual(90, res.?.x); const res2 = m.arm(.{.age = 3, .birth = bind("hello"), .pos = bind("pos")}); try std.testing.expectEqual(2, res2.?.hello); try std.testing.expectEqual(90, res2.?.pos.x); try std.testing.expectEqual(20, res2.?.pos.y); // this arm doesn't match because age = 2, will return null const res3 = m.arm(.{.age = 2, .birth = bind("hello"), .pos = bind("pos")}); try std.testing.expectEqual(null, res3); // __ will match on anything const res4 = m.arm(.{.age = <strong>, .birth = </strong>, .pos = .{.x = __, .y = bind("y")}}); try std.testing.expectEqual(20, res4.?.y); ``` Current features: <ul> <li>arbitrary nested patterns</li> <li>structs</li> <li>union(enum) (TODO: more testing)</li> <li>enums (TODO: more testing)</li> <li>ints, floats, bools (TODO: more testing)</li> <li>optionals (TODO: more testing)<ul> <li>match on double optionals using <code>nonnull</code></li> </ul> </li> <li>arrays<ul> <li>can even match on a subarray using <code>ref_rest</code> (see "custom array matchers")</li> </ul> </li> <li>single item pointers (patterns match on the child type)</li> <li>slices<ul> <li>support same features as arrays, plus different length patterns</li> </ul> </li> <li><code>matching</code> for no exhaustive checking, single arm</li> <li>extracting values out via <code>bind</code></li> <li>matching aginst anything via <code>__</code></li> <li>matching on integer ranges via <code>range</code></li> <li>extracting values out only if it matches a predicate with <code>bind_if</code></li> <li>support for creating your own match predicates</li> <li>both <code>bind</code> and <code>__</code> use no special casing, you could implement yourself</li> <li>any custom matcher must be of type <code>fn (comptime type) CustomMatcher</code></li> <li>the impl will take in this type, pass in the type it needs to bind to and collect all the needed captures</li> <li>TODO: make like 10x more ergonomic</li> </ul> Planned features: <ul> <li>matching on vectors, others maybe?</li> <li>optimize this so its not just willy nilly checking basically</li> <li>exhaustive patterns (hardmode)</li> <li>unreachable pattern errors (if I feel like it)</li> <li>more helper match predicates such as <code>partial</code>, <code>ref</code>,</li> <li>safety check for ensuring a match only ever matches on one branch</li> </ul> Custom matchers: A custom matcher is any function of the form <code>fn (comptime type) Matcher</code>, where the input is the type it is being matched against. <code>bind(&lt;name&gt;)</code> and <code>__</code> are both custom matchers implementable you could just as easily implement For example, in the pattern, <code>.{.age = 2, .birth = __, .pos = __}</code> <code>__</code> is actually a function which will take the types of <code>thing.birth</code> and <code>thing.pos</code> respectively. <code>Matcher</code> is defined as such: <code>zig pub const Matcher = struct { captures: type, tryBind: fn (self: Matcher, val_ptr: anytype, out_ptr: anytype) bool, };</code> <code>captures</code> is a struct type where each field is an output the matcher produces. This is needed for features like <code>bind</code>. All fields are combined, using comptime, into one giant struct that is returned from the arm. <code>tryBind</code> is where all the magic happens. - <code>self</code> allows you to access the <code>captures</code> field - <code>val_ptr</code> is a pointer to the field being matched against. The fields type will be the same type that was passed into the custom matcher. - <code>out_ptr</code> lets you write to the <code>out</code> of the arm, if you had any captures. For example, <code>out_ptr.hello = 2</code> would write 2 to the <code>hello</code> field of the output. You can only write to fields that were already declared as captures - return <code>true</code> if the value in <code>val_ptr</code> matches whatever criteria you want, or <code>false</code> if not Custom array matchers: These are similar to custom matchers, but they only work in array or slice patterns. <code>ref_rest(&lt;name&gt;)</code> is a custom array matcher. Instead of having to have a pattern for the entire length of the array, you can match over part of it. You can only have custom array matcher per array/slice pattern ```test "match: arrays" { const list = [_]u8{ 0, 9, 100, 140 }; const m = comptime match(&amp;list); const res = m.arm(.{ 0, 9, 100, bind("num") }); const res2 = m.arm(.{ ref_rest("first2"), 100, 140 }); const res3 = m.arm(.{ bind("head"), ref_rest("tail") }); const res4 = m.arm(.{ 1, ref_rest("tail") }); const res5 = m.arm(.{ 0, ref_rest("middle"), 140 }); <code>try std.testing.expectEqual(140, res.?.num); try std.testing.expectEqualSlices(u8, &amp;.{ 0, 9 }, res2.?.first2); try std.testing.expectEqual(0, res3.?.head); try std.testing.expectEqualSlices(u8, &amp;.{ 9, 100, 140 }, res3.?.tail); try std.testing.expectEqual(null, res4); try std.testing.expectEqualSlices(u8, &amp;.{ 9, 100 }, res5.?.middle); </code> } ``` To make your own, you need a thing of type <code>fn (comptime type, comptime ?usize) SubSliceMatcher</code>. The first parameter is the child type of the array or slice, and the second is the length of the array, or null if it is a slice SubSliceMatcher has a <code>captures</code> field similar to a custom matcher, as well as a <code>tryBind</code> fn. The only difference is that instead of <code>val_ptr</code>, it will take <code>subslice</code>, If the matched against type is an array, <code>subslice</code> will be a pointer to the subarray that is not matched against in the rest of the pattern If the matched againt type is a slice, <code>subslice</code> will be the subslice that is not matched against in the rest of the pattern
[]
https://avatars.githubusercontent.com/u/92104930?v=4
ZBody
pyranota/ZBody
2024-10-02T20:06:44Z
[mirror] Concurrent N-body simulation using Barnes-Hut Algorithm and Zig.
main
0
3
0
3
https://api.github.com/repos/pyranota/ZBody/tags
MIT
[ "graphics", "n-body", "nix", "raylib", "raylib-zig", "simulation", "zig", "ziglang" ]
25,861
false
2025-03-22T16:51:48Z
true
true
0.12.0
github
[ { "commit": "devel.tar.gz", "name": "raylib-zig", "tar_url": "https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz.tar.gz", "type": "remote", "url": "https://github.com/Not-Nik/raylib-zig" }, { "commit": null, "name": "zb-core", "tar_url": null, "type": "relative", ...
Concurrent N-body simulation using Barnes-Hut Algorithm in Zig. <a>Key Features</a> • <a>How To Use</a> • <a>Download</a> • <a>Credits</a> • <a>License</a> Key Features <ul> <li>Barnes-Hut Algorithm</li> <li>Concurrent</li> <li><em>Faaast</em></li> <li>Many presets</li> <li>Intuitive and smooth controls</li> <li>Spawn Astral bodies with just click</li> <li>Full screen mode</li> <li>Cross platform</li> <li>Linux, macOS, Windows and Web</li> </ul> How To Use To clone and run this application, you'll need <a>Nix</a> and <a>Git</a>. Thats it, no extra stuff required! <blockquote> <strong>Note</strong> You need nix Flakes enabled. <strong>Warning</strong> Running and Installing not working yet, you can build it with nix. </blockquote> Run directly <code>bash $ nix run codeberg:pyranota/Z-body</code> Install <code>bash $ nix profile install codeberg:pyranota/Z-body</code> Develop ```bash Clone repo $ git clone https://codeberg.org/pyranota/Z-body cd into directory $ cd Z-body Enter development shell $ nix develop Compile and run $ just ``` Credits This software uses the following open source packages: <ul> <li><a>Zig</a></li> <li><a>Raylib</a></li> <li><a>Tracy</a></li> <li><a>Hyperfine</a></li> <li><a>Just</a></li> <li><a>Nix</a></li> </ul> License MIT
[]
https://avatars.githubusercontent.com/u/200686?v=4
raylib-coro-demo
deckarep/raylib-coro-demo
2024-10-13T15:24:19Z
Raylib with coroutines using the C-based neco project
main
0
3
0
3
https://api.github.com/repos/deckarep/raylib-coro-demo/tags
MIT
[ "benchmark", "bunnymark", "concurrency", "cooperative-multitasking", "coroutines", "neco", "raylib", "zig", "ziglang" ]
5,766
false
2025-02-21T21:13:43Z
false
false
unknown
github
[]
404
[]
https://avatars.githubusercontent.com/u/35655145?v=4
Flow
EngineersBox/Flow
2025-01-11T03:44:59Z
A neovim-esque text editor
main
0
3
0
3
https://api.github.com/repos/EngineersBox/Flow/tags
MIT
[ "text-editor", "zig" ]
1,189
false
2025-03-14T06:31:06Z
true
true
unknown
github
[ { "commit": "refs", "name": "vaxis", "tar_url": "https://github.com/rockorager/libvaxis/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/rockorager/libvaxis" }, { "commit": "201fe116147e21c077ad450629e25630e8cb9423.tar.gz", "name": "piecetable", "tar_url": "http...
Flow A neovim-esque text editor Preview Here it is running inside a terminal within neovim:
[]
https://avatars.githubusercontent.com/u/13835680?v=4
log_to_file
reykjalin/log_to_file
2024-11-29T19:29:24Z
Have Zig's `std.log` log to a file instead of to stderr
main
0
3
0
3
https://api.github.com/repos/reykjalin/log_to_file/tags
BSD-3-Clause
[ "logging", "zig", "zig-package" ]
29
false
2025-04-26T01:13:24Z
true
true
0.14.0
github
[]
log_to_file <a>API docs</a> An easy way to change Zig's default <code>std.log</code> functions to write to a file instead of logging to stderr. <blockquote> <span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span> <strong>This is not a logging library!</strong> It offers a function you can pass to Zig's <code>std_options</code>'s <code>.logFn</code> so <code>std.log</code> calls write to a file instead of stderr. <span class="bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300">IMPORTANT</span> <strong>Version 2.0.0 introduced breaking changes</strong>. Read through this readme to see what changed, or check <a>the changelog</a>. </blockquote> Usage <blockquote> <span class="bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300">IMPORTANT</span> If the logging function fails to write to the log file, e.g. due to a permissions issue, it will fallback to <code>std.log.defaultLog()</code> instead of silently failing. </blockquote> <ol> <li>Install the library by running <code>zig fetch --save https://git.sr.ht/~reykjalin/log_to_file/archive/2.1.0.tar.gz</code> in your project.<ul> <li>You can also use <code>zig fetch --save https://github.com/reykjalin/log_to_file/archive/refs/tags/2.1.0.zip</code> if you prefer.</li> </ul> </li> <li>Add the library as a dependency in your project's <code>build.zig</code>:</li> </ol> ```zig pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); <code>const ltf_dep = b.dependency("log_to_file", .{ .target = target, .optimize = optimize }); const exe = b.addExecutable(.{ .name = "app", .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); exe.root_module.addImport("log_to_file", ltf_dep.module("log_to_file")); </code> ``` <ol> <li>Set the log function in your main project:</li> </ol> ```zig const ltf = @import("log_to_file"); pub const std_options: std.Options = .{ .logFn = ltf.log_to_file, }; ``` Now, whenever you call the <code>std.log</code> functions they should be written to a <code>logs/&lt;executable_name&gt;.log</code> file in your current working directory when you make a <code>Debug</code> build, and <code>~/.local/state/logs/&lt;executable_name&gt;.log</code> in a <code>Release</code> build. For example, if your executable is called <code>example</code> (as is the case with <a>the examples</a>) the logs will be in <code>./logs/example.log</code> by default in a <code>Debug</code> build. Configuration <a>The examples</a> are a great resource to play with to understand how the library works. If you'd like to write logs to a different path you can configure that by adding this to your root source file (typically <code>src/main.zig</code> or similar): ```zig const ltf = @import("log_to_file"); // Logs will be saved to: // * ./logs/log in Debug mode. // * ~/.local/state/logs/log in Release mode. pub const log_to_file_options: ltf.Options = .{ .log_file_name = "log", }; // Logs will be saved to: // * ./new-logs/.log in Debug mode. // * ./new-logs/.log in Release mode. pub const log_to_file_options: ltf.Options = .{ .storage_path = "new-logs", }; // Logs will be saved to: // * /var/logs/.log in Debug mode. // * /var/logs/.log in Release mode. pub const log_to_file_options: ltf.Options = .{ .storage_path = "/var/logs", }; // Logs will be saved to: // * ./app-logs/app.log in Debug mode. // * ./app-logs/app.log in Release mode. pub const log_to_file_options: ltf.Options = .{ .log_file_name = "app.log", .storage_path = "app-logs", }; // Logs will be saved to: // * /var/logs/app.log in Debug mode. // * /var/logs/app.log in Release mode. pub const log_to_file_options: ltf.Options = .{ .log_file_name = "app.log", .storage_path = "/var/logs", }; ```
[]
https://avatars.githubusercontent.com/u/164784529?v=4
zgram
bstrdlord/zgram
2024-08-13T20:22:11Z
the best (as of 2024) zig framework for creating telegram bots
main
0
3
0
3
https://api.github.com/repos/bstrdlord/zgram/tags
-
[ "framework", "telegram", "telegram-bot", "telegram-framework", "zig" ]
13
false
2024-10-18T22:52:53Z
true
true
unknown
github
[]
zgram 💡 Info In development. use at your own risk 🚀 Example full example: <a>src/main.zig</a> ```zig var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); <code>var tg = try Client.init(allocator, TOKEN, .{}); { try tg.handleAll(handleKeyboard); // handle all messages try tg.command("start", handleAll); // handle /start command try tg.hears("hello from zgram!", handleAll); // handle message try tg.action("data1", handleQuery); // handle callback query } try tg.startPolling(.{ .drop_pending_updates = true }); </code> ```
[]
https://avatars.githubusercontent.com/u/88050465?v=4
waveboard
x07x08/waveboard
2024-11-13T15:10:27Z
A simple cross-platform soundboard
main
0
3
0
3
https://api.github.com/repos/x07x08/waveboard/tags
Unlicense
[ "cross-platform", "soundboard", "team-fortress-2", "text-to-speech", "tts", "zig", "ziglang" ]
4,572
false
2025-03-19T12:35:30Z
true
true
0.15.0-dev.65+074dd4d08
github
[ { "commit": null, "name": "_regex", "tar_url": null, "type": "relative", "url": "external/zig-regex-master" }, { "commit": null, "name": "zig_webui", "tar_url": null, "type": "relative", "url": "external/zig-webui-main" } ]
This is a rewrite of the old <a>waveboard</a> project to make it cross-platform and easier to work with for the end-user. The application is now a command line interface with a web UI. Tested on Fedora 40 and Windows 10. Unsure about Mac support. Installation <ol> <li>Get a <a>binary</a> or preferably compile one yourself</li> <li>Put the <a><code>src/web</code></a> folder in the same directory as the binary</li> </ol> Features <ul> <li>Global keyboard hotkeys / shortcuts for sounds</li> <li>In-memory playback</li> <li>Source Engine chat commands</li> <li>Whitelist and blacklist</li> <li>Audio queue</li> <li>Video downloader and converter</li> <li>Text-To-Speech using <a><code>SAPI</code></a> on Windows</li> <li>A barebones <a>JavaScript API</a></li> <li>Supported formats : .ogg (opus and vorbis), .mp3, .wav, .flac</li> </ul> Screenshots Log tab Audio tab Downloader tab Log watch tab Queue tab Text-To-Speech tab Settings tab Requirements <ol> <li> A virtual audio cable (<a><code>Virtual-Audio-Cable</code></a> or <a><code>VB-Audio Cable</code></a>) <ul> <li>Follow <a>this</a>, <a>the text</a> tutorial or find another tutorial to install the drivers</li> <li>You may need to disable <a>"Driver Signature Enforcement"</a> during the installation process</li> </ul> </li> <li> An audio directory (it is searched recursively) <ul> <li>It will be used by the program to play tracks and download videos</li> </ul> </li> <li> <em>Optional</em> A log file within your Source Engine game using the <a><code>con_logfile &lt;file&gt;</code></a> command or the <a><code>-condebug</code></a> launch option <ul> <li>This is for the log watching feature, which allows interaction with the application using the game's chat</li> <li>You can use an <code>autoexec.cfg</code> file for easier management</li> </ul> </li> <li> <em>Optional</em> <a>yt-dlp</a> and <a>ffmpeg</a> binaries for video downloading and conversion The yt-dlp binary needs to be named "ytdl" or "ytdl.exe" </li> </ol> Compiling You will need : <ul> <li><a>Zig</a></li> </ul> Windows : Nothing else Linux : Check <a>build.zig</a> for the required dependencies Credits and libraries <ul> <li><a>STARK</a> - I've used it for a long time, but it is half broken and uses the disk to write raw audio data</li> </ul> <ul> <li><a>miniaudio</a></li> <li><a>libuiohook</a> - evdev branch</li> <li><a>nfd-extended</a></li> <li><a>ogg-container</a></li> <li><a>opus</a> and <a>opusfile</a></li> <li><a>vorbis</a></li> </ul> <ul> <li><a>webui</a></li> <li><a>regex</a></li> </ul>
[]
https://avatars.githubusercontent.com/u/166938213?v=4
FOZOS
OranGot/FOZOS
2024-12-02T08:38:27Z
x64 os made with limine in zig
main
0
3
0
3
https://api.github.com/repos/OranGot/FOZOS/tags
BSD-4-Clause
[ "limine", "os", "osdev", "x64", "zig", "ziglang" ]
140
false
2025-04-17T16:01:14Z
true
true
unknown
github
[ { "commit": "master", "name": "limine", "tar_url": "https://github.com/48cf/limine-zig/archive/7b29b6e6f6d35052f01ed3831085a39aae131705.tar.gz/archive/master.tar.gz", "type": "remote", "url": "https://github.com/48cf/limine-zig/archive/7b29b6e6f6d35052f01ed3831085a39aae131705.tar.gz" } ]
FOZOS This is an os I am making for fun and it's not intended for any use so far. Info Made with limine. Supported platforms: x86-64 Written in: zig, c, assembly Goals <ol> <li>Stable</li> <li>Built in desktop enviroment</li> <li>Customisable</li> </ol> Features implimented: <ol> <li>tty</li> <li>debug printing</li> <li>pmm</li> <li>vmm</li> <li>nvme(basic)</li> <li>gpt</li> <li>EXT2(basic)</li> <li>extremely basic system calls</li> <li>userspace enter</li> </ol> Build Dependencies To build FOZOS, ensure you have the following dependencies installed: - <code>make</code> - <code>zig</code> (0.14.0) - <code>qemu</code> - <code>git</code> - <code>sgdisk</code> Cloning the Repository Clone the repository recursively to include the Limine submodule(can be slow, can be faster by adding --depth 1): <code>bash git clone --recursive https://github.com/OranGot/FOZOS.git</code> Building the Kernel To build the kernel, run: <code>bash make kernel</code> Running the OS To run the OS as a disk using QEMU, use: <code>bash sudo make run</code> Debugging For debugging purposes, you can build a debug version of the kernel by appending <code>-dbg</code> to the target: <code>bash make kernel-dbg</code> To run the debug version, use: <code>bash sudo make run-dbg</code> Note Creating the image uses Loop Devices, which require <code>sudo</code> permissions. and also <code>clean</code> step for delting mount point ect
[]
https://avatars.githubusercontent.com/u/40190339?v=4
WolframLanguageRuntimeZigDemo
daneelsan/WolframLanguageRuntimeZigDemo
2024-08-20T01:44:29Z
WolframLanguageRuntime demo in Zig
main
0
3
0
3
https://api.github.com/repos/daneelsan/WolframLanguageRuntimeZigDemo/tags
-
[ "wolfram-language", "wolfram-mathematica", "zig" ]
309
false
2025-03-27T19:30:53Z
true
true
0.14.0
github
[]
Wolfram Language Runtime (SDK) demo in Zig A demo of the new <a>Wolfram Language Runtime</a> written in <a>Zig</a>. I wrote a Wolfram community post expanding on the details <a>Wolfram Language Runtime (SDK) demo in Zig</a>. Demo We will create two standalone executables that run the <a>Transliterate</a> function from Wolfram Language. The executables are written in C and Zig. Build The <code>zig build</code> command will build both the C and the Zig executables: <code>shell $ zig build --summary all Build Summary: 5/5 steps succeeded install success ├─ install transliterate-zig success │ └─ zig build-exe transliterate-zig Debug native cached 45ms MaxRSS:36M └─ install transliterate-c success └─ zig build-exe transliterate-c Debug native cached 45ms MaxRSS:36M</code> By default, the executables are stored in <code>zig-out/bin</code>: <code>shell $ ls zig-out/bin ─╯ transliterate-c transliterate-zig</code> C Now that the executable is compiled, see the usage: <code>shell $ ./zig-out/bin/transliterate-c Usage: ./transliterate-c "input"</code> Use the executable: <code>shell $ ./zig-out/bin/transliterate-c 'しんばし' shinbashi</code> Zig Instead of specifying where the C header library is (see <a>build.zig</a>), we are using a handwritten Zig package: <a>WolframLanguageRuntime.zig</a>. Now that the executable is compiled, see the usage: <code>shell $ ./zig-out/bin/transliterate-zig Usage: ./transliterate-zig "input"</code> Use the executable: <code>shell $ ./zig-out/bin/transliterate-zig 'しんばし' shinbashi</code> Prerequisites Architecture Tested on: <code>shell $ uname -a Darwin mac.lan 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:03:40 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6041 arm64</code> Wolfram Language version Tested on: <code>Mathematica In[]:= $Version Out[]= "14.3.0 for Mac OS X ARM (64-bit) (March 26, 2025)"</code> Zig version Tested on: <code>shell $ zig version 0.14.0</code> Zig is not on version <a>1.0</a>. The language is in constant development and some things might break in the future. References <ul> <li><a>Yet More New Ideas and New Functions: Launching Version 14.1 of Wolfram Language &amp; Mathematica - Standalone Wolfram Language Applications!</a></li> <li><a>Zig Language Reference</a></li> <li><a>Zig Standard Library</a></li> <li><a>Expression API rough documentation</a></li> </ul>
[]
https://avatars.githubusercontent.com/u/49213919?v=4
zigchr
LukasPietzschmann/zigchr
2024-09-17T19:23:34Z
A FreeCHR instance written in Zig
main
0
3
0
3
https://api.github.com/repos/LukasPietzschmann/zigchr/tags
BSD-3-Clause
[ "constraint-programming", "zig" ]
63
false
2024-11-12T08:06:34Z
true
true
0.13.0
github
[]
ZigCHR For the <a>talk</a> I gave at Zigtoberfest 2024, I coded up a CHR embedding for Zig using the FreeCHR framework. If you want to learn more about FreeCHR, go ahead and read <a>this paper</a>. If you want to know more about cool properties that CHR can bring to your algorithms, visit <a>my website for the talk</a> Project Structure <ul> <li><code>src/</code>: Here you can find two example on how to use the embedding.</li> <li><code>lib/</code>: The embedding itself.</li> <li><code>utils/</code>: Some useful data structures and functions unrelated to CHR.</li> </ul> How to build it For each file inside the <code>src</code> directory, there exists a step. So lets say you want to build and run the <em>min</em> example. You can run <code>zig build min</code> to do so. For all examples present in this repo, you can pass the query constraints though the commandline like the following: <code>zig build min -- 1 3 5</code>. If you add your own file in the <code>src</code> folder, the build system will automatically generate a step for you. Additional flags You can pass different flags to the build process to control how much logs the embedding produces: <ul> <li><code>-Dlog</code> enabled logging. The embedding will print which rules were fired with which constraints, whats put into the store, ...</li> <li><code>-Dnotag</code> wont print a constraints tag.</li> <li><code>-Dmatchings</code> requires <code>-Dlog</code>. The embedding will print what combination of constraints are considered.</li> <li><code>-Dstore</code> requires <code>-Dlog</code>. The embedding will print the constraint store when it's modified.</li> </ul>
[]
https://avatars.githubusercontent.com/u/108814993?v=4
zime
Hato1125/zime
2025-01-25T16:06:43Z
🎮 A small and simple 2D game framework written in Zig.
master
0
3
0
3
https://api.github.com/repos/Hato1125/zime/tags
-
[ "game", "sdl3", "sdl3-image", "zig" ]
21
false
2025-03-23T12:21:38Z
true
true
unknown
github
[]
404
[]
https://avatars.githubusercontent.com/u/6756180?v=4
sanitizers-zig
kassane/sanitizers-zig
2024-09-24T16:19:02Z
LLVM sanitizers for zig-toolchain
main
1
3
0
3
https://api.github.com/repos/kassane/sanitizers-zig/tags
Apache-2.0
[ "cpp", "cpp-libraries", "llvm-sanitizer", "zig", "zig-package" ]
36
false
2025-04-16T13:48:47Z
true
true
0.13.0
github
[]
LLVM Sanitizers for Zig Description This is a collection of sanitizers for Zig. It is a work in progress. Requirements <ul> <li><a>Zig</a> v0.15.0-dev</li> </ul> Add <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> AddressSanitizer <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> MemorySanitizer <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> UndefinedBehaviorSanitizer <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> LeakSanitizer <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> RealtimeSanitizer (LLVM 20) Supported Platforms <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Linux (GNU|Musl) <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Windows <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> macOS Experimental Real-time Sanitizer (LLVM 20) <blockquote> <span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span> This is an experimental feature and is not yet ready for production use. Currently, zig master version is LLVM 19. My tests use zig-fork w/ LLVM 20. </blockquote> <code>``bash $ zig build rtsan -Dtests Real-time violation: intercepted call to real-time unsafe function</code>malloc` in real-time context! Stack trace: #0 0x00000102e659 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102e659) #1 0x00000102bf80 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102bf80) #2 0x00000102bef5 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102bef5) #3 0x00000102c23c (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102c23c) #4 0x00000102cdc1 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102cdc1) #5 0x0000010891f7 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x10891f7) #6 0x00000102b824 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102b824) #7 0x00000102b7a2 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102b7a2) #8 0x00000102b713 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102b713) #9 0x00000102b42c (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102b42c) #10 0x00000102b10e (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102b10e) #11 0x00000102aeaa (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102aeaa) #12 0x00000102adc8 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102adc8) #13 0x00000102ae25 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102ae25) #14 0x77feed58de07 (/usr/lib/libc.so.6+0x25e07) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3) #15 0x77feed58decb (/usr/lib/libc.so.6+0x25ecb) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3) #16 0x00000102ad74 (/home/kassane/sanitizers-llvm/.zig-cache/o/18b7cbe81f65f9f9049547f69b71a77e/test-rtsan+0x102ad74) rtsan └─ run test-rtsan failure error: the following command exited with error code 1: ``` References <ul> <li>official-doc: https://clang.llvm.org/docs/RealtimeSanitizer.html</li> <li>base: https://github.com/realtime-sanitizer/rtsan</li> </ul>
[]
https://avatars.githubusercontent.com/u/910428?v=4
xterm256.zig
zhuyadong/xterm256.zig
2024-10-14T23:41:30Z
print text with xterm256 style
main
0
3
0
3
https://api.github.com/repos/zhuyadong/xterm256.zig/tags
MIT
[ "color", "print", "xterm", "xterm256", "zig", "zig-package" ]
9
false
2025-03-08T10:57:03Z
true
true
0.11.0
github
[]
<a>中文</a> | <a>English</a> Print Text with <code>xterm256</code> Colors and Styles Install In the project root directory: <code>shell zig fetch "git+https://github.com/zhuyadong/xterm256.zig" --save=xterm256</code> If you want to install a specific version: <code>shell zig fetch "git+https://github.com/zhuyadong/xterm256.zig#&lt;ref id&gt;" --save=xterm256</code> Usage Examples ```zig const xterm = @import("xterm256"); // Print "Hello" in red xterm.print(.{.fg = .red}, "Hello", .{}); // Print "Hello" in red with a white background xterm.print(.{.fg = .{.r=5}, .bg = .white}, "Hello", .{}); // Print "Hello" with color number 222 xterm.print(.{.fg = .x222}, "Hello", .{}); // Print "Hello" in bold red xterm.print(.{.fg = .red, .style = .{.bold}}, "Hello", .{}); // If there is a <code>prefix</code>, only the <code>prefix</code> part will be colored xterm.print(.{.fg = .red, .prefix="error:"}, " something wrong.", .{}); // Save the sequence to print "Hello" in red to buf var buf: [128]u8 = undefined; _ = try xterm.bufPrint(&amp;buf, .{.fg = .red}, "Hello", .{}); // Complex style const complexStyle = .{ .fg = .x222, .bg = .{.b = 5, .g = 5}, .style = .{.bold, .underline}, .prefix = "complex:", }; xterm.print(complexStyle, "Hello", .{}); ``` Style Definition Format <code>zig .{ .fg = &lt;color&gt;, .bg = &lt;color&gt;, .style = .{.style1, .style2 ...}, .prefix="prefix text" }</code> Where <code>&lt;color&gt;</code> can be one of the following formats: - . - .{.r=[0,5], .g=[0-5], .b=[0-5]} - .{.gray=[0-23]} <blockquote> In the <code>rgb</code> format, you can omit 1-2 of <code>r</code>, <code>g</code>, <code>b</code> </blockquote> <code>&lt;color_name&gt;</code> includes the following items: - .x[16-255] - .black - .red - .green - .yellow - .blue - .magenta - .cyan - .white - .bright_black - .bright_red - .bright_green - .bright_yellow - .bright_blue - .bright_magenta - .bright_cyan - .bright_white <code>style</code> includes the following items: - .bold - .italic - .underline - .slowblink - .rapidblink - .reverse - .invisible - .strikethrough
[]
https://avatars.githubusercontent.com/u/182816200?v=4
liskvork
liskvork/liskvork
2024-09-01T09:28:10Z
Modern multi-platform gomoku game server
master
9
3
1
3
https://api.github.com/repos/liskvork/liskvork/tags
EUPL-1.2
[ "ai", "gomoku", "zig" ]
351
false
2025-03-30T09:33:17Z
true
true
0.14.0
github
[ { "commit": "30afc2fc875ff817af0ffe490481f6f8aa3b5cd4.tar.gz", "name": "ini", "tar_url": "https://github.com/ziglibs/ini/archive/30afc2fc875ff817af0ffe490481f6f8aa3b5cd4.tar.gz.tar.gz", "type": "remote", "url": "https://github.com/ziglibs/ini" }, { "commit": "d9142c73aedc5698beba58b3fbf2...
liskvork Modern multi-platform gomoku game server. Main repository URL: <a>https://github.com/liskvork/liskvork</a> <a></a> License liskvork is licensed under the <a>European Union Public License 1.2</a> or later. Support | | x86-64 | aarch64 | |--------------|--------|---------| | Linux (GNU) | 🟢 | 🟡 | | Linux (MUSL) | 🟢 | 🟡 | | Windows | 🟡 | 🟡 | | MacOS | 🟡 | 🟡 | | OpenBSD | 🔴 | 🔴 | | FreeBSD | 🔴 | 🔴 | 🟢 - Supported and actively tested 🟡 - Supported but not actively tested 🔴 - Not supported Reporting bugs/Submitting patches You can see open tickets and report bugs over <a>here</a>. You can submit patches/PRs over <a>here</a>. Building from source Docker <code>sh docker build . --build-arg BUILD_VERSION=0.0.0-dev -t liskvork</code> No docker Dependencies <ul> <li>zig 0.14.0 (May work with newer versions but has not been tested)</li> </ul> Step <code>sh zig build -Doptimize=ReleaseSafe</code> Installing Get the binary from <a>Github release tab</a> and then just launch it. Launching liskvork From source build ```sh From the root of the repository once built ./zig-out/bin/liskvork ``` Docker ```sh Once compiled with docker docker run -v $(pwd):/data/:Z liskvork ``` ```sh Or pulled from the repos docker run -v $(pwd):/data/:Z ghcr.io/liskvork/liskvork:latest ``` Configuration Look at the default <code>config.ini</code> that's created when launching for the first time everything (should) be documented properly to configure it.
[]
https://avatars.githubusercontent.com/u/90518536?v=4
zig-playground
Decryptu/zig-playground
2024-11-30T22:31:36Z
A hands-on learning repository showcasing Zig programming language features through practical examples. Features both a command-line and GUI application demonstrating core Zig concepts, modern systems programming practices, and SDL2 integration.
main
0
2
0
2
https://api.github.com/repos/Decryptu/zig-playground/tags
MIT
[ "hello-world", "helloworld", "sdl2", "zig", "zig-lang", "ziglang" ]
1,776
false
2024-12-01T20:26:43Z
true
false
unknown
github
[]
Zig Examples This project contains four examples demonstrating different aspects of the Zig programming language: <ol> <li>A basic command-line program showcasing fundamental Zig features</li> <li>A simple GUI application using SDL2</li> <li>A vector operations example with interactive visualization</li> <li>A matrix operations example using comptime features</li> </ol> Prerequisites <ul> <li>Zig (0.13.0 or later)</li> <li>SDL2 (for the GUI example)</li> <li>macOS with Apple Silicon (M1/M2) or modify paths for your system</li> </ul> Installation on macOS ```bash Install Zig brew install zig Install SDL2 (required for GUI example) brew install sdl2 ``` Building and Running The project includes four examples that can be built and run separately. After building, the executables can be found in the <code>zig-out/bin/</code> directory: <ul> <li><code>zig-out/bin/basic</code> - The basic command-line example</li> <li><code>zig-out/bin/gui</code> - The GUI application</li> <li><code>zig-out/bin/vector</code> - The vector operations example</li> <li><code>zig-out/bin/matrix</code> - The matrix operations example</li> </ul> Basic Example Demonstrates fundamental Zig features including: <ul> <li>Functions</li> <li>Structs with methods</li> <li>Error handling</li> <li>String formatting</li> <li>Basic types</li> </ul> ```bash Build all targets zig build Run the basic example directly ./zig-out/bin/basic Or use zig build command zig build run-basic ``` GUI Example Shows how to create a simple GUI application using SDL2: <ul> <li>Window creation</li> <li>Event handling</li> <li>Basic graphics rendering</li> <li>Keyboard input</li> <li>Game loop implementation</li> </ul> ```bash Build all targets zig build Run the GUI example directly ./zig-out/bin/gui Or use zig build command zig build run-gui ``` Vector Example Demonstrates Zig's SIMD vector operations with an interactive visualization: <ul> <li>Vector arithmetic operations</li> <li>SIMD instructions usage</li> <li>Interactive web visualization</li> <li>Real-time computation</li> </ul> ```bash Build all targets zig build Run the vector example directly ./zig-out/bin/vector Or use zig build command zig build vector ``` Matrix Example Showcases advanced Zig features using matrix operations: <ul> <li>Generic programming with comptime</li> <li>Compile-time error checking</li> <li>Struct methods</li> <li>Array operations</li> <li>Formatted printing</li> </ul> ```bash Build all targets zig build Run the matrix example directly ./zig-out/bin/matrix Or use zig build command zig build matrix ``` GUI Controls <ul> <li>Arrow keys: Move the red square</li> <li>Escape: Exit the program</li> <li>Window close button: Exit the program</li> </ul> Project Structure <code>t . ├── .gitignore ├── LICENSE ├── README.md ├── build.zig # Build configuration ├── src/ │ ├── basic.zig # Basic Zig example │ ├── gui.zig # SDL2 GUI example │ ├── vector.zig # Vector operations example │ └── matrix.zig # Matrix operations example └── .vscode/ └── settings.json</code> Build Output After building, the project generates the following executables: <code>t zig-out/ └── bin/ ├── basic # Basic command-line example executable ├── gui # GUI application executable ├── vector # Vector operations executable └── matrix # Matrix operations executable</code> Features Demonstrated Basic Example (basic.zig) <ul> <li>Function definitions</li> <li>Custom types (structs)</li> <li>String formatting and printing</li> <li>Error handling with <code>try</code></li> <li>Basic arithmetic</li> </ul> GUI Example (gui.zig) <ul> <li>SDL2 integration</li> <li>Window management</li> <li>Input handling</li> <li>Basic graphics rendering</li> <li>Resource management with <code>defer</code></li> <li>Game loop pattern</li> </ul> Vector Example (vector.zig) <ul> <li>SIMD vector operations</li> <li>Interactive visualization</li> <li>Real-time computation</li> <li>Vector arithmetic</li> <li>Web component integration</li> <li>User input handling</li> <li>Dynamic result visualization</li> </ul> Matrix Example (matrix.zig) <ul> <li>Generic programming using comptime</li> <li>Error checking at compile time</li> <li>Struct methods</li> <li>Array operations</li> <li>Formatted printing</li> </ul> Learning Resources <ul> <li><a>Zig Documentation</a></li> <li><a>SDL2 Documentation</a></li> <li><a>Zig Learning Resources</a></li> <li><a>Zig Vector Operations</a></li> </ul> Contributing Feel free to: <ul> <li>Report issues</li> <li>Suggest improvements</li> <li>Submit pull requests</li> </ul> All contributions are welcome! License This project is licensed under the MIT License - see the <a>LICENSE</a> file for details.
[]
https://avatars.githubusercontent.com/u/32991121?v=4
java-all-in-native
Enaium/java-all-in-native
2025-01-25T13:37:13Z
This project is a Java application that uses native code to perform some operations.
master
0
2
1
2
https://api.github.com/repos/Enaium/java-all-in-native/tags
CC0-1.0
[ "cpp", "csharp", "ffm", "ffm-api", "go", "jep424", "jep434", "jep442", "jep454", "kotlin", "rust", "zig" ]
72
false
2025-04-30T17:30:33Z
false
false
unknown
github
[]
java-all-in-native This project is a Java application that uses native code to perform some operations. The native code is written in C++, C#, Rust and Go etc. The project is a demonstration of how to use native code in Java applications.
[]
https://avatars.githubusercontent.com/u/122831?v=4
uuidv7
coolaj86/uuidv7
2024-09-21T06:58:19Z
UUIDv7, written in Zig (and Go, and JS, and Swift - just for good measure, of course)
main
3
2
1
2
https://api.github.com/repos/coolaj86/uuidv7/tags
NOASSERTION
[ "go", "golang", "javascript", "swift", "uuid", "uuid-generator", "uuidv7", "zig", "ziglang" ]
59
false
2025-05-06T08:54:03Z
false
false
unknown
github
[]
<a>uuidv7</a> Generate UUID v7 strings, like <code>019212d3-87f4-7d25-902e-b8d39fe07f08</code>. <code>sh uuidv7 &gt; uuidv7.txt</code> <code>text 019212d3-87f4-7d25-902e-b8d39fe07f08</code> | 32-bit time | 16-bit time | 4 ver + 12 rnd | 2 var + 14 rnd | 16 rnd + 32 rnd | | :------------------------: | :---------: | :------------: | :------------: | :----------------------------------------: | | 01&nbsp;92&nbsp;12&nbsp;d3 | 87&nbsp;f4 | 7d&nbsp;25 | 90&nbsp;2e | b8&nbsp;d3&nbsp;9f&nbsp;e0&nbsp;7f&nbsp;08 | Table of Contents <ul> <li><a>Install</a></li> <li><a>In JavaScript</a></li> <li><a>UUIDv7 Spec</a></li> <li><a>By the Characters</a></li> <li><a>By the Bits</a></li> <li><a>Build</a></li> <li><a>Go Build (and TinyGo)</a></li> <li><a>Swift</a></li> <li><a>Zig Build</a></li> <li><a>License</a></li> </ul> Install Pre-built archives available for Mac, Linux, &amp; Widows. \ Compile from source for FreeBSD, OpenBSD, etc. <ol> <li>Download from GitHub Releases: <a>https://github.com/coolaj86/uuidv7/releases</a></li> <li>Extract</li> <li>Place in your <code>PATH</code></li> </ol> <code>sh b_triplet='x86_64-linux-musl' curl -L -O https://github.com/coolaj86/uuidv7/releases/download/v1.0.0/uuidv7-v1.0.0-"$b_triplet".tar.gz tar xvf ./uuidv7-v1.0.0-"$b_triplet".tar.gz mv ./uuidv7 ~/bin/</code> JavaScript Version Supports both <code>import</code> and <code>require</code>. Extremely simple implementation that can be tuned for speed or memory efficiency. <code>sh npm install --save @root/uuidv7</code> High-level API: ```js import UUIDv7 from "@root/uuidv7"; UUIDv7.uuidv7(); // 01922aa4-88ad-7cae-a517-a298a491d35c UUIDv7.uuidv7Bytes(); // Uint8Array(16) [ 1, 146, 42, 176, 37, 122, 114, 189 // 172, 240, 1, 146, 42, 176, 37, 122 ] ``` Low-level API: <code>js let buffer = new Uint8Array(4096); // optional, if you need lots of UUIDs, and fast UUIDv7.setBytesBuffer(buffer);</code> ```js let now = Date.now(); let ms64 = BigInt(now); let bytes = new Uint8Array(16); let start = 0; globalThis.crypto.getRandomValues(bytes); void UUIDv7.fill(bytes, start, ms64); console.log(bytes); // Uint8Array(16) [ 1, 146, 42, 176, 37, 122, 114, 189 // 172, 240, 1, 146, 42, 176, 37, 122 ] ``` <code>js let uuidv7 = UUIDv7.format(bytes); console.log(uuidv7); // 01922aa4-88ad-7cae-a517-a298a491d35c</code> UUIDv7 Spec By the Characters There are 36 characters total: 32 hex (<code>0123456789abcdef</code>) + 4 dashes (<code>-</code>) <code>text 8 time 4 time 1v + 3ra ½v + 3½rb 12 random b 019212d3 - 87f4 - 7d25 - 902e - b8d39fe07f08</code> <ul> <li>8ch hex time high</li> <li><code>-</code></li> <li>4ch hex time low</li> <li><code>-</code></li> <li>4ch hex version + "random a"</li> <li>1ch hex version: <code>7</code></li> <li>3ch hex "random a"</li> <li><code>-</code></li> <li>4ch hex variant + "random b"</li> <li>1ch hex version: <code>8</code>, <code>9</code>, <code>a</code>, <code>b</code></li> <li>3ch hex "random b"</li> <li><code>-</code></li> <li>12ch hex randam a</li> <li>4ch hex random a</li> <li>8ch hex random a</li> </ul> By the Bits There are 128 bits total: \ 48 time and 80 random, with 4 version and 2 variant bits substituted <code>text 48 time 4ver, 12ra 2var, 14rb random b 019212d3-87f4 - 7d25 - 902e - b8d39fe07f08</code> <ul> <li>48 bits of timestamp</li> <li>32-bit high (minutes to years)</li> <li>16-bit low (seconds &amp; milliseconds)</li> <li>16 bits of version + random</li> <li>4-bit version (<code>0b0111</code>)</li> <li>12-bit random</li> <li>64-bits variant + random</li> <li>2-bit variant (<code>0b10</code>)</li> <li>62-bit random</li> </ul> Build Go <code>sh curl https://webi.sh/go | sh source ~/.config/envman/PATH.env</code> For the current platform: <code>sh go build -o uuidv7 ./cmd/.</code> For Linux containers: <code>sh GOOS=linux GOARCH=amd64 GOAMD64=v2 go build -o uuidv7 ./cmd/.</code> The entire build matrix (into <code>./dist/</code>): <code>sh goreleaser --snapshot --skip=publish --clean</code> TinyGo <code>sh curl https://webi.sh/go | sh source ~/.config/envman/PATH.env</code> <code>sh tinygo build -o uuidv7 ./cmd/.</code> <code>sh GOOS=linux GOARCH=amd64 GOAMD64=v2 tinygo build -o uuidv7 ./cmd/.</code> Swift ```sh swift build --configuration release --show-bin-path ./.build/arm64-apple-macosx/release/uuidv7 ``` Zig See . Builds with zig v0.13 and the v0.14 previews so far. <code>sh curl https://webi.sh/zig@0.13 | sh source ~/.config/envman/PATH.env</code> ```sh zig build-exe ./uuidv7.zig -O ReleaseSmall -femit-bin="uuidv7" for b_target in x86-linux-musl aarch64-macos-none x86_64-windows-gnu; do zig build-exe ./uuidv7.zig -O ReleaseSmall \ -target "${b_target}" -femit-bin="uuidv7-${b_target}" done ``` License Copyright 2024 AJ ONeal <a>&#97;&#106;&#64;&#116;&#104;&#101;&#114;&#111;&#111;&#116;&#99;&#111;&#109;&#112;&#97;&#110;&#121;&#46;&#99;&#111;&#109;</a> This Source Code Form is subject to the terms of the Mozilla Public \ License, v. 2.0. If a copy of the MPL was not distributed with this \ file, You can obtain one at https://mozilla.org/MPL/2.0/.
[]
https://avatars.githubusercontent.com/u/51416554?v=4
ansi-escape.zig
hendriknielaender/ansi-escape.zig
2025-01-03T16:32:25Z
ANSI escape codes for manipulating the terminal
main
3
2
0
2
https://api.github.com/repos/hendriknielaender/ansi-escape.zig/tags
MIT
[ "ansi", "ansi-escape-codes", "terminal", "zig", "zig-library", "zig-package", "ziglang" ]
5,225
false
2025-03-14T22:32:37Z
true
true
unknown
github
[]
A minimalistic Zig library for working with ANSI escape sequences. This library provides utilities for cursor control, screen manipulation, and terminal resetting through a simple and efficient API. [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/hendriknielaender/ansi-escape.zig/blob/HEAD/LICENSE) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/hendriknielaender/ansi-escape.zig) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hendriknielaender/ansi-escape.zig/blob/HEAD/CONTRIBUTING.md) Features <ul> <li>Cursor positioning and movement</li> <li>Screen and line erasure</li> <li>Terminal reset operations</li> <li>Easy-to-use, lightweight API</li> </ul> Installation <ol> <li> Run the following command to fetch the ansi-escape.zig package: <code>shell zig fetch https://github.com/hendriknielaender/ansi-escape.zig/archive/&lt;COMMIT&gt;.tar.gz --save</code> Using <code>zig fetch</code> simplifies managing dependencies by automatically handling the package hash, ensuring your <code>build.zig.zon</code> file is up to date. </li> <li> Add the module in <code>build.zig</code>: </li> </ol> ```diff const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); <ul> <li>const opts = .{ .target = target, .optimize = optimize };</li> <li> const ansi_module = b.dependency("ansi-escape", opts).module("ansi-escape"); const exe = b.addExecutable(.{ .name = "test", .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); + exe.root_module.addImport("ansi-escape", ansi_module); exe.install(); ... } ``` </li> </ul> Quick Start ```zig const std = @import("std"); const ansi = @import("ansi-escape").ansi; pub fn main() !void { const stdout = std.io.getStdOut().writer(); <code>// Print initial lines try stdout.print("Line 1\nLine 2\nLine 3\n", .{}); // Move up one line, clear it, and replace it try ansi.cursor.up(stdout, 1); try ansi.erase.line(stdout); try stdout.print("Updated Line 2\n", .{}); // Hide cursor, wait for user, and then restore try ansi.cursor.hide(stdout); try std.time.sleep(1_000_000_000); // 1 second try ansi.cursor.show(stdout); </code> } ``` API The <code>ansi-escape.zig</code> library offers a structured API organized into several key components: <code>Cursor</code>, <code>Scroll</code>, <code>Erase</code>, and <code>Clear</code>. Each component provides a set of functions to perform specific terminal manipulations. The <code>Cursor</code> struct allows precise control over cursor positioning and movement, including absolute and relative movements, hiding/showing the cursor, and saving/restoring cursor positions. The <code>Scroll</code> struct enables scrolling the terminal content up or down by a specified number of lines. The <code>Erase</code> struct provides functions to clear parts of the screen or lines, such as erasing the entire screen, clearing lines, or removing content above or below the cursor. Finally, the <code>Clear</code> struct includes functions to reset the terminal to its default state. Together, these components offer a flexible and powerful API for managing terminal behavior through ANSI escape codes.
[]
https://avatars.githubusercontent.com/u/26812563?v=4
schnorr-zig
aidanaden/schnorr-zig
2024-08-31T19:56:54Z
schnorr signatures in zig (Ristretto255)
main
0
2
0
2
https://api.github.com/repos/aidanaden/schnorr-zig/tags
Apache-2.0
[ "ed25519", "ristretto255", "schnorr", "schnorr-signatures", "zig" ]
55
false
2024-09-23T01:13:17Z
true
true
unknown
github
[ { "commit": "master", "name": "yazap", "tar_url": "https://github.com/prajwalch/yazap/archive/master.tar.gz", "type": "remote", "url": "https://github.com/prajwalch/yazap" } ]
schnorr signatures + musig2 (N/N multisigs) Simple zig implementation of <a>Schnorr Signatures</a> and <a>MuSig2</a>. Implementation partially inspired by <a>https://github.com/VictoriaGrasshopper/schnorr_signature</a> Includes a CLI app for independent/one-time using of schnorr and musig2 signing. Security considerations TODO Installing <ol> <li>Run the following command:</li> </ol> <code>zig fetch --save git+https://github.com/aidanaden/schnorr-zig</code> <ol> <li>Add the following to <code>build.zig</code>:</li> </ol> <code>zig const schnorr = b.dependency("schnorr", .{}); exe.root_module.addImport("schnorr", schnorr.module("schnorr")); exe.root_module.addImport("musig2", schnorr.module("musig2"));</code> Build <code>sh zig build</code> Usage TODO CLI TODO Code example TODO API This package exposes two functions: <code>generate</code> and <code>reconstruct</code>. Generate TODO License Apache-2.0. See the <a>license file</a>. References <ul> <li> Reasons for Ristretto255 </li> <li> <a>https://loup-vaillant.fr/tutorials/cofactor</a> </li> <li> Schnorr </li> <li> <a>https://github.com/VictoriaGrasshopper/schnorr_signature</a> </li> <li> MuSig2 </li> <li> <a>https://hackmd.io/@<em>XlWbpTTRNaI4BeB7d8qig/BJbt-zlF</em>#Ristretto255</a> </li> <li> <a>https://eprint.iacr.org/2020/1261.pdf</a> </li> <li> Curve25519 </li> <li> <a>https://martin.kleppmann.com/papers/curve25519.pdf</a> </li> </ul>
[]
https://avatars.githubusercontent.com/u/21108320?v=4
zig-list
SarthakMakhija/zig-list
2024-09-29T09:53:30Z
Sort-of port of Java's Arraylist to Zig, for learning Zig.
main
0
2
0
2
https://api.github.com/repos/SarthakMakhija/zig-list/tags
-
[ "arraylist", "zig", "ziglang" ]
24
false
2024-10-03T10:04:46Z
true
true
unknown
github
[]
zig-list <a></a> <strong>zig-list</strong> is a sort-of port of Java's Arraylist to Zig, for learning Zig. The ported <a>ArrayList</a> demonstrates various language concepts including: <ul> <li>Language syntax</li> <li>Loops and conditionals</li> <li>Structs </li> <li>Pointers</li> <li>Functions and methods</li> <li>Functions as method parameters</li> <li>Memory allocation and de-allocation</li> <li>Error handling</li> <li>Generics (<code>comptime</code>)</li> <li>Unit tests</li> </ul>
[]
https://avatars.githubusercontent.com/u/4605603?v=4
zig-scandum
tiehuis/zig-scandum
2024-11-12T07:05:33Z
Zig implementation of scandum sorting algorithms
master
0
2
0
2
https://api.github.com/repos/tiehuis/zig-scandum/tags
MIT
[ "sorting", "zig" ]
43
false
2025-01-24T17:21:41Z
true
true
unknown
github
[]
Zig port of sorting functions by @scandum: https://github.com/scandum/quadsort This aims to be a fairly straight-forward port, however there are key changes made such as replacing all pointer usages with slices and refactoring goto control-flow. <code>zig build run -Dtrace=true</code> Status <strong>This is not fully complete.</strong> The quadsort + piposort implementations pass a few million fuzz iterations but the other implementations have some outstanding issues and will fail after a few thousand cases currently. Setup The C implementations are vendored directly in this repo with a small header shim to make available to Zig code. There are two main entry point programs: - <code>main.zig</code>: Performs a single sort with arguments given on command-line - <code>main_fuzz.zig</code>: Sorts a range of data with the requested algorithm until failure. Typically, I will use the fuzzer main to find a failing test-case, and then use the <code>diff</code> shell script (in root) which is a wrapper to <code>main.zig</code> and performs a sort of the C implementation and the Zig and does a textual diff against a trace of each. All sort implementations have manual tracing added to their control-flow which can be toggled with the <code>-Dtrace</code> flag in the zig build script.
[]
https://avatars.githubusercontent.com/u/16268616?v=4
zig-ipld
nDimensional/zig-ipld
2024-11-22T22:34:48Z
Zig implementation of the IPLD data model
main
0
2
0
2
https://api.github.com/repos/nDimensional/zig-ipld/tags
MIT
[ "dag-cbor", "dag-json", "ipld", "zig" ]
89
false
2025-05-06T05:42:00Z
true
true
0.14.0
github
[ { "commit": "refs", "name": "multiformats", "tar_url": "https://github.com/nDimensional/zig-multiformats/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/nDimensional/zig-multiformats" } ]
zig-ipld Zig implementation of the <a>IPLD</a> data model, with dag-cbor and dag-json codecs. Provides two parallel APIs: <ul> <li>a "dynamic" heap-allocated <code>Value</code> type for manipulating arbitrary/heterogenous values</li> <li>a "static" API for generating encoders and decoders for native Zig types at comptime</li> </ul> Passes all tests in <a>ipld/codec-fixtures</a> except for <code>i64</code> integer overflow cases. Table of Contents <ul> <li><a>Install</a></li> <li><a>Usage</a></li> <li><a>Creating dynamic values</a></li> <li><a>Encoding dynamic values</a></li> <li><a>Decoding dynamic values</a></li> <li><a>Static types</a></li> <li><a>Strings and bytes</a></li> </ul> Install Add to <code>build.zig.zon</code>: <code>zig .{ // ... .dependencies = .{ .ipld = .{ .url = "https://github.com/nDimensional/zig-ipld/archive/${COMMIT}.tar.gz", // .hash = "...", }, } }</code> Then in <code>build.zig</code>: ```zig pub fn build(b: *std.Build) !void { const ipld_dep = b.dependency("ipld", .{}); <code>const ipld = ipld_dep.module("ipld"); const json = ipld_dep.module("dag-json"); const cbor = ipld_dep.module("dag-cbor"); // All of the modules from zig-multiformats are also re-exported // from zig-ipld, for convenience and to ensure consistent versions. const varint = ipld_dep.module("varint"); const multibase = ipld_dep.module("multibase"); const multihash = ipld_dep.module("multihash"); const cid = ipld_dep.module("cid"); // add as imports to your exe or lib... </code> } ``` Usage Creating dynamic Values ```zig const ipld = @import("ipld"); const Kind = ipld.Kind; const Value = ipld.Value; // ipld.Value is a union over ipld.Kind: enum { // null, boolean, integer, float, string, bytes, list, map, link // } // the kinds [null, boolean, integer, float] have static values. // the kinds [string, bytes, list, map, link] are pointers to // allocated ref-counted objects const false_val = Value.False; const true_val = Value.True; const null_val = Value.Null; const float_val = Value.float(15.901241); // integer values are all i64. // integer values outside this range are not supported. const int_val = Value.integer(-8391042); pub fn main() !void { // this copies the contents of the argument, // the object string_val owns its own data. const string_val = try Value.createString(allocator, "hello world"); defer string_val.unref(); // unref() decrements the refcount <code>const list_val = try Value.createList(allocator, .{}); // appending an existing value here will increment string_val's refcount, // keeping it alive for as long as list_val lives. try list_val.list.append(string_val); // for convenience, you can also pass a tuple of "initial values" to createList. // this *will not* increment the refcount of the initial values, which is // useful for initializing deeply nested objects in a single expression. const list_val2 = try Value.createList(allocator, .{ try Value.createList(allocator, .{ try Value.createList(allocator, .{ try Value.createList(allocator, .{}), }), }), }); defer list_val2.unref(); // this created [[[[]]]], which will all be freed // when `defer list_val2.unref()` is invoked // maps are similar, with an initial struct argument that // doesn't increment initial value's refcounts const map_val = try Value.createMap(allocator, .{ .foo = try Value.createString(allocator, "initial value 1"), .bar = try Value.createString(allocator, "initial value 2"), }); defer map_val.unref(); // this increments string_val's refcount. // map keys are copied with the map's allocator and managed by the map. try map_val.map.set("baz", string_val); </code> } ``` Encoding dynamic values <code>dag-cbor</code> and <code>dag-json</code> both export <code>Encoder</code> structs with identical APIs. Here's an example with a dag-json encoder: ```zig const std = @import("std"); const ipld = @import("ipld"); const Value = ipld.Value; test "encode a dynamic value" { const allocator = std.heap.c_allocator; const example_value = try Value.createList(allocator, .{ try Value.createList(allocator, .{}), try Value.createList(allocator, .{ Value.Null, Value.integer(42), Value.True, }), }); <code>var encoder = json.Encoder.init(allocator, .{}); defer encoder.deinit(); const bytes = try encoder.encodeValue(allocator, example_value); defer allocator.free(bytes); try std.testing.expectEqualSlices(u8, "[[],[null,42,true]]", json_bytes); </code> } ``` The encoders must be initialized with an allocator, which is used for internal encoder state. Each <code>encodeValue</code> call takes its own allocator that it <strong>only</strong> uses for allocating the resulting <code>[]const u8</code> slice. Decoding dynamic values <code>dag-cbor</code> and <code>dag-json</code> both export <code>Decoder</code> structs with identical APIs. Here's an example with a dag-json decoder: ```zig const std = @import("std"); const ipld = @import("ipld"); const Value = ipld.Value; test "decode a dynamic value" { const allocator = std.heap.c_allocator; <code>var decoder = json.Decoder.init(allocator, .{}); defer decoder.deinit(); const value = try decoder.decodeValue(allocator, "[[],[null,42,true]]"); defer value.unref(); const expected_value = try Value.createList(allocator, .{ try Value.createList(allocator, .{}), try Value.createList(allocator, .{ Value.Null, Value.integer(42), Value.True, }), }); defer expected_value.unref(); try value.exepctEqual(expected_value); </code> ``` The decoders must be initialized with an allocator, which is used for internal encoder state. Each <code>decodeValue</code> call takes its own allocator that it uses for creating the actual Value elements, which does not have to be the same allocator used internally by the encoder. Static Types Instead of allocating dynamic <code>Value</code> values, you can also decode directly into Zig types using the <code>decodeType</code> / <code>readType</code> decoder methods, and encode Zig types directly with <code>encodeType</code> / <code>writeType</code> decoder methods. The patterns for Zig type mapping are as follows: <ol> <li><code>ipld.Value</code> types use the dynamic API; this is like an "any" type.</li> <li>booleans are IPLD Booleans</li> <li>integer types are IPLD Integers, and error when decoding an integer out of range</li> <li>float types are IPLD Floats</li> <li>slices, arrays, and tuple <code>struct</code> types are IPLD lists</li> <li>non-tuple <code>struct</code> types are IPLD Maps</li> <li>optional types are <code>null</code> for IPLD Null, and match the unwrapped child type otherwise</li> <li>for pointer types:</li> <li>encoding dereferences the pointer and encodes the child type</li> <li>decoding allocates an element with <code>allocator.create</code> and decodes the child type into it</li> </ol> A simple encoding example looks like this ```zig const ipld = @import("ipld"); const json = @import("dag-json"); const Foo = struct { abc: u32, xyz: bool }; test "encode a static type" { var encoder = json.Encoder.init(allocator, .{}); defer encoder.deinit(); <code>const data = try encoder.encodeType(Foo, allocator, .{ .bar = 8, .baz = false, }); defer allocator.free(data); try std.testing.expectEqualSlices(u8, "{\"abc\":8,\"xyz\":false}", data); </code> } ``` For decoding, <code>decodeType</code> returns a generic <code>Result(T)</code> struct that includes both the decoded <code>value: T</code> and a new <code>arena: ArenaAllocator</code> used for allocations within the value. This is unfortunately necessary since the decoder may encounter an error in the middle of decoding, and needs to be able to free the allocations in the partially-decoded value before returning the error to the user. ```zig const ipld = @import("ipld"); const json = @import("dag-json"); const Foo = struct { abc: u32, xyz: *const Bar }; const Bar = struct { id: u32, children: []const u32 }; test "decode nested static types" { var decoder = json.Decoder.init(allocator, .{}); defer decoder.deinit(); <code>const result = try encoder.decodeType(Foo, allocator, \\{"abc":8,"xyz":{"id":9,"children":[1,2,10,87421]}}" ); defer result.deinit(); // calls result.arena.deinit() inline // result: json.Decoder.Result(Foo) is a struct { // arena: std.heap.ArenaAllocator, // value: Foo, // } try std.testing.expectEqual(result.value.abc, 8); try std.testing.expectEqual(result.value.xyz.id, 9); try std.testing.expectEqualSlices(u32, result.value.xyz.children, &amp;.{1, 2, 10, 87421}); </code> } ``` Strings and Bytes Handling strings and bytes is a point of unavoidable awkwardness. Idiomatic Zig generally uses <code>[]const u8</code> for both of these, but this is indistinguishable from "an array of <code>u8</code>" to zig-ipld. Furthermore, it's not possible to tell whether a user intends <code>[]const u8</code> to mean "string" or "bytes", and would be inappropriate to guess. The simplest way to use strings and bytes in static types is to use the special struct types <code>String</code> and <code>Bytes</code> exported from the <code>ipld</code> module, which have a single <code>data: []const u8</code> field. Note that these are different than the dynamic values <code>Value.String</code> and <code>Value.Bytes</code>. ```zig const std = @import("std"); const allocator = std.heap.c_allocator; const ipld = @import("ipld"); const json = @import("dag-json"); const User = struct { id: u32, email: ipld.String, }; test "encode static User" { var encoder = json.Encoder.init(allocator, .{}); defer encoder.deinit(); <code>const bytes = try encoder.encodeType(User, allocator, .{ .id = 10, .email = .{ .data = "johndoe@example.com" }, }); defer allocator.free(bytes); try std.testing.expectEqualSlices(u8, bytes, \\{"email":"johndoe@example.com","id":10} ); </code> } test "decode static User" { var decoder = json.Decoder.init(allocator, .{}); defer decoder.deinit(); <code>const result = try decoder.decodeType(User, allocator, \\{"email":"johndoe@example.com","id":1} ); defer result.deinit(); try std.testing.expectEqual(result.value.id, 1); try std.testing.expectEqualSlices(u8, result.value.email.data, "johndoe@example.com"); </code> } ``` If you want more flexibility, you can also add public function declarations to your struct/enum/union types to handle parsing to and from strings or bytes manually. To represent a struct/enum/union as a string, add declarations <ul> <li><code>pub fn parseIpldString(allocator: std.mem.Allocator, data: []const u8) !@This()</code></li> <li><code>pub fn writeIpldString(self: @This(), writer: std.io.AnyWriter) !void</code></li> </ul> For bytes, add <ul> <li><code>pub fn parseIpldBytes(allocator: std.mem.Allocator, data: []const u8) !@This()</code></li> <li><code>pub fn writeIpldBytes(self: @This(), writer: std.io.AnyWriter) !void</code></li> </ul> These are what the <code>String</code> and <code>Bytes</code> structs internally. When parsing, they copy <code>data</code> using <code>allocator</code>, and when writing, they just call <code>writer.writeAll(self.data)</code>. ```zig pub const Bytes = struct { data: []const u8, <code>pub fn parseIpldBytes(allocator: std.mem.Allocator, data: []const u8) !Bytes { const copy = try allocator.alloc(u8, data.len); @memcpy(copy, data); return .{ .data = copy }; } pub fn writeIpldBytes(self: Bytes, writer: std.io.AnyWriter) !void { try writer.writeAll(self.data); } </code> }; pub const String = struct { data: []const u8, <code>pub fn parseIpldString(allocator: std.mem.Allocator, data: []const u8) !String { const copy = try allocator.alloc(u8, data.len); @memcpy(copy, data); return .{ .data = copy }; } pub fn writeIpldString(self: String, writer: std.io.AnyWriter) !void { try writer.writeAll(self.data); } </code> }; ``` For parsing, keep in mind that <code>allocator</code> is an arena allocator attached to the top-level <code>Result(T)</code>, so try to avoid making temporary allocations since they will be tied to the lifetime of the result even if you call <code>allocator.free(...)</code> etc.
[]
https://avatars.githubusercontent.com/u/30970706?v=4
mimalloc.zig
theseyan/mimalloc.zig
2024-12-17T15:03:59Z
Simple Zig Allocator interface over mimalloc.
main
0
2
0
2
https://api.github.com/repos/theseyan/mimalloc.zig/tags
MIT
[ "mimalloc", "zig", "zig-package" ]
3
false
2025-05-11T09:36:56Z
true
true
0.13.0
github
[ { "commit": "refs", "name": "macos_sdk", "tar_url": "https://github.com/mitchellh/zig-build-macos-sdk/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/mitchellh/zig-build-macos-sdk" }, { "commit": "refs", "name": "mimalloc_c", "tar_url": "https://github.com/micr...
mimalloc.zig A simple implementation of Zig's <code>std.mem.Allocator</code> interface over the excellent <a>mimalloc</a> by Microsoft. Usage ``` const mimalloc = @import("mimalloc").Allocator{}; const allocator = mimalloc.allocator(); // Use <code>allocator</code> here... ``` Tests Run the tests: <code>zig build test</code>
[]
https://avatars.githubusercontent.com/u/187193730?v=4
ztp
solomonarul/ztp
2024-12-25T18:53:01Z
A simple FTP server and client implementation in Zig.
main
0
2
0
2
https://api.github.com/repos/solomonarul/ztp/tags
-
[ "ftp", "zig" ]
9
false
2025-01-05T23:16:15Z
true
true
unknown
github
[]
ZTP ZTP is a simple FTP server and client implementation in Zig. It can be used as a standalone executable or be compiled as a library if needed in one's own application. The server is intentionally designed with a single client logged in and working at all times, thus prone to blocking. (TODO: maybe multithread?) What works: <ul> <li> Server-side supported commands: <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Logging in. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Listing files. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Changing working directory. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Uploading a file. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Downloading a file. </li> <li> Client-side supported commands: <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Logging in. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Listing files. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Changing working directory. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Uploading a file. <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Downloading a file. </li> </ul>
[]
https://avatars.githubusercontent.com/u/73006620?v=4
zig-gol
rozukke/zig-gol
2024-10-10T08:42:38Z
Game of Life implemented with Raylib and Zig.
main
0
2
0
2
https://api.github.com/repos/rozukke/zig-gol/tags
MIT
[ "game-of-life", "raylib", "zig" ]
91
false
2024-10-22T14:39:36Z
true
true
unknown
github
[ { "commit": "devel.tar.gz", "name": "raylib-zig", "tar_url": "https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz.tar.gz", "type": "remote", "url": "https://github.com/Not-Nik/raylib-zig" } ]
zig-gol (Game of Life in Zig) This is a simple implementation of Conway's game of life using Raylib bindings in Zig. Current features <ul> <li>Pan, zoom, camera clamp</li> <li>Pause sim</li> <li>Clear and randomize cells</li> <li>Draw cells</li> </ul> Planned features <ul> <li>Screen resize/fps change</li> <li>Pretty colors</li> <li>Rules menu (neighborhoods, dead/alive rules, edge looping)</li> </ul>
[]
https://avatars.githubusercontent.com/u/61627919?v=4
farbe
nuIIpointerexception/farbe
2024-12-09T22:37:28Z
A optimized color module and library for high performance applications.
main
1
2
1
2
https://api.github.com/repos/nuIIpointerexception/farbe/tags
GPL-3.0
[ "cpp", "rust", "zig", "zig-library", "zig-package" ]
56
false
2024-12-16T01:11:50Z
true
true
unknown
github
[]
Farbe A optimized color module and library for high performance applications. Features Various different color formats are supported: - RGBA - HSLA - HSV also we can: - Blending between colors - Hexadecimal color parsing - Comptime checks (Zig only) Build Zig <code>sh zig build [-Dtype=(static|dynamic] [-Dbinding=(c|cpp|zig]</code> Defaults: <ul> <li><code>type</code> = <code>static</code></li> <li><code>binding</code> = <code>zig</code></li> </ul> Examples ```sh // zig zig build run -Dname=ansi // c zig build run -Dname=c // cpp zig build run -Dname=cpp ``` Usage Zig ```zig const farbe = @import("farbe"); // Create a new RGBA color const red = farbe.rgba(0xFF0000FF); // Blend two colors together const blue = farbe.rgba(0x0000FFFF); const purple = red.blend(blue); // Convert a color to a u32 value const u32_value = red.toU32(); // Create a new HSLA color const hsla = farbe.hsla(0.0, 1.0, 0.5, 1.0); // Convert a color to an HSLA color const hsla = red.toHsla(); // Blend two colors together const blue = farbe.hsla(240.0 / 360.0, 1.0, 0.5, 1.0); const purple = red.blend(blue); // Convert a color to an RGBA color const rgba = hsla.toRgba(); // Create a new HSLA color with opacity adjusted const faded = hsla.opacity(0.5); // Create a new HSLA color with opacity adjusted const gray = hsla.grayscale(); // Fade out a color hsla.fadeOut(0.5); ``` C / C++ Use the <a>farbe.h</a> header file provided in the include directory. ```c++ include "farbe.h" // C farbe_hsla_t blue = farbe_hsla_create(240.0f/360.0f, 1.0f, 0.5f, 1.0f); // C++ farbe::Hsla blue = farbe::Hsla(240.0f/360.0f, 1.0f, 0.5f, 1.0f); ``` Rust Use the <a>farbe-rs</a> crate provided in the include directory. ```rust use farbe_rs::{Hsla, Rgba}; let blue = Hsla::new(240.0f/360.0f, 1.0f, 0.5f, 1.0f); ``` License This project is licensed under the GLPLv3 license - see the <a>LICENSE</a> file for details.
[ "https://github.com/fjebaker/zorro" ]
https://avatars.githubusercontent.com/u/6328046?v=4
oracle_tocsv
ceyhunkerti/oracle_tocsv
2024-12-15T13:37:48Z
oracle query to csv fast extraction utility
main
0
2
0
2
https://api.github.com/repos/ceyhunkerti/oracle_tocsv/tags
-
[ "csv", "extraction", "oci", "odpi-c", "oracle", "zig" ]
50
false
2025-01-01T18:46:25Z
true
true
unknown
github
[ { "commit": "refs", "name": "zdt", "tar_url": "https://github.com/FObersteiner/zdt/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/FObersteiner/zdt" }, { "commit": "refs", "name": "ymlz", "tar_url": "https://github.com/pwbh/ymlz/archive/refs.tar.gz", "type"...
Oracle to CSV Extraction Utility <ul> <li>Extracts data from an oracle query and outputs to csv.</li> <li>~3.7x faster than a plugin based JDBC implementation. (with same parameters.)</li> </ul> Build from source You may need to setup instant client paths if you don't have it already. <ul> <li>Download oracle instant client from <a>here</a></li> <li> Extract it to a path and set the <code>LD_LIBRARY_PATH</code>. <code>sh export LD_LIBRARY_PATH=/path/to/instantclient_[version]</code> </li> <li> Install <a>zig</a>. </li> <li> You may need to install <code>libaio</code> required by oracle client. <code>sh sudo apt install libaio1</code> </li> <li> todo: implement this in Makefile and remove Justfile. </li> <li> Download ODPI-C and place the extracted resources to <code>project-root/lib/odpi</code> </li> <li> Build the binary. <code>sh zig build -Doptimize=ReleaseFast</code> </li> <li> See the binary <code>ox</code> at <code>zig-out/bin/</code>. </li> </ul> Running <code>sh zig-out/bin/ox run \ # change below to actual connection string. --connection-string "localhost:1521/ORCLCDB" \ --username oracle_username \ # optional (auth mode if you need SYSDBA) --auth-mode SYSDBA \ --password oracle_password \ # You can use multi line strings see examples folder. --sql "SELECT * FROM my_schema.my_table_name" \ # output-file can be an absolute path. --output-file "output.csv" \ --fetch-size 10000</code> todo <ul> <li>Documentation</li> <li>Add benchmark results</li> </ul>
[]
https://avatars.githubusercontent.com/u/150271141?v=4
z-tree-sitter
lfcm64/z-tree-sitter
2024-09-07T16:26:41Z
Zig wrapper for tree-sitter C API
main
0
2
1
2
https://api.github.com/repos/lfcm64/z-tree-sitter/tags
MIT
[ "tree-sitter", "wrapper", "zig" ]
15
false
2025-01-11T06:08:21Z
true
true
unknown
github
[ { "commit": "refs", "name": "tree_sitter_api", "tar_url": "https://github.com/tree-sitter/tree-sitter/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/tree-sitter/tree-sitter" }, { "commit": "refs", "name": "bash", "tar_url": "https://github.com/tree-sitter/tree...
z-tree-sitter 🌳 A Zig package that provides a complete wrapper around <a>tree-sitter API</a>, along with built-in support for well-known languages grammar (see <a>supported languages grammar</a>). The current version of z-tree-sitter supports tree-sitter 0.23.0. Documentation You can find documentation directly from the <a>tree-sitter API header</a> or on the <a>tree-sitter website</a>. All wrapper functions and types are demonstrated in the <a>tests file</a>, where you can see Zig equivalents of the C tree-sitter API. <ul> <li>Run tests with <code>zig build test -- --all-language</code></li> <li>Run an example with <code>zig build example-&lt;name&gt; -- --language zig</code></li> </ul> Example code is included in the <a>examples</a> directory. The --all-languages argument includes all built-in language grammars in z-tree-sitter, which is necessary for running tests. The --language argument installs only the language grammar specified after it (usefull for running examples). Install z-tree-sitter in your project To integrate z-tree-sitter into your project, you can either find the appropriate version archive in this github repo, or simply run: <code>zig fetch --save git+https://github.com/lfcm64/z-tree-sitter</code> to add the most recent commit of ziglua to your <code>build.zig.zon</code> file. Then in your <code>build.zig</code> file you can use the dependency: ```zig pub fn build(b: *std.Build) void { // ... snip ... <code>const zts = b.dependency("zts", .{ .target = target, .optimize = optimize, }); // ... snip ... // add the z-tree-sitter module exe.root_module.addImport("zts", zts.module("zts")); </code> } ``` This will compile the C tree-sitter library and link it with your project. Install tree-sitter grammars in your project To compile and use tree-sitter grammar with z-tree-sitter, pass the relevant options in the <code>b.dependency()</code> call in your <code>build.zig</code> file. For example, here is a <code>b.dependency()</code> call that links erlang and javascript grammar to z-tree-sitter: <code>zig const zts = b.dependency("zts", .{ .target = target, .optimize = optimize, .erlang = true, .javascript = true, });</code> You can then load and use the imported grammar languages by calling <code>zts.loadLanguage()</code>, see this <a>example</a> for more details. Supported languages Grammar Here is a list of all available languages grammar: <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>bash</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>c</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>css</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>cpp</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>c-sharp</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>elixir</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>elm</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>erlang</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>fsharp</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>go</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>haskell</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>java</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>javascript</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>json</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>julia</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>kotlin</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>lua</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>markdown</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>nim</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>ocaml</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>perl</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>php</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>python</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>ruby</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>rust</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>scala</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>toml</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>typescript</a> <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> <a>zig</a>
[]
https://avatars.githubusercontent.com/u/87294692?v=4
tellme-dev
vspefs/tellme-dev
2024-12-21T17:22:43Z
A Zig package that (sort of) allows comptime polymorphism
master
0
2
0
2
https://api.github.com/repos/vspefs/tellme-dev/tags
GPL-3.0
[ "zig", "zig-package" ]
20
false
2025-02-22T10:46:37Z
true
true
unknown
github
[]
404
[]
https://avatars.githubusercontent.com/u/116913262?v=4
leetcode
sebastiandotdev/leetcode
2024-11-24T03:20:08Z
An environment with open source resources and exercises.
main
4
2
0
2
https://api.github.com/repos/sebastiandotdev/leetcode/tags
MIT
[ "c", "leetcode", "python", "shell", "typescript", "zig" ]
149
false
2025-05-16T02:54:39Z
false
false
unknown
github
[]
Leetcode Leetcode exercises for programming skills. Resources <strong>JavaScript</strong> <ul> <li>https://swapy.tahazsh.com/</li> <li>https://github.com/hexagoncircle/pixel-canvas</li> <li>https://pdfslick.dev/</li> <li>https://base-ui.com/</li> <li>https://originui.com/</li> <li>https://uipub.com/</li> </ul> <strong>HTML</strong> <ul> <li>https://caninclude.glitch.me</li> </ul> <strong>CSS</strong> <ul> <li>https://www.shapedivider.app/</li> <li>https://photogradient.com/</li> <li>https://fontjoy.com/</li> <li>https://colourpalettegenerator.com/</li> <li>https://cssgradienttext.com/</li> <li>https://easingwizard.com/</li> <li>https://flexboxlabs.netlify.app/</li> <li>https://layout.bradwoods.io/</li> <li>https://magecdn.com/tools/svg-loaders</li> <li>https://www.gradii.fun/</li> <li>https://icons.pqoqubbw.dev/</li> <li>https://whatunit.com</li> <li>https://tailark.com/</li> <li>https://evilmartians.com/chronicles/oklch-in-css-why-quit-rgb-hsl</li> <li>https://designsystems.surf/</li> <li>https://ishadeed.com/article/modern-attr/</li> </ul> <strong>APIs</strong> <ul> <li>https://ipquery.io</li> <li>https://retool.com/api-generator</li> <li>https://fey.com/logos</li> <li>https://transform․tools</li> <li>https://godly.website/</li> <li>https://quickref.me/</li> <li>https://www.resumego.net/resume-checker/</li> <li>https://lawsofux.com/es/</li> </ul> <strong>Zig</strong> <ul> <li>https://www.openmymind.net/learning_zig/</li> <li>https://zig.guide/</li> <li>https://cookbook.ziglang.cc/</li> </ul> License <a>MIT</a>
[]
https://avatars.githubusercontent.com/u/101195284?v=4
clickhouse-zig
0xrinegade/clickhouse-zig
2024-10-31T10:27:34Z
blazigly fast Clickhouse client ⚡️
main
0
2
1
2
https://api.github.com/repos/0xrinegade/clickhouse-zig/tags
Unlicense
[ "blazigly", "clickhouse", "zig", "ziglang" ]
20
false
2024-12-14T11:38:40Z
true
false
unknown
github
[]
clickhouse-zig clickhouse client for zig
[]
https://avatars.githubusercontent.com/u/38505104?v=4
kirin-chess
strvdr/kirin-chess
2024-12-10T19:30:11Z
Kirin Chess is my second chess engine, this time written in Zig.
main
0
2
0
2
https://api.github.com/repos/strvdr/kirin-chess/tags
GPL-3.0
[ "chess", "chess-engine", "zig", "ziglang" ]
33,705
false
2025-04-16T04:41:01Z
true
false
unknown
github
[]
Kirin Chess Engine <a></a> The original Kirin Chess Engine was written in C and the source code is available <a>here</a>. I have since deprecated this project and am now writing the Kirin Chess Engine in Zig. Authors <ul> <li><a>Strydr Silverberg - @strvdr</a></li> </ul> Documentation I write a weekly devlog which you can view at <a>strydr.net</a>. These devlogs are meant to serve as a walk through my thought process while building Kirin, as well as a limited form of documentation of the project. I am also working on a documentation website for Kirin, which will be available at a subdomain to my website in the coming months. Roadmap <ul> <li>Bitboard board representation ✅</li> <li>Pre-calculated attack tables ✅</li> <li>Magic bitboards ✅</li> <li>Encoding moves as a packed struct ✅</li> <li>Copy/make approach for making moves ✅</li> <li>Pseudolegal move generation with immediate legality testing ✅</li> <li>Negamax search with alpha beta pruning</li> <li>PV/killer/history move ordering</li> <li>Iterative deepening</li> <li>PVS (Principle Variation Search)</li> <li>LMR (Late Move Reduction)</li> <li>NMP (Null Move Pruning)</li> <li>Razoring</li> <li>Evaluation pruning / static null move pruning</li> <li>Transposition table (up to 128MB)</li> <li>PURE Stockfish NNUE evaluation + 50 move rule penalty</li> <li>UCI protocol</li> </ul> Usage Zig is a new programming language that hasn't reached v1.0 at the time of writing this. Because of this, development of the Zig language is constantly ongoing. I currently use the <a>Zig Nightly AUR package</a> which is being consistently updated. There is also a <a>homebrew</a> version of the nightly bin for Mac users. The Zig build system is super robust and easy to use, here are a few commands you can run, with more to be added down the road: <code>zig zig build # Build the project zig build run # Run Kirin Chess zig build test # Run tests zig build perft # Run perft tests zig build magic # Generate magic numbers</code> License <a>GPL v3</a> Acknowledgements Thank you greatly to Maksim Korzh, without whom I would not have been able to write Kirin. Also, thank you to the people on the Talk Chess forum and the Chess Programming Wiki for putting together resources used in the creation of Kirin. Also thank you to Hejsil for suggesting that I change the encoding of moves from an integer to a packed struct. This lead me down a rabbit hole of improvements and modifications. <ul> <li><a>Maksim Korzh</a></li> <li><a>Talk Chess</a></li> <li><a>ChessProgramming Wiki</a></li> <li><a>Hejsil</a></li> </ul>
[]
https://avatars.githubusercontent.com/u/113565070?v=4
zgll
Darkfllame/zgll
2024-08-19T23:28:29Z
Simple zig OpenGL loader
main
0
2
0
2
https://api.github.com/repos/Darkfllame/zgll/tags
MIT
[ "opengl", "zig" ]
339
false
2025-03-19T21:37:24Z
true
true
unknown
github
[]
Zig openGL Loader Simple opengl loader, entirely written in Zig. All functions are under <code>zgll.GL</code>, all constants and function got their prefix removed (<code>GL_</code> and <code>gl</code>) for easier typing. Don't expect much updates, might do extension loader soon... Beware though This library was mostly made in a night, so expect typos, incoherent names and more...
[ "https://github.com/Darkfllame/ZWL" ]
https://avatars.githubusercontent.com/u/1916079?v=4
zig-picohttpparser
vrischmann/zig-picohttpparser
2024-12-22T00:50:58Z
Small Zig wrapper for picohttpparser
master
0
2
0
2
https://api.github.com/repos/vrischmann/zig-picohttpparser/tags
MIT
[ "http", "picohttpparser", "zig" ]
19
false
2025-04-29T18:29:09Z
true
true
unknown
github
[ { "commit": "master", "name": "picohttpparser", "tar_url": "https://github.com/allyourcodebase/picohttpparser/archive/master.tar.gz", "type": "remote", "url": "https://github.com/allyourcodebase/picohttpparser" } ]
zig-picohttpparser This is a small Zig wrapper to use <a>picohttpparser</a>. <code>picohttpparser</code> could be used directly but this wrapper makes it feel more idiomatic Zig. This package leverages the Zig build system and is based on <a>zig-picohttpparser-sys</a>. Supported Zig version Only Zig master is currently supported. Once 0.14.0 is released we should be able to support it. Installation Use <code>zig fetch</code>: <code>zig fetch --save git+https://github.com/vrischmann/zig-picohttpparser#master</code> You can then import <code>picohttpparser</code> in your <code>build.zig</code>: ```zig const picohttpparser = b.dependency("picohttpparser", .{ .target = target, .optimize = optimize, }); your_exe.addImport("picohttpparser", picohttpparser.module("picohttpparser")); ``` Features implemented picohttpparser doesn't have many features. The following is a list of what is implemented in this wrapper. <ul> <li>[x] Parsing a request</li> <li>[ ] Parsing a response</li> <li>[ ] Parsing chunk-encoded data</li> <li>[ ] Parsing headers only</li> </ul> Usage There is only one function exposed, <code>parseRequest</code>: <code>pub fn parseRequest(buffer: []const u8, previous_buffer_len: usize) ParseRequestError!?ParseRequestResult {</code> This function takes in a <em>buffer</em> and a <em>previous buffer length</em> and returns either a parsing error or a result. The buffer is easy to understand, it's the string you want to parse as an HTTP request. The previous buffer length is the length in the current buffer that you already tried to parse. This is needed to resume parsing incomplete buffers. The returned result contains the raw request (of type <code>RawRequest</code>) and the number of bytes consumed from the buffer. Here is an example usage: ```zig const std = @import("std"); const picohttpparser = @import("picohttpparser"); pub fn main() !void { const data = "GET /lol/foo HTTP/1.0\r\nfoo: ab\r\nContent-Length: 200\r\n\r\n"; <code>if (try picohttpparser.parseRequest(data, 0)) |result| { std.log.info("request: {s}, consumed: {d}", .{ result.raw_request.getPath(), result.consumed }); } </code> } ``` This assumes the data is complete, in the real world you probably can't assume this. You probably want to do something like this: ```zig var buf = std.ArrayList(u8).init(allocator); const result = while (true) { // Feed more data to buf somehow: read from a socket, copy from another buffer, etc <code>if (try picohttpparser.parseRequest(buf.items, 0)) |result| { break result; } </code> }; // Use the result ``` Look into <a>example/main.zig</a> for a more complete example. You can also take a look at my project <a>zig-io_uring-http-server</a> where I <a>use <code>picohttpparser</code></a>.
[]
https://avatars.githubusercontent.com/u/42117154?v=4
love-you-mom
ona-li-toki-e-jan-Epiphany-tawa-mi/love-you-mom
2024-11-13T21:35:37Z
Tells your mom (or dad) that you love them | Mirror of https://paltepuk.xyz/cgit/love-you-mom.git/about/
master
0
2
1
2
https://api.github.com/repos/ona-li-toki-e-jan-Epiphany-tawa-mi/love-you-mom/tags
GPL-3.0
[ "fun", "posix", "terminal", "termios", "zig" ]
63
false
2025-03-07T01:59:26Z
true
false
unknown
github
[]
love-you-mom Tells your mom (or dad) that you love them. Press ANY KEY to exit. How to build Depdenencies: <ul> <li>libc.</li> <li>zig 0.13.0 (other versions may work) - <a>https://ziglang.org</a></li> <li>POSIX system.</li> </ul> There's a <code>flake.nix</code> you can use to generate a development enviroment with <code>nix develop</code>. Then, run the following command(s): <code>sh zig build</code> You can append the following arguments for different optimizations: <ul> <li><code>-Doptimize=ReleaseSafe</code> - Faster.</li> <li><code>-Doptimize=ReleaseFast</code> - Fasterer, no safety checks.</li> <li><code>-Doptimize=ReleaseSmall</code> - Faster, smaller binaries, no safety checks.</li> </ul> The executable will appear in <code>zig-out/bin/</code>. Installation You can install it with Nix from my personal package repository <a>https://paltepuk.xyz/cgit/epitaphpkgs.git/about</a>.
[]
https://avatars.githubusercontent.com/u/57362253?v=4
oniguruma.zig
tiawl/oniguruma.zig
2024-11-02T17:18:47Z
oniguruma packaged for @ziglang
trunk
0
2
0
2
https://api.github.com/repos/tiawl/oniguruma.zig/tags
Unlicense
[ "binding", "oniguruma", "zig", "zig-package", "ziglang" ]
620
false
2025-05-07T10:12:51Z
true
true
0.14.0
github
[ { "commit": "master", "name": "toolbox", "tar_url": "https://github.com/tiawl/toolbox/archive/master.tar.gz", "type": "remote", "url": "https://github.com/tiawl/toolbox" } ]
oniguruma.zig This is a fork of <a>kkos/oniguruma</a> to package the libonig C API for <a>Zig</a> Why this fork ? The intention under this fork is to package <a>kkos/oniguruma</a> for <a>Zig</a>. So: * Unnecessary files have been deleted, * The build system has been replaced with <code>build.zig</code>, * A cron runs every day to check <a>kkos/oniguruma</a>. Then it updates this repository if a new release is available. How to use it The goal of this repository is not to provide a <a>Zig</a> binding for <a>kkos/oniguruma</a>. There are at least as many legit ways as possible to make a binding as there are active accounts on Github. So you are not going to find an answer for this question here. The point of this repository is to abstract the <a>kkos/oniguruma</a> compilation process with <a>Zig</a> (which is not new comers friendly and not easy to maintain) to let you focus on your application. So you can use <strong>oniguruma.zig</strong>: - as raw (no available example now), - as a daily updated interface for your <a>Zig</a> binding of <a>kkos/oniguruma</a> (no available exemple now). Dependencies The <a>Zig</a> part of this package is relying on the latest <a>Zig</a> release (0.14.0) and will only be updated for the next one (so for the 0.14.1). Here the repositories' version used by this fork: * <a>kkos/oniguruma</a> CICD reminder These repositories are automatically updated when a new release is available: * <a>tiawl/libjq.zig</a> This repository is automatically updated when a new release is available from these repositories: * <a>kkos/oniguruma</a> * <a>tiawl/toolbox</a> <code>zig build</code> options These additional options have been implemented for maintainability tasks: <code>-Dfetch Update .references folder and build.zig.zon then stop execution -Dupdate Update binding</code> License This repository is not subject to a unique License: The parts of this repository originated from this repository are dedicated to the public domain. See the LICENSE file for more details. <strong>For other parts, it is subject to the License restrictions their respective owners choosed. By design, the public domain code is incompatible with the License notion. In this case, the License prevails. So if you have any doubt about a file property, open an issue.</strong>
[]
https://avatars.githubusercontent.com/u/79549577?v=4
zart
ross96D/zart
2024-11-04T21:56:25Z
Implementation of the adaptive radix tree
master
0
2
0
2
https://api.github.com/repos/ross96D/zart/tags
MIT
[ "radix-tree", "tree", "zig" ]
2,871
false
2025-05-08T20:22:05Z
true
true
0.14.0
github
[]
Summary This repository is an implementation of the adaptive radix tree described on <a>The adaptive radix tree: ARTful indexing for main-memory databases</a>. TODO <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Add fuzzy test <br/><input type='checkbox' class='w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' disabled></input> Implement a memory pool strategy for fast node allocation/deallocation. Make it configurable at build time. <br/><input type='checkbox' class='w-4 h-4 text-green-500 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600' checked disabled></input> Node size is to large (64 bytes), Node3 take a 32 bytes, have an almost always null pointer to Leaf. Partial is 16 bytes, ideally Node size should be 24 bytes. This reduce memory consumption and may improve speed as more nodes can fit on the cache layer. Benchmark results against std.StringHashMap This adaptative radix implementation copys the part of the key necessary to not depend on the passed key so is not equivalent to StringHashMap on this aspect, which give StringHashMap a huge advantage. But either way this is a perspective on how fast/slow and memory efficient the implementation is. v1 ``` StringHashMap StringHashMap memory VmData: 23740 kB VmStk: 136 kB VmExe: 216 kB VmLib: 8 kB VmPTE: 100 kB VmSwap: 0 kB insert 18ms, search 5ms, delete 5ms combined 29ms StringHashMap allocator stats allocations: 17 deallocations: 16 allocated_bytes: 26214608 freed_bytes: 13107384 Adaptative radix tree Adaptative radix tree memory VmData: 75788 kB VmStk: 136 kB VmExe: 216 kB VmLib: 8 kB VmPTE: 212 kB VmSwap: 0 kB insert 41ms, search 18ms, delete 43ms combined 103ms Adaptative radix tree allocator stats allocations: 573197 deallocations: 259093 allocated_bytes: 29079664 freed_bytes: 7181976 ``` v2 pool allocator for Node ``` ArtAdaptative radix tree Adaptative radix tree memory VmData: 52004 kB VmStk: 136 kB VmExe: 228 kB VmLib: 8 kB VmPTE: 172 kB VmSwap: 0 kB avg: 7.325801446461426 max: 18 min: 1 insert 45ms, search 18ms, delete 55ms combined 119ms Adaptative radix tree allocator stats allocations: 254717 deallocations: 236440 allocated_bytes: 25398584 freed_bytes: 5744936 ``` v3 pool allocator for Node and Leaf ``` Adaptative radix tree Adaptative radix tree memory VmData: 42764 kB VmStk: 136 kB VmExe: 224 kB VmLib: 8 kB VmPTE: 136 kB VmSwap: 0 kB avg: 7.325801446461426 max: 18 min: 1 insert 36ms, search 18ms, delete 30ms combined 85ms Adaptative radix tree allocator stats allocations: 19531 deallocations: 1252 allocated_bytes: 31314464 freed_bytes: 11659912 ```
[]
https://avatars.githubusercontent.com/u/100069060?v=4
cogito
Dok8tavo/cogito
2024-12-05T20:36:21Z
Cogito is a zig module that provides comptime only types for high-level metaprogramming.
main
0
2
0
2
https://api.github.com/repos/Dok8tavo/cogito/tags
MIT
[ "metapr", "module", "types", "zig" ]
164
false
2025-03-12T21:24:42Z
true
true
0.13.0
github
[]
Cogito Cogito is a zig module that offers compile-time only types for high-level metaprogramming. Since zig's <code>comptime</code> can compute types as it goes and allocate memory at will, it should be able to use the same kind of abstractions as dynamically-typed languages. Cogito implement the following types: <ul> <li><code>List</code>,</li> <li><code>Dict</code>,</li> <li><code>String</code>,</li> <li><code>StringSet</code>,</li> <li><code>StructGen</code>,</li> </ul> Usage <ol> <li> Fetch the package by running <code>zig fetch git+https://github.com/Dok8tavo/cogito --save=cogito</code> in the folder containing <code>build.zig.zon</code>. </li> <li> Get cogito in your <code>build.zig</code> script: </li> </ol> <code>zig pub fn build(b: *std.Build) !void { ... const cogito = b.dependency( // this must be the name you used in the `--save=` option "cogito", .{ .target = ..., .optimize = ..., }).module( // this one must be "cogito", it's the name of the module from inside // the package "cogito" ); ... }</code> <ol> <li>Add the import for your module/executable/library/test:</li> </ol> ```zig pub fn build(b: *std.Build) !void { ... const cogito = ...; <code>my_executable_library_or_test.root_module.addImport( // this can be whatever you want, it'll affect your `@import` calls "cogito", cogito, ); my_module.addImport( // same "cogito", cogito, ); ... </code> } ``` <ol> <li>Import the module in your source code:</li> </ol> <code>zig const cogito = @import( // this is the name you used in the `addImport` function in your // `build.zig` script. "cogito" );</code>
[]
https://avatars.githubusercontent.com/u/61068799?v=4
zig-cosmo
jcbhmr/zig-cosmo
2024-11-11T01:21:36Z
⚡ All-in-one multiplatform Zig binary
main
0
2
0
2
https://api.github.com/repos/jcbhmr/zig-cosmo/tags
MIT
[ "cosmopolitan", "single-executable", "zig", "ziglang" ]
18
false
2025-03-01T23:00:37Z
false
false
unknown
github
[]
Zig as an <a>Actually Portable Executable</a> ⚡ All-in-one multiplatform Zig binary ```sh wget https://github.com/jcbhmr/zig-ape/releases/download/0.13.0/zig-ape-0.13.0.zip unzip zig-ape-0.13.0.zip ./zig-ape-0.13.0/zig zen ``` 🌌 Uses <a><code>cosmocc</code></a> to build a multiplatform binary \ 📂 Extracts the platform-specific <code>zig</code> and <code>lib/*</code> files to a cache folder \ 💻 Works on Windows, macOS, and Linux on both x86-64 &amp; AArch64 CPUs \ <strong>😎 It's just one binary!</strong> Installation <strong>🛑 This is an unofficial redistribution of the Zig binaries.</strong> You should probably use <a>the official Zig download page</a>. <ol> <li>Download the ZIP.</li> <li>Extract it.</li> <li>Rename it to <code>zig.com</code> or <code>zig.exe</code>. (Windows only)</li> </ol> <strong>https://github.com/jcbhmr/zig-cosmo/releases/download/0.13.0/zig-ape-0.13.0.zip</strong> The all-in-one binary should work on Windows x86-64, Windows AArch64, macOS x86-64, macOS AArch64, Linux x86-64, Linux AArch64, and FreeBSD x86-64. <strong>For other platforms make sure you check out <a>Zig's official download page</a>.</strong> Development The GitHub actions workflow doesn't actually build Zig itself. That's too complex. Instead, it pulls the precompiled artifacts from the <a>Zig downloads page</a> and bundles them into a single ZIP archive. TODO: I need some assistance in handling non-zero exit codes and process signals properly in Windows. If anyone reading this knows how to <code>waitpid()</code> correctly please enlighten me! ️😊
[]
https://avatars.githubusercontent.com/u/196515647?v=4
GZZG
MinervasRefuge/GZZG
2025-01-26T08:34:01Z
A typed Zig wrapper for the Guile (scheme) C API.
main
0
2
0
2
https://api.github.com/repos/MinervasRefuge/GZZG/tags
BSD-3-Clause
[ "guile", "guile-scheme", "zig", "zig-package", "ziglang" ]
311
false
2025-04-16T22:38:07Z
true
true
0.14.0
github
[]
404
[]
https://avatars.githubusercontent.com/u/46354333?v=4
kafka.zig
vspaz/kafka.zig
2025-01-24T20:19:36Z
kafka.zig is a simple-to-use Apache Kafka Zig client built on top of C/C++ librdkafka.
main
0
2
0
2
https://api.github.com/repos/vspaz/kafka.zig/tags
-
[ "apache-kafka", "kafka-zig", "librdkafka", "zig", "zig-kafka", "zig-kafka-client", "zig-kafka-consumer", "zig-kafka-producer", "ziglang" ]
133
false
2025-03-29T23:59:52Z
true
true
0.14.0
github
[ { "commit": "master", "name": "kafka", "tar_url": "https://github.com/vspaz/kafka.zig/archive/master.tar.gz", "type": "remote", "url": "https://github.com/vspaz/kafka.zig" } ]
kafka.zig <code>kafka.zig</code> is the <strong>Apache Kafka Zig</strong> client library built on top of <strong>C/C++</strong> <a>librdkafka</a>. This lib makes it plain simple to write your own <strong>Apache Kafka</strong> producers and consumers in <strong>Zig</strong>. <code>kafka.zig</code> is also very lean and efficient. Installation <blockquote> <span class="bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300">IMPORTANT</span> <code>kafka.zig</code> relies on C/C++ <code>librdkafka</code>, so we need to install it first before we start using <code>kafka.zig</code>. The good news is that's the only dependency that's required by <code>kafka.zig</code>. 1. install <code>librdkafka</code> </blockquote> :penguin: Linux - .deb-based, e.g., Debian, Ubuntu etc. <code>shell apt-get install librdkafka-dev</code> :penguin: Linux - .rpm-based, e.g., RedHat, Fedora and other RHEL derivatives. <code>shell yum install librdkafka-devel</code> Mac OSX <code>shell brew install librdkafka</code> 2. Run the following command inside your project: <code>shell zig fetch --save git+https://github.com/vspaz/kafka.zig.git#main</code> it should add the following dependency to your project <em>build.zig.zon</em> file, e.g. <code>zig .dependencies = .{ .kafka = .{ .url = "git+https://github.com/vspaz/kafka.zig.git?ref=main#402ef4da4b79f46f23a1293eea9b13c11d754272", .hash = "kafka-0.7.0-B87dFvulAACRnv8FlqZuBKKerKC14TtV09AGxIaZJVc3", }, }</code> 3. Navigate to <em>build.zig</em> file located in the root directory and add the following 3 lines as shown below: ```zig const exe = b.addExecutable(.{ .name = "yourproject", .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); <code>// add these 3 lines! const kafkazig = b.dependency("kafka", .{}); exe.root_module.addImport("kafka", kafkazig.module("kafka")); exe.linkSystemLibrary("rdkafka"); </code> <code>4. Test the project build with `zig build` There should be no error! 5. Import `kafka.zig` client lib in your code as follows:</code>zig const kafka = @import("kafka"); ``` and you're good to go! :rocket: Configuration Producer/Consumer Configuration parameters can be set via <code>kafka.ConfigBuilder</code> An example of using <code>kafka.ConfigBuilder</code> ```zig const kafka = @import("kafka"); pub fn main() !void { var producer_config_builder = kafka.ConfigBuilder.get(); const producer_conf = producer_config_builder .with("bootstrap.servers", "localhost:9092") .with("enable.idempotence", "true") .with("batch.num.messages", "10") .with("reconnect.backoff.ms", "1000") .with("reconnect.backoff.max.ms", "5000") .with("transaction.timeout.ms", "10000") .with("linger.ms", "100") .with("delivery.timeout.ms", "1800000") .with("compression.codec", "snappy") .with("batch.size", "16384") .build(); } ``` <blockquote> [!TIP] see all possible config options at: https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md#global-configuration-properties </blockquote> Topic A topic is configured similarly to Producer/Consumer, but using <code>kafka.TopicBuilder</code> class. An example of configuring a topic via <code>kafka.TopicBuilder</code>. ```zig pub fn main() !void { var topic_config_builder = kafka.TopicBuilder.get(); const topic_conf = topic_config_builder .with("acks", "all") .build(); } ``` <blockquote> [!TIP] See all possible config options for a topic configuration at: https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md#topic-configuration-properties. </blockquote> Producers A simple Zig Apache Kafka producer sending plain text data. ```zig const kafka = @import("kafka"); fn plainTextProducer() void { var producer_config_builder = kafka.ConfigBuilder.get(); const producer_conf = producer_config_builder .with("bootstrap.servers", "localhost:9092") .with("enable.idempotence", "true") .with("batch.num.messages", "10") .with("reconnect.backoff.ms", "1000") .with("reconnect.backoff.max.ms", "5000") .with("transaction.timeout.ms", "10000") .with("linger.ms", "100") .with("delivery.timeout.ms", "1800000") .with("compression.codec", "snappy") .with("batch.size", "16384") .build(); <code>var topic_config_builder = kafka.TopicBuilder.get(); const topic_conf = topic_config_builder .with("acks", "all") .build(); const kafka_producer = kafka.Producer.init(producer_conf, topic_conf, "topic-name1"); defer kafka_producer.deinit(); kafka_producer.send("some payload", "key"); kafka_producer.wait(100); </code> } pub fn main() !void { plainTextProducer(); } <code>An example of a **Kafka Zig** producer, producing JSON or binary data.</code>zig const std = @import("std"); const kafka = @import("kafka"); fn jsonProducer() !void { var producer_config_builder = kafka.ConfigBuilder.get(); const producer_conf = producer_config_builder .with("bootstrap.servers", "localhost:9092") .with("enable.idempotence", "true") .with("batch.num.messages", "10") .with("reconnect.backoff.ms", "1000") .with("reconnect.backoff.max.ms", "5000") .with("transaction.timeout.ms", "10000") .with("linger.ms", "100") .with("delivery.timeout.ms", "1800000") .with("compression.codec", "snappy") .with("batch.size", "16384") .build(); <code>var topic_config_builder = kafka.TopicBuilder.get(); const topic_conf = topic_config_builder .with("acks", "all") .build(); const kafka_producer = kafka.Producer.init(producer_conf, topic_conf, "topic-name2"); defer kafka_producer.deinit(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); defer _ = gpa.deinit(); for (0..100) |_| { const message = .{ .key1 = 100, .key2 = "kafka" }; const encoded_message = try std.json.stringifyAlloc(allocator, message, .{}); defer allocator.free(encoded_message); kafka_producer.send(encoded_message, "key"); kafka_producer.wait(100); } </code> } pub fn main() !void { try jsonProducer(); } ``` Callbacks If you wish to set a callback, you can do it as follows: - <code>kafka.setCb</code>, ```zig const kafka = @import("kafka"); fn onMessageSent(message: kafka.Message) void { std.log.info("Message sent: {s}", .{message.getPayload()}); } fn producer() void { var producer_config_builder = kafka.ConfigBuilder.get(); const producer_conf = producer_config_builder .with("bootstrap.servers", "localhost:9092") .build(); <code>kafka.setCb(producer_conf, onMessageSent); </code> } <code>- `kafka.setErrCb`,</code>zig const kafka = @import("kafka"); fn onError(err: i32, reason: [*c]const u8) void { std.log.err("error code: {d}; error message: {s}.", .{err, reason}); } fn producer() void { var producer_config_builder = kafka.ConfigBuilder.get(); const producer_conf = producer_config_builder .with("bootstrap.servers", "localhost:9092") .build(); <code>kafka.setErrCb(producer_conf, onError); </code> } ``` <ul> <li><code>kafka.setConsumeCb</code>, </li> </ul> <blockquote> <span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">NOTE</span> The callback is a part of producer/consumer configuration and should be set before producer is initialized! </blockquote> Consumers An example of a <strong>Zig Kafka</strong> consumer, consuming JSON or binary data. ```zig const std = @import("std"); const kafka = @import("kafka"); const Data = struct { key1: u32, key2: []u8 }; fn jsonConsumer() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); defer _ = gpa.deinit(); <code>var consumer_config_builder = kafka.ConfigBuilder.get(); const consumer_conf = consumer_config_builder .with("debug", "all") .with("bootstrap.servers", "localhost:9092") .with("group.id", "consumer1") .with("auto.offset.reset", "latest") .with("enable.auto.commit", "false") .with("isolation.level", "read_committed") .with("rreconnect.backoff.ms", "100") .with("reconnect.backoff.max.ms", "1000") .build(); var kafka_consumer = kafka.Consumer.init(consumer_conf); defer kafka_consumer.deinit(); const topics = [_][]const u8{"topic-name2"}; kafka_consumer.subscribe(&amp;topics); while (true) { const message_or_null: ?kafka.Message = kafka_consumer.poll(1000); if (message_or_null) |message| { std.log.info("offset: {d}", .{message.getOffset()}); std.log.info("partition: {d}", .{message.getPartition()}); std.log.info("message length: {d}", .{message.getPayloadLen()}); std.log.info("key: {s}", .{message.getKey()}); std.log.info("key length: {d}", .{message.getKeyLen()}); std.log.info("error code: {d}", .{message.getErrCode()}); std.log.info("timestamp: {d}", .{message.getTimestamp()}); const payload: []const u8 = message.getPayload(); std.log.info("Received message: {s}", .{payload}); const parsed_payload = try std.json.parseFromSlice(Data, allocator, payload, .{}); defer parsed_payload.deinit(); std.log.info("parsed value: {s}", .{parsed_payload.value.key2}); kafka_consumer.commitOffsetOnEvery(10, message); // or kafka_consumer.commitOffset(message) to commit on every message. } } // when the work is done call 'unsubscribe' &amp; 'close' kafka_consumer.unsubscribe(); kafka_consumer.close(); </code> } pub fn main() !void { const producer_worker = try std.Thread.spawn(.{}, jsonProducer, .{}); const consumer_worker = try std.Thread.spawn(.{}, jsonConsumer, .{}); producer_worker.join(); consumer_worker.join(); } ``` AdminApiClient Topics List topics ```zig const std = @import("std"); const kafka = @import("kafka"); pub fn listTopics() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); defer _ = gpa.deinit(); <code>var config_builder = kafka.ConfigBuilder.get(); const conf = config_builder .with("bootstrap.servers", "localhost:9092") .build(); const api_client = kafka.AdminApiClient.init(conf); defer api_client.deinit(); var meta = try api_client.getMetadata(allocator); defer meta.deinit(); const topics = meta.listTopics(); std.log.info("topics count {d}", .{topics.len}); std.log.info("topic name {s}", .{topics[0].name}); std.log.info("topic partition count {d}", .{topics[0].partitions.len}); std.log.info("topic partition id {d}", .{topics[0].partitions[0].id}); </code> } ``` Describe a topic ```zig const std = @import("std"); const kafka = @import("kafka"); pub fn describeTopic() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); defer _ = gpa.deinit(); <code>var config_builder = kafka.ConfigBuilder.get(); const conf = config_builder .with("bootstrap.servers", "localhost:9092") .build(); const api_client = kafka.AdminApiClient.init(conf); defer api_client.deinit(); var meta = try api_client.getMetadata(allocator); defer meta.deinit(); const topic_or_null = meta.describeTopic("topic-name2"); if (topic_or_null) |topic| { std.log.info("topic name {s}", .{topic.name}); std.log.info("topic partition count {d}", .{topic.partitions.len}); std.log.info("topic partition id {d}", .{topic.partitions[0].id}); } </code> } ``` Brokers List brokers ```zig const std = @import("std"); const kafka = @import("kafka"); pub fn listBrokers() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); defer _ = gpa.deinit(); <code>var config_builder = kafka.ConfigBuilder.get(); const conf = config_builder .with("bootstrap.servers", "localhost:9092") .build(); const api_client = kafka.AdminApiClient.init(conf); defer api_client.deinit(); var meta = try api_client.getMetadata(allocator); defer meta.deinit(); const brokers = meta.listBrokers(); std.log.info("brokers count: {d}", .{brokers.len}); std.log.info("host: {s}", .{brokers[0].host}); std.log.info("port: {d}", .{brokers[0].port}); std.log.info("brokers id: {d}", .{brokers[0].id}); </code> } ``` Describe a broker ```zig const std = @import("std"); const kafka = @import("kafka"); pub fn describeBroker() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); defer _ = gpa.deinit(); <code>var config_builder = kafka.ConfigBuilder.get(); const conf = config_builder .with("bootstrap.servers", "localhost:9092") .build(); const api_client = kafka.AdminApiClient.init(conf); defer api_client.deinit(); var meta = try api_client.getMetadata(allocator); defer meta.deinit(); const host = "localhost"; const broker_or_null = meta.describeBroker(host); if (broker_or_null) |broker| { std.log.info("host: {s}", .{broker.host}); std.log.info("port: {d}", .{broker.port}); std.log.info("brokers id: {d}", .{broker.id}); } else { std.log.err("broker {s} not found", .{host}); } </code> } ``` Examples Please, refer to the examples <a>section</a>. Useful references <ul> <li><a>Kafka global configuration</a></li> <li><a>Topic configuration</a></li> <li><a>Introduction to librdkafka</a>.</li> </ul>
[]
https://avatars.githubusercontent.com/u/70143303?v=4
spalloc
bo1led-owl/spalloc
2024-11-04T12:05:16Z
Toy allocator with C interface written in Zig
main
0
2
0
2
https://api.github.com/repos/bo1led-owl/spalloc/tags
GPL-3.0
[ "allocators", "c", "memory-managament", "zig" ]
66
false
2025-02-19T07:08:28Z
true
false
unknown
github
[]
spalloc Toy allocator written in Zig, inspired by <a>Sys.Pro</a> C programming language course task. Features <ul> <li>No chunk headers</li> <li>Using additional memory only when chunks get allocated</li> <li>Special treatment of different types of chunks for better performance</li> </ul> Usage <code>spalloc.h</code> provides <code>spmalloc</code>, <code>spcalloc</code>, <code>sprealloc</code> and <code>spfree</code> functions. These functions have the same API as the standard C <code>malloc</code>, <code>calloc</code>, <code>realloc</code> and <code>free</code>. Building Just use <code>zig build</code> with standard optimization options. By default it builds a static library. To build the shared version, pass <code>-Dshared</code> option.
[]
https://avatars.githubusercontent.com/u/2773256?v=4
zig_pkg_tool
dasimmet/zig_pkg_tool
2024-11-13T15:32:46Z
a command line tool to work with build.zig dependencies and build graphs
main
0
2
0
2
https://api.github.com/repos/dasimmet/zig_pkg_tool/tags
MIT
[ "zig", "zig-package" ]
277
false
2025-05-02T00:35:41Z
true
true
0.14.0
github
[ { "commit": "aa24df42183ad415d10bc0a33e6238c437fc0f59", "name": "known_folders", "tar_url": "https://github.com/ziglibs/known-folders/archive/aa24df42183ad415d10bc0a33e6238c437fc0f59.tar.gz", "type": "remote", "url": "https://github.com/ziglibs/known-folders" } ]
Zig Package tool a command line tool to work with <code>build.zig</code> dependencies and build graphs. It embeds custom build runners to retrieve build graph information, used to backup dependencies, output a graphviz <code>dot</code> file etc. The repo vendors zig's <code>build-runner.zig</code> with an inserted hook to serialize the <code>std.Build</code> struct to <code>zon</code> and send it from the subpocess stdout back to <code>zigpkg</code>. Then that information is used to perform operations based on the build graph. It is compatible and requires with <code>zig &gt;= 0.14.0</code> at runtime, when zig master starts making changes to the build runner the vendored runner needs to be versioned inside this tool. Usage ``` <blockquote> zig build ./zig-out/bin/zigpkg --help </blockquote> or: <blockquote> zig build zigpkg -- --help usage: zigpkg [--help] </blockquote> stores all dependencies of a directory containing build.zig.zon in a .tar.gz archive available subcommands: dot rerun "zig build" and output a graphviz ".dot" file of build steps based on args dotall rerun "zig build" and output a graphviz ".dot" file of all build steps zon rerun "zig build" with a custom build runner and output the build graph as .zon to stdout json same as "zon" but output json deppkg more subcommands for creating and working with "deppkg.tar.gz" files storing all dependencies required to build a zig package environment variables: ZIG: path to the zig compiler to invoke in subprocesses. defaults to "zig". ``` Dependency packages The "deppkg create" subcommand generates a single archive containing all dependencies zig fetches for same arguments you would provide to "zig build". The file can be verified with the "deppkg extract" subcommand, which repacks the individual dependencies into temporary tar archives, loads them back into zigs package cache with "zig fetch", and compares the hash generated by zig with the archive. So when releasing a zig project with dependencies, you can include the deppkg archive as a complete source distribution that is buildable even when upstream dependencies become unavailable for whatever reason. Be aware that not all lazy dependencies may be fetched depending on the provided arguments (and even the "native target" if some host build steps switch out dependencies based on it). This means the user is to provide build options that will fetch all dependencies he expects to be in the package. For now, this tool does not use the exact same filter logic as zig's filter on the <code>paths</code> field of <code>build.zig.zon</code>, so it cannot guarantee that the packaged dependencies produce the same hash. In that case the extract command will fail. That could be avoided by vendoring zig's Manifest parser or making it available in the standard library in the future. Not applying any filter would be an option too, but other tools like a misconfigured <code>zls</code> may write files into the zig package cache and add files we dont want too include in the package: <code>ls ~/.cache/zig/p/known_folders-0.0.0-Fy-PJtLDAADGDOwYwMkVydMSTp_aN-nfjCZw6qPQ2ECL/.zig-cache h o tmp z</code> Graphviz dependency graph this executes <code>zig build</code> with a custom build runner (including potiential additional arguments), to convert the <code>Build.Step</code> graph to basic graphviz <code>dot</code> code. that can be easily be converted to the svg form. For now, generated dot strings are not escaped and might break. Since the build graph is dependent on the original invocation of <code>zig build</code>, integration into the build system is not easy. It's easier to build <code>zigpkg</code> manually, and invoke <code>zigpkg dot &lt;build_root&gt; [zig build ards]</code> with the same arguments as <code>zig build</code>. ```bash cli ./zig-out/bin/zigpkg dot . install | dot -Tsvg &gt; graph.svg ``` <code>zig // build.zig usage // - the disadvantage here is, `dotGraphStep` basically reruns `zig build`, // and passes the extra arguments down, but does not know about the original arguments. // - svgGraph is a system "dot" command const zig_pkg_tool = @import("pkg_tool"); const svggraph = zig_pkg_tool.svgGraph(b, zig_pkg_tool.dotGraphStep(b, &amp;.{ "install", // extra args zig build, e.g. targets "dot", "test", "run", }).captureStdOut()); b.step("dot", "install graph.svg").dependOn(&amp;b.addInstallFile( svggraph, "graph.svg", ).step);</code>
[]
https://avatars.githubusercontent.com/u/77130613?v=4
zig-codeblocks
trag1c/zig-codeblocks
2025-02-05T17:10:38Z
Zig ANSI syntax highlighting library for Python
main
0
2
0
2
https://api.github.com/repos/trag1c/zig-codeblocks/tags
MIT
[ "ansi", "discord", "library", "python", "syntax-highlighting", "zig" ]
783
false
2025-05-08T07:56:11Z
false
false
unknown
github
[]
<a></a> <a></a> zig-codeblocks <code>zig-codeblocks</code> is a Rust-powered CPython 3.9+ library for adding syntax highlighting to Zig code blocks in Markdown files through ANSI escape codes. Originally intended for patching the lack of syntax highlighting for Zig on Discord. <ul> <li><a>Installation</a></li> <li><a>API Reference</a></li> <li><a><code>extract_codeblocks</code></a></li> <li><a><code>highlight_zig_code</code></a></li> <li><a><code>process_markdown</code></a></li> <li><a><code>CodeBlock</code></a></li> <li><a><code>Color</code></a></li> <li><a><code>Style</code></a></li> <li><a><code>Theme</code></a></li> <li><a><code>DEFAULT_THEME</code></a></li> <li><a>License</a></li> </ul> Installation <code>zig-codeblocks</code> is available on PyPI: <code>sh pip install zig-codeblocks</code> You can also install it from source: <code>sh pip install git+https://github.com/trag1c/zig-codeblocks.git</code> <code>zig-codeblocks</code> also exposes a CLI via a <code>cli</code> extra: <code>py pip install "zig-codeblocks[cli]"</code> If the CLI is all you need, you can run it with <code>uvx</code>: <code>sh uvx "zig-codeblocks[cli]" --help</code> API Reference <code>extract_codeblocks</code> <code>py def extract_codeblocks(source: str | bytes) -&gt; list[CodeBlock]</code> Yields <a><code>CodeBlock</code></a>s from a Markdown source. Assumes UTF-8 if source is <code>bytes</code>. <strong>Example usage:</strong> ```py from pathlib import Path from zig_codeblocks import extract_codeblocks source = Path("examples/riiz.md").read_text() for codeblock in extract_codeblocks(source): print(f"Language: {codeblock.lang}") print(f"Body:\n{codeblock.body}") <code></code> Language: py Body: print("Hello, World!") Language: zig Body: const std = @import("std"); pub fn main() !void { std.debug.print("Hello, World!\n", .{}); } ``` <code>highlight_zig_code</code> <code>py def highlight_zig_code(source: str | bytes, theme: Theme = DEFAULT_THEME) -&gt; str</code> Returns an ANSI syntax-highlighted version of the given Zig source code. Assumes UTF-8 if source is <code>bytes</code>. An optional <a><code>Theme</code></a> can be supplied (defaults to <a><code>DEFAULT_THEME</code></a>). <strong>Example usage:</strong> ```py from pathlib import Path from zig_codeblocks import DEFAULT_THEME, Color, Style, highlight_zig_code source = Path("examples/hello_world.zig").read_text() theme = DEFAULT_THEME.copy() theme["BuiltinIdentifier"] = Style(Color.Orange, underline=True) theme["String"] = Style(Color.Cyan) del theme["Type"] print( highlight_zig_code(source), highlight_zig_code(source, theme), sep="\n\n", ) ``` <code>process_markdown</code> <code>py def process_markdown( source: str | bytes, theme: Theme = DEFAULT_THEME, *, only_code: bool = False, ) -&gt; str</code> Returns a Markdown source with Zig code blocks syntax-highlighted. Assumes UTF-8 if source is <code>bytes</code>. An optional <a><code>Theme</code></a> can be supplied (defaults to <a><code>DEFAULT_THEME</code></a>). If <code>only_code</code> is True, only processed Zig code blocks will be returned. <strong>Example usage:</strong> ```py from pathlib import Path from zig_codeblocks import process_markdown source = Path("examples/riiz.md").read_text() print(process_markdown(source)) ``` <code>CodeBlock</code> <code>py class CodeBlock: lang: str body: str</code> A code block extracted from a Markdown source. Immutable. <code>Color</code> <code>py class Color(Enum): Gray = "30" Red = "31" Green = "32" Orange = "33" Blue = "34" Magenta = "35" Cyan = "36" White = "37" # Black for light mode</code> An enumeration of 3-bit ANSI colors. Some names were adjusted to match Discord's style. A color can be instantiated from a string too: <code>Color.from_string("Blue")</code>. <code>Style</code> <code>py class Style: color: Color bold: bool = False underline: bool = False</code> A style for syntax highlighting. Takes a <a><code>Color</code></a> and can optionally be bold and/or underlined. Immutable. Produces an SGR sequence when converted to a string. <code>Theme</code> <code>py class Theme(TypedDict, total=False): BuiltinIdentifier: Style Call: Style Comment: Style Identifier: Style Keyword: Style Numeric: Style PrimitiveValue: Style String: Style Type: Style</code> A theme dict for syntax highlighting Zig code. Each key is optional and can be provided a <a><code>Style</code></a> to apply to the corresponding token type. Can be instantiated with a dict literal or with a <code>Theme</code> call: ```py from zig_codeblocks import Color, Style, Theme theme_foo = Theme( Numeric=Style(Color.Blue), String=Style(Color.Green), ) theme_bar: Theme = { "Numeric": Style(Color.Blue), "String": Style(Color.Green), } assert theme_foo == theme_bar ``` <code>DEFAULT_THEME</code> The default theme used for highlighting, defined as follows: <code>py DEFAULT_THEME: Theme = { "BuiltinIdentifier": Style(Color.Blue, bold=True), "Call": Style(Color.Blue), "Comment": Style(Color.Gray), "Keyword": Style(Color.Magenta), "Numeric": Style(Color.Cyan), "PrimitiveValue": Style(Color.Cyan), "String": Style(Color.Green), "Type": Style(Color.Orange), }</code> License <code>zig-codeblocks</code> is licensed under the <a>MIT License</a>. © <a>trag1c</a>, 2025
[]
https://avatars.githubusercontent.com/u/91746947?v=4
filterz
ozgrakkurt/filterz
2024-10-28T18:49:48Z
Probabilistic filter implementations. Ribbon, bloom, xor filters.
main
0
2
1
2
https://api.github.com/repos/ozgrakkurt/filterz/tags
Apache-2.0
[ "bloom-filter", "probabilistic-data-structures", "ribbon", "xor", "zig", "ziglang" ]
81
false
2024-12-02T22:28:12Z
true
true
unknown
github
[ { "commit": "refs", "name": "huge_alloc", "tar_url": "https://github.com/ozgrakkurt/huge_alloc/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/ozgrakkurt/huge_alloc" } ]
filterz Implementations of some probabilistic filter structures. Implemented with <code>build once, use many times</code> use case in mind. All filters export a <code>Filter</code> interface that can be used like this: ```zig const Filter = filterz.ribbon.Filter(u10); var my_filter = try Filter.init(alloc, hashes); defer my_filter.deinit(); for (hashes) |h| { try std.testing.expect(filter.check(h)); } ``` Each filter also exports a lower level API that can be used to implement more advanced use cases like: - Reducing bits-per-key while the program is running to meet some memory usage criteria. - Loading only a part of a filter from disk and using it to query. Requires Zig 0.14.0-dev release. Filters Split-Block-Bloom-Filter Speed optimized version of a bloom filter. As described in https://github.com/apache/parquet-format/blob/master/BloomFilter.md Xor (BinaryFuse) filter As described in https://arxiv.org/abs/2201.01174 Construction is a bit janky but constructed filters reach slightly higher space efficiency. This is better in cases where construction is one time and the filter is used for a much longer time. Ribbon filter As described in https://arxiv.org/abs/2103.02515 The implementation corresponds to the standard ribbon filter with "smash" as described in the paper. Benchmarks <ol> <li>Download Benchmark Data - instructions <a>here</a></li> <li>Run benchmarks with: <code>bash make benchmark</code></li> </ol> <a>Example results</a> NOTE: Cost estimate stat in the benchmark output is calculated by assuming every hit generates a disk read, which is priced at 50 microseconds. Ribbon filter seems to be the best option when on a memory budget. Bloom filter is the king when there is no memory budget. TODO <ul> <li>Implement <a>frayed ribbon based filter</a></li> <li>Implement <a>bumped ribbon filter</a></li> <li>Implement interleaved columnar storage for ribbon filter as described in the paper.</li> <li>Implement mixing column sizes in ribbon filter storage to support fractional bits-per-key configurations e.g. 6.6 bits per key instead of 6 or 7.</li> <li>Improve Xor (Binary Fuse) filter construction speed by pre-sorting the hashes before filter construction as described in the paper.</li> <li>Improve Xor filter parameter selection, currently it is done by trial-error at construction time.</li> </ul>
[]
https://avatars.githubusercontent.com/u/51416554?v=4
ulid.zig
hendriknielaender/ulid.zig
2024-10-27T20:55:33Z
Zig Universally Unique Lexicographically Sortable Identifier
main
6
2
0
2
https://api.github.com/repos/hendriknielaender/ulid.zig/tags
MIT
[ "ulid", "ulid-generator", "zig", "zig-library", "zig-package", "ziglang" ]
28
false
2025-03-15T17:00:38Z
true
true
0.14.0
github
[ { "commit": "refs", "name": "zbench", "tar_url": "https://github.com/hendriknielaender/zbench/archive/refs.tar.gz", "type": "remote", "url": "https://github.com/hendriknielaender/zbench" } ]
ulid.zig <a></a> <a></a> A <strong>Universally Unique Lexicographically Sortable Identifier (ULID)</strong> implementation for Zig, providing a robust and efficient way to generate unique identifiers that are both time-based and random. Why ULID? UUID can be suboptimal for many uses-cases because: <ul> <li>It isn't the most character efficient way of encoding 128 bits of randomness</li> <li>UUID v1/v2 is impractical in many environments, as it requires access to a unique, stable MAC address</li> <li>UUID v3/v5 requires a unique seed and produces randomly distributed IDs, which can cause fragmentation in many data structures</li> <li>UUID v4 provides no other information than randomness which can cause fragmentation in many data structures</li> </ul> Features <ul> <li>128-bit compatibility with UUID</li> <li>1.21e+24 unique ULIDs per millisecond</li> <li>Lexicographically sortable!</li> <li>Canonically encoded as a 26 character string, as opposed to the 36 character UUID</li> <li>Uses Crockford's base32 for better efficiency and readability (5 bits per character)</li> <li>Case insensitive</li> <li>No special characters (URL safe)</li> <li>Monotonic sort order (correctly detects and handles the same millisecond)</li> </ul> Test Coverage <ul> <li>ULID Generation: Validates timestamp and randomness.</li> <li>Encoding: Ensures ULIDs are correctly encoded into Base32 strings.</li> <li>Decoding: Confirms accurate decoding from Base32 strings.</li> <li>Monotonicity: Tests that ULIDs generated within the same millisecond are monotonically increasing.</li> <li>Overflow Handling: Checks proper error handling when randomness overflows.</li> <li>Edge Cases: Validates behavior with maximum ULID values and invalid inputs.</li> </ul> Specification For detailed information on the ULID specification, refer to the <a>ULID Specification</a>. Usage This library provides an implementation of ULID (Universally Unique Lexicographically Sortable Identifier) generation and decoding in Zig. Generating a ULID You can generate a new ULID as a 26-character Crockford's Base32 string: <code>zig const ulid = try Ulid.generate(); std.debug.print("Generated ULID: {s}\n", .{ulid});</code> This will output a unique, lexicographically sortable string. Decoding a ULID To decode a ULID string into its components (timestamp and randomness): <code>zig const ulid_str = "01AN4Z07BY79KA1307SR9X4MV3"; var decoded_ulid: Ulid = undefined; try Ulid.decode(ulid_str[0..], &amp;decoded_ulid); std.debug.print("Decoded ULID: timestamp={d}, randomness={d}\n", .{decoded_ulid.timestamp, decoded_ulid.randomness});</code> Monotonic ULID Generation To generate ULIDs with guaranteed monotonicity within the same millisecond, use the <code>UlidGenerator</code>: <code>zig var generator = Ulid.monotonic_factory(); const ulid = try generator.generate(null); // Passing `null` uses the current timestamp. std.debug.print("Generated monotonic ULID: {s}\n", .{ulid});</code> This will ensure that if multiple ULIDs are generated in the same millisecond, their randomness will be incremented to preserve order. Handling Errors This library defines several error types for ULID encoding/decoding, such as: <ul> <li><code>invalid_length</code> – when the provided ULID string is not 26 characters long.</li> <li><code>invalid_character</code> – when the ULID string contains invalid Base32 characters.</li> <li><code>overflow</code> – when the timestamp exceeds the maximum allowable value (48 bits).</li> </ul>
[]
https://avatars.githubusercontent.com/u/47335043?v=4
tinycompiler
williamfedele/tinycompiler
2024-09-25T03:38:27Z
⚡ Compiler written in Zig for fun
main
0
2
0
2
https://api.github.com/repos/williamfedele/tinycompiler/tags
MIT
[ "compiler", "compiler-design", "zig", "ziglang" ]
34
false
2025-01-18T05:59:09Z
true
true
unknown
github
[]
⚡ TinyCompiler A compiler written for fun to learn about Zig. <strong>Disclaimer</strong>: The grammar, found in <code>grammar.ebnf</code>, has not been validated to reject erroneous code. There is also no semantic error handling at the moment so variables are not checked for existence for example. I need to generate a symbol table over the AST before the code generation phase. Syntax The syntax is intentionally simple to make this a Zig learning experience rather than one purely of compiler design. I'm not a compiler engineer, so don't expect big things haha. I may extend it to include other features that are relatively simple like functions. <strong>Datatypes</strong>: Only integers are valid at the moment. <strong>Keywords</strong>: <em>var, int, if, while, end, print</em>. Example Usage Source file: ``` var x: int = 10; var y: int; y = 5*2+1; if (x &lt;= y) print x; else print y; end while (y &gt;= x) print y; if (y == 7) x = x - 1; end y = y - 1; end ``` Translated output (python for now): <code>py x = 10 y = 0 y = 5 * 2 + 1 if x &lt;= y: print(x) else: print(y) while y &gt;= x: print(y) if y == 7: x = x - 1 y = y - 1</code> License <a>MIT</a>
[]
https://avatars.githubusercontent.com/u/83881873?v=4
di.zig
AleksandrShadrin/di.zig
2024-11-09T06:41:58Z
A simple and lightweight dependency injection container for Zig.
main
0
2
0
2
https://api.github.com/repos/AleksandrShadrin/di.zig/tags
MIT
[ "dependency-injection", "ioc-container", "zig", "zig-library", "zig-package" ]
144
false
2025-01-16T17:48:08Z
true
true
unknown
github
[]
<a></a> Zig DI Container 🚀 A simple and lightweight dependency injection (DI) container for Zig. Manage your dependencies effortlessly and keep your code clean! 📦 Features * Singletons: One instance throughout the app. * Transients: New instance every time. * Scoped Services: Manage lifetimes within scopes. * Generics Support: Work with generic types smoothly. * Error Handling: Gracefully handle errors when creating/allocating services * Object Management: Implement your own logic for deinitializing resources, which will be called by the service provider when freeing resources. Here <a>example</a> * Thread Safety: The service provider guarantees that singleton resolving is thread-safe. For other usage if you need thread safety use scopes. * Support custom allocators for scopes 🛠️ Installation Add the di module to your project using zig zon. ```zig const di_dep = b.dependency("di", .{ .target = target, .optimize = optimize }); const di_module = di_dep.module("di"); const exe = b.addExecutable(.{...}); exe.root_module.addImport("di", di_module); ``` 📚 Usage Initialize the Container. Start by setting up the DI container with an allocator. ```zig const std = @import("std"); const di = @import("di"); const Container = di.Container; pub fn main() !void { const allocator = std.heap.page_allocator; var container = Container.init(allocator); defer container.deinit(); <code>// Register your services here </code> } ``` Register Services Choose how you want your services to behave. Singleton One shared instance. <code>zig try container.registerSingleton(MyService);</code> Transient A new instance each time. <code>zig try container.registerTransient(MyService);</code> Scoped Managed within a specific scope. <code>zig try container.registerScoped(MyService);</code> Factories You can also register factories to create instances of your services. This allows you to add multiple implementations <code>zig try container.registerSingletonFactory(builderFn);</code> Create a Service Provider After registering services, create a provider to resolve them. <code>zig var serviceProvider = try container.createServiceProvider(); defer serviceProvider.deinit();</code> Resolve Services Get instances of your services when needed. <code>zig const myService = try serviceProvider.resolve(MyService); const myServices = try serviceProvider.resolveSlice(MyService); // get all registered services of type MyService, MyService if it was registered wihtout factory + all instances created by factories</code> Handle Generics Handle generic types with ease. <code>zig // register try container.registerSingleton(MyService); ... // resolve const genericService = try serviceProvider.resolve(di.Generic(MyService, .{u8}));</code> Using Scopes Manage scoped services within a controlled environment. ```zig var scope = try serviceProvider.initScope(); defer scope.deinit(); const scopedService = try scope.resolve(MyService); ``` Provide custom allocator if you don't want to use parent's ```zig var allocator = ...; var scope = try serviceProvider.initScopeWithAllocator(allocator); ... ``` Unresolve Transient Services or slices Manually release a service if needed. <code>zig try serviceProvider.unresolve(resolvedService); try serviceProvider.unresolve(resolvedServices); // resolved by resolveSlice</code> 🎉 Example Here's a quick example to get you started! ```zig const std = @import("std"); const di = @import("di"); const Container = di.Container; // Example Services const Logger = struct { pub fn init() Logger { return Logger{}; } <code>pub fn log(self: *Logger, message: []const u8) void { _ = self; std.log.info("{s}", .{message}); } </code> }; const Database = struct { logger: *Logger, <code>pub fn init(logger: *Logger) Database { return Database{ .logger = logger, }; } pub fn persist(self: *Database) void { self.logger.log("Log some job"); } </code> }; pub fn main() !void { const allocator = std.heap.page_allocator; var container = Container.init(allocator); defer container.deinit(); <code>// Register services try container.registerSingleton(Logger); try container.registerTransient(Database); // Create provider var provider = try container.createServiceProvider(); defer provider.deinit(); // Resolve services var db = try provider.resolve(Database); // Use services db.persist(); </code> } ``` This example sets up a simple DI container, registers a Logger as a singleton and Database as a transient service, then resolves and uses them. More examples can be founded in examples folder, use: <code>sh zig build run-${filename}</code> 📄 License This project is MIT licensed. See the LICENSE file for details.
[]
https://avatars.githubusercontent.com/u/65524156?v=4
zig-baremetal
RecursiveError/zig-baremetal
2025-01-09T18:45:14Z
a small Zig test on baremetal with STM32F103
main
0
2
0
2
https://api.github.com/repos/RecursiveError/zig-baremetal/tags
-
[ "bare-metal", "stm32", "stm32f103", "zig" ]
93
false
2025-01-26T20:20:06Z
false
false
unknown
github
[]
Zig baremetal this is an example of Zig-baremetal for STM32F103 <a>linkerscript source</a> bootloader: a simple bootloader that just configures the VTOR and jumps to the application. app: a basic example of blinky using systick. app2: example with UART and WiFi connection with ESPAT (compile in release mode)
[]
https://avatars.githubusercontent.com/u/2773256?v=4
zig-raspberry-pico-sdk
dasimmet/zig-raspberry-pico-sdk
2024-11-07T21:46:55Z
null
master
0
2
1
2
https://api.github.com/repos/dasimmet/zig-raspberry-pico-sdk/tags
MIT
[ "microzig", "pico", "raspberry", "zig", "zig-package" ]
35
false
2024-12-14T12:30:00Z
true
true
0.13.0
github
[ { "commit": "95ea6acad131124694cda1c162c52cd30e0aece0", "name": "pico-sdk", "tar_url": "https://github.com/raspberrypi/pico-sdk/archive/95ea6acad131124694cda1c162c52cd30e0aece0.tar.gz", "type": "remote", "url": "https://github.com/raspberrypi/pico-sdk" }, { "commit": "df21059f7ca6f1babc7...
raspberry pico-sdk on the zig buildsystem Requirements <ul> <li>zig 0.13.0 or higher</li> <li>~~libudev-dev for libusb on linux~~</li> </ul> The last zig version i built against (ubuntu linux 24.04 x86_64): <code>console foo@bar:~$ zig version 0.14.0-dev.2164+6b2c8fc68</code> Picotool this repo builds the raspberry picotool from the sdk source on the zig buildsystem: ```console foo@bar:~$ zig build run PICOTOOL: Tool for interacting with RP2040/RP2350 device(s) in BOOTSEL mode, or with an RP2040/RP2350 binary SYNOPSIS: picotool info [-b] [-p] [-d] [--debug] [-l] [-a] [device-selection] picotool info [-b] [-p] [-d] [--debug] [-l] [-a] [-t ] picotool config [-s ] [-g ] [device-selection] picotool config [-s ] [-g ] [-t ] picotool load [--ignore-partitions] [--family ] [-p ] [-n] [-N] [-u] [-v] [-x] [-t ] [-o ] [device-selection] picotool link [--quiet] [--verbose] [-t ] [-t ] [-t ] [] [-t ] [-p] picotool save [-p] [device-selection] picotool save -a [device-selection] picotool save -r [device-selection] picotool verify [device-selection] picotool reboot [-a] [-u] [-g ] [-c ] [device-selection] picotool otp list|get|set|load|dump|permissions|white-label picotool partition info|create picotool uf2 info|convert picotool version [-s] [] picotool coprodis [--quiet] [--verbose] [-t ] [-t ] picotool help [] COMMANDS: info Display information from the target device(s) or file. Without any arguments, this will display basic information for all connected RP2040 devices in BOOTSEL mode config Display or change program configuration settings from the target device(s) or file. load Load the program / memory range stored in a file onto the device. link Link multiple binaries into one block loop. save Save the program / memory stored in flash on the device to a file. verify Check that the device contents match those in the file. reboot Reboot the device otp Commands related to the RP2350 OTP (One-Time-Programmable) Memory partition Commands related to RP2350 Partition Tables uf2 Commands related to UF2 creation and status version Display picotool version coprodis Post-process coprocessor instructions in disassembly files. help Show general help or help for a specific command Use "picotool help " for more info ``` Picotool zig build interface <code>zig // build.zig const pico_sdk = @import("zig-raspberry-pico-sdk"); const load_step = pico_sdk.load(b, .{ .firmware = lazypath_to_firmware_uf2, .execute = true, .sudo = b.option(bool, "load-with-sudo", "run picotool load with sudo") orelse false, }, .{}); b.step("load").dependOn(load_step);</code>
[]
https://avatars.githubusercontent.com/u/6199588?v=4
protohackers_zig
rlopzc/protohackers_zig
2024-10-15T00:53:41Z
Solving protohackers.com problems with Zig
main
1
2
0
2
https://api.github.com/repos/rlopzc/protohackers_zig/tags
-
[ "networking", "protohackers", "zig", "ziglang" ]
215
false
2025-04-20T12:57:08Z
true
true
unknown
github
[]
Protohackers in Zig I'm solving the <a>protohackers</a> in Zig to learn more about networking and continue learning Zig. Each problem has it's corresponding file in <code>src</code>, e.g. <code>src/01_smoke_test.zig</code>. The common logic is extracted in different files, e.g. <code>src/tcp_server.zig</code>. I used CLI arguments to run a specific problem. To run the smoke test, run: ```sh Smoke test zig build run -- 00 Prime time zig build run -- 01 ``` Docker I dockerized this project to be run in any server. The images are exposed in Github Container Registry <a>here</a>. Building the images: <code>sh docker buildx build --platform linux/arm64,linux/amd64 -t ghcr.io/rlopzc/protohackers_zig:latest --push .</code> Running the image in any cloud provider <ol> <li>Create a server in a cloud provider (I used Hetzner)</li> <li> Pull the image. You can either pull the latest, which should contain most solutions, or a specific tag with a solution. <code>sh docker pull ghcr.io/rlopzc/protohackers_zig:0_smoke # or docker pull ghcr.io/rlopzc/protohackers_zig:latest</code> </li> <li> Run the image. Remember to pass the problem number as an argument. <code>sh docker run --rm --name protohackers_zig -p 3000:3000 --init ghcr.io/rlopzc/protohackers_zig:latest 00</code> </li> <li>Run the protohacker test using their website!</li> </ol>
[]
https://avatars.githubusercontent.com/u/146390816?v=4
libexpat
allyourcodebase/libexpat
2024-12-18T18:15:55Z
libexpat ported to the zig build system
master
0
2
0
2
https://api.github.com/repos/allyourcodebase/libexpat/tags
MIT
[ "zig", "zig-package" ]
17
false
2025-05-20T22:39:40Z
true
true
0.14.0
github
[ { "commit": "master", "name": "libexpat", "tar_url": "https://github.com/libexpat/libexpat/archive/master.tar.gz", "type": "remote", "url": "https://github.com/libexpat/libexpat" } ]
<a></a> Expat This is <a>Expat</a>, packaged for <a>Zig</a>. Installation First, update your <code>build.zig.zon</code>: ``` Initialize a <code>zig build</code> project if you haven't already zig init zig fetch --save git+https://github.com/allyourcodebase/libexpat.git#2.7.1 ``` You can then import <code>expat</code> in your <code>build.zig</code> with: <code>zig const expat_dependency = b.dependency("expat", .{ .target = target, .optimize = optimize, }); your_exe.linkLibrary(expat_dependency.artifact("expat"));</code>
[ "https://github.com/allyourcodebase/libexpat", "https://github.com/allyourcodebase/wayland" ]
https://avatars.githubusercontent.com/u/160618?v=4
zettings
ntd/zettings
2024-10-16T15:04:35Z
A simple peristence layer for open62541 based OPC/UA servers in Zig
main
0
2
0
2
https://api.github.com/repos/ntd/zettings/tags
MIT
[ "linux", "mmap", "persistence", "zig" ]
45
false
2024-12-06T19:22:56Z
true
true
unknown
github
[]
<em>Zettings</em> is the simplest persistence layer I can think of. Its name is a portmanteau of <a>Zig</a>, the language I used to implement it, and <strong>settings</strong>. At its core, it maps (via POSIX <code>mmap</code>) a struct with fixed-length members to a fixed-length file. It is intended to be used as the base for a basic persistence layer for OPC/UA servers, i.e. a port of the <a>XSettings project</a> from the C world. The demo program shows how this is supposed to work. It handles a set of settings (boolean, numeric and string types) and allow to perform some basic operations from command line. ```sh Show usage info zig build run -- -h Create (-r) the schema file (demo.zettings) and dump (-d) its default values zig build run -- -r -d demo.zettings Toggle all booleans (-t) and dump the new values zig build run -- -t -d demo.zettings Now increment all numeric settings (-i) and dump the new values zig build run -- -i -d demo.zettings Further dumps show that the last values are retained zig build run -- -d demo.zettings Reset (-r) to the default values zig build run -- -r -d demo.zettings ```
[]
https://avatars.githubusercontent.com/u/11727247?v=4
bitvmx_pkmn_bttl
fedejinich/bitvmx_pkmn_bttl
2024-12-20T14:31:57Z
A Bitcoin-Pokemon game using BitVMX
master
0
2
0
2
https://api.github.com/repos/fedejinich/bitvmx_pkmn_bttl/tags
-
[ "bitcoin", "bitvmx", "pokemon", "risc-v", "riscv32", "zig" ]
390
false
2025-04-21T12:36:46Z
false
false
unknown
github
[]
PKMN_BTTL This project is a simple Bitcoin-Pokemon game created to showcase BitVMX, a protocol that enables verifying arbitrary computations on Bitcoin. In this game, players choose a Pokemon to battle against Charizard. If their Pokemon wins, they can validate the result using BitVMX and claim locked Bitcoin funds. You can read more about the game in the <a>following article</a> and more about BitVMX <a>here</a>. NOTE: the <a>first article</a> is based on the <code>regtest</code> branch, while <code>master</code> branch corresponds to the second part of the article where we run the game on Mutinynet. Requirements <ul> <li>Zig 0.13.0</li> <li>Rust</li> <li>Docker</li> <li>Clone all the submodules</li> <li><code>bitvmx_protocol</code> submodule must point <code>bitvmx_pkmn_bttl</code> branch</li> <li>Python (optional)</li> </ul> Structure <code>bash . ├── bitvmx_protocol/ # BitVMX (submodule) ├── build_scripts/ # Scripts to build the project ├── engine/ # Pokemon battle engine (submodule) ├── game_runs/ # Detailed data about game runs for each environment (mutinynet and regtest) ├── pkmn_bttl/ # The game ├── init.sh # Initialization script ├── img.jpg └── README.md</code> Initialization <ul> <li>Run the initialization script <code>init.sh</code></li> </ul> <code>bash ./init.sh</code> This script clones the right submodules and creates the necessary folders. Run Running the game involves setting up a BitVMX environment and acting as a prover that tries to compute the right output. To do that you can follow the next steps: <ul> <li>Specify the input at <code>build.sh</code> INPUT and build the Pokemon program by running the build script</li> <li>This validates that the program succeeds and moves the generated binary into the required folders for later verification.</li> <li>Run <code>./build_scripts/build.sh</code></li> <li>Run <code>prover</code> and <code>verifier</code> docker services.</li> <li>at <code>bitvmx_protocol/</code></li> <li><code>docker compose up prover-backend</code></li> <li><code>docker compose up verifier-backend</code></li> <li>Generate setup parameters by running <code>build_scripts/setup_mutiny.py</code>.</li> <li>Fund the generated address.</li> <li>You can use the <a>Mutinynet faucet</a>.</li> <li>Open the Swagger UI at <code>http://0.0.0.0:8081/docs#/v1</code></li> <li>Call <code>setup/</code> endpoint with the generated parameters</li> <li>Remember to replace <code>funding_tx_id</code> and <code>funding_index</code></li> <li>Call <code>input/</code> with the <code>setup_uuid</code> generated in the previous step.</li> <li>Call <code>next_step</code> with the same <code>setup_uuid</code> to verify the game (program).</li> <li>You can modify <code>bitvmx_protocol/../execution_trace_generation_service.py</code> to try different challenge scenarios.</li> </ul>
[]