This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <string.h> | |
// Usage: | |
// uint16_t value = read_u16_le(buffer + 3); | |
#define __builtin_bswap8(x) (x) // "hack" | |
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | |
#define int_little_to_native(_Value, _Size) (_Value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
which git sed cut 1>/dev/null | |
timestamp="$(date +'%Y-%m-%d %H:%M')" | |
c_base=$'\033[0m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! xq @ UTC+2 (MasterQ32 @ GitHub) — gestern um 22:01 Uhr | |
//! more gui thoughts: | |
//! | |
//! i stopped using tree structures for my UIs and return to flat, ordered lists. this made the implementations sinpler by magnitudes, and one could always build stuff like a 'container' widget which would make it hierarchical by nesting UIs. | |
//! | |
//! right now, dunstwolke uses a immediate mode interface, which is now borked by a bugfix in stage2. | |
//! | |
//! now i'm thinking about how to decouple styling, layout and logic of the ui. also i'm still not sure how to manage UI events. i really dislike the callback approach of wpf/qt/winforms/... | |
//! compared to callbacks, immediate mode interfaces are very convenient to program, so i wonder if i can use a similar interface for a retained guy, for example a pull interface: | |
//! gui.pushInput(.mouse_down); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
clear | |
zig build-exe -target arm-freestanding-eabi -mcpu baseline -T linker.ld -fsingle-threaded -fno-omit-frame-pointer -O ReleaseFast --name kernel kernel.zig | |
llvm-objdump -dt kernel | |
llvm-objcopy -O binary kernel kernel.bin | |
# cp kernel.bin disk.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const input = @embedFile("input.txt"); | |
export const capitalized = blk: { | |
@setEvalBranchQuota(100_000); | |
var result: []const []const u8 = &.{}; | |
var iter = std.mem.tokenize(u8, input, ",.\r\n "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
var global: u32 = 0; | |
export fn normalStore(arg: u32) void { | |
global = arg; | |
} | |
export fn normalLoad() u32 { | |
return global; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ihex": { | |
"git": "https://github.com/MasterQ32/zig-ihex" | |
}, | |
"args": { | |
"git": "https://github.com/MasterQ32/zig-args" | |
}, | |
"parser-toolkit": { | |
"git": "https://github.com/MasterQ32/parser-toolkit" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const Pkg = std.build.Pkg; | |
const Step = std.build.Step; | |
const FileSource = std.build.FileSource; | |
const GeneratedFile = std.build.GeneratedFile; | |
pub const Sdk = @This(); | |
builder: *std.build.Builder, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
pub fn main() !void { | |
var allocator = std.heap.page_allocator; | |
var a = try Any.init(allocator, @as(u32, 10)); | |
defer a.deinit(); | |
var b = try Any.init(allocator, @as([]const u8, "Hello, World!")); | |
defer b.deinit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
/// The linker here is "preloaded" with all input object files / symbols. | |
/// After this function is run, the linker will resolve all symbol references | |
/// and print all unassigned symbols (\u2192 error) | |
pub fn link(l: *std.link.Linker) !void { | |
// Creates a new output section that will be loaded into the | |
// same address as its virtual address. It's also a (rx!w) section | |
const dot_text = l.createOutputSection(".text", .{ |
NewerOlder