RSSAmplifier

Blog

H[ack]-∞S

hack8s.com

hack8s.comRSS feed ↗10 posts

Latest posts

ziglings – all exercises solved (v0.16.0)

Exe: 001_hello.zig // // Oh no, this is supposed to print "Hello world!" but it needs // your help. // // Zig functions are private by default, but the main() function // must be public. // // A function is made public with the "pub" statement like so: // // pub fn foo() void { [ ]

zig v0.16.0 cheatsheet

Print: Read file content: List entries:

LLM’s code is just untrusted text. Until you validate it.

People often ask me what the best programming language is to use with LLMs. One of the strongest options, in my opinion, is Rust. However, before choosing it, you first need to ask yourself whether it s worth picking a language with manual memory management instead of one with a garbage collector. And regardless of that [ ]

Tigerstyle – Software engineering methodology

Do the hard thing today to make tomorrow easy. 1. Safety Correctness is necessary but not sufficient for safety. To be safe, a program must not only run correctly. It must apply defense-in-depth and verify itself while running, to run correctly or else shut down if it detects that it has violated expectations. NASA s Power Of Ten Rules TigerStyle follows the spirit of [ ]

JWT vs Basic Auth

Key Differences: Basic Auth JWT 1. Credentials sent Username/password sent with every request (Base64 encoded) Credentials sent once; subsequent requests use token 2. Server validation Database query needed for every request Can validate cryptographically without database lookup 3. Stateless Stateful (server validates against stored credentials) Stateless (verification [ ]

Memory ownership and lifetime

Always ask yourself: who owns the memory behind input and how long it lives? When you receive a []const u8 parameter, you re getting a slice, which is just a pointer + length. You have no idea where that pointer points to. Example: So if store_input just returns input directly: The caller gets back a slice [ ]

Zig 0.16.0: Init and arena

Given the new juicy main in zig v0.16.0, the runtime owns resources, not you, so you must not deinit(). Here s what the arena property in std.process.Init struct looks like: As you see, arena is a pointer (*std.heap.ArenaAllocator), not a value. So you don t own it, the runtime allocated it and passes you a pointer to [ ]

Zig 0.16.0: env vars and process args become non-global

Zig standard library historically had a major footgun: std.os.environ was meant to be equivalent to environ in C, which forced it to be populated it in a library linked to libc. But C is designed to avoid calling environment-modifying functions like setenv in a threaded context, because environ often is directly accessed without lock-ing. That s [ ]

Zig 0.16.0 released

What s new: switch improvements: packed struct and packed union can now be used as switch prong items, compared solely via their backing integer. Decl literals and @enumFromInt may now also appear as switch prong items, and union tag captures are now allowed for all prongs, not just inline ones. @cImport deprecated: C translation is moving [ ]

hello, world

First post. Nothing smarter to say. AdP