viernes, 18 de octubre de 2024

how to convert an integer to string in Zig

I have been spending a while on learning Zig, by the way is pretty amazing.

fn convert_to_string(value: u32) []const u8 {
    var buffer: [4096]u8 = undefined;
    const result = std.fmt.bufPrintZ(buffer[0..], "{d}", .{value}) catch unreachable;
    return @as([]const u8, result);
}

sábado, 22 de junio de 2024

How to know laptop model in linux

With this little script, we can discover the model of our laptop


for d in system-manufacturer system-product-name system-version bios-release-date bios-version; do           echo "${d^} : " $(sudo dmidecode -s $d);  done