Skip to content

Instantly share code, notes, and snippets.

View matu3ba's full-sized avatar

Jan Ph. H. matu3ba

View GitHub Profile
@matu3ba
matu3ba / plan.txt
Last active December 17, 2023 20:13
plan to end distro hopping
1. nix + arcan
2. QubesOS for VMs.
3. EndeavourOS
4. Windows with minimal installer
5. MacOS no idea.
@matu3ba
matu3ba / tcp.diff
Created December 1, 2022 23:22
some tcp test runner I toyed with with the experimental network implementation
diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig
index d71f2b9274..c2afa500aa 100644
--- a/lib/std/special/test_runner.zig
+++ b/lib/std/special/test_runner.zig
@@ -1,35 +1,353 @@
+//! Default test runner
+//! assume: OS environment
+//! assume: (sub)processes and multithreading possible
+//! assume: IPC via pipes possible
+//! assume: The order of test execution **must not matter**.
@matu3ba
matu3ba / fbr.sh
Last active November 28, 2022 21:37
zig windows git
#!/usr/bin/env sh
# fetch build run: zig compiler on windows for git bash
# https://github.com/ziglang/zig/blob/master/ci/windows/build.ps1
cd
cd Desktop
# f
VERSION="0.11.0-dev.25+499dddb4c"
curl -o devkit.zip https://ziglang.org/deps/zig+llvm+lld+clang-x86_64-windows-gnu-$VERSION.zip
unzip devkit.zip
mv zig+llvm+lld+clang-x86_64-windows-gnu-$VERSION devkit
@matu3ba
matu3ba / b.sh
Created November 24, 2022 08:00
zig-bootstrap + zig (for too old cmake version)
#!/usr/bin/env sh
# faster, but no stage1
/usr/bin/time -v "${HOME}/dev/git/bootstrap/zig-bootstrap/musl/out/zig-x86_64-linux-musl-native/bin/zig" build -p stage3 --search-prefix "${HOME}/dev/git/bootstrap/zig-bootstrap/musl/out/x86_64-linux-musl-native" --zig-lib-dir lib -Dstatic-llvm
# slower, but has stage1
mkdir -p build/ && cd build/ && cmake .. -DCMAKE_PREFIX_PATH="$HOME/dev/git/bootstrap/zig-bootstrap/musl/out/host/" -GNinja && /usr/bin/time -v ${HOME}/dev/git/cpp/mold/build/mold -run ninja install && cd ..
@matu3ba
matu3ba / b.sh
Last active November 17, 2022 21:01
build and trace helper to track down child process caching issue of Zig
#!/bin/sh
set -e
#echo "building debug.."
#mkdir -p build/ && cd build/ && cmake .. -DCMAKE_PREFIX_PATH="$HOME/dev/git/bootstrap/zig-bootstrap/musl/out/host/" -GNinja && /usr/bin/time -v ${HOME}/dev/git/cpp/mold/build/mold -run ninja install && cd ..
#echo "building release.."
#mkdir -p build3/ && cd build3/ && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="$HOME/dev/git/bootstrap/zig-bootstrap/musl/out/host/" -GNinja && /usr/bin/time -v ${HOME}/dev/git/cpp/mold/build/mold -run ninja install && cd ..
#echo "building done"
/usr/bin/time -v "${HOME}/dev/git/bootstrap/zig-bootstrap/musl/out/zig-x86_64-linux-musl-native/bin/zig" build -p build1 --search-prefix "${HOME}/dev/git/bootstrap/zig-bootstrap/musl/out/x86_64-linux-musl-native" --zig-lib-dir lib -Dstatic-llvm &
/usr/bin/time -v "${HOME}/dev/git/bootstrap/zig-bootstrap/musl/out/zig-x86_64-linux-musl-native/bin/zig" build -p build2 -Drelease --search-prefix "${HOME}/dev/git/bootstrap/zig-bootstrap/musl/out/x86_64-linux-musl-native" --zig-li
@matu3ba
matu3ba / notes_ropes1.md
Last active December 3, 2022 18:41
separate_layout_from_content

Why storing accurate editor history requires to separate layout from content.

Let us understand programming as converting strings to another machine-readable or executable output with a program according to a specification (called compiler). Now let the sole layout as graphical positioning be defined by additional white spaces and newlines.

Source code formatting ensures stylistic consistency to improve readability and eases on refactoring and writing code. All formatters that enable custom user data come with an escape hatch for

@matu3ba
matu3ba / approach
Last active August 1, 2022 23:01
Examples for discussion on compiler meeting on 2022-08-04
Idea
1. parsing the AST to have a simplification for faster frequent access
* create another tree storing what things are active
* create another tree to store what things reference what other things for deletion strategy
(idea: no unused variable errors)
2. starting with remove stuff from end of execution to beginning and fixup unused var errors,
later graph based deletion based on where things are used (!global side effects may not be captured!)
3. rendering the used parts
* fixups will be likely dirty hacks at first
@matu3ba
matu3ba / zig_cache.md
Last active January 4, 2023 08:43
Big picture of the Zig caching system.

This is outdated now. Compilation does not use the tmp directory anymore.

** Big picture of the Zig caching system. ** This is a big picture of the Zig caching system, mostly motivated for me to understand the necessary bits to solve ziglang/zig#11643. It reflects the status quo of commit fcfeafe99a3ecc694a3475735c81a0d75b6da6d0. The core logic is defined in src/Cache.zig.

zig-cache/h contains the manifest files with varying content.

@matu3ba
matu3ba / child.zig
Created May 27, 2022 15:14
bench_childprocess.zig
const std = @import("std");
pub fn main() !void {
try std.io.getStdOut().writer().writeAll("hello world\n");
}
@matu3ba
matu3ba / fnproto_runner.zig
Created May 23, 2022 17:22
Zig simple runner through function pointer
const std = @import("std");
const builtin = @import("builtin");
const FnProto = switch (builtin.zig_backend) {
// workaround until we replace stage1 with stage2
.stage1 => ?fn (*Runner) anyerror!void,
else => ?*fn (*Runner) anyerror!void,
};
const Runner = struct {
file: std.fs.File,