Skip to content

Instantly share code, notes, and snippets.

View fogti's full-sized avatar

Alain Emilia Anna Zscheile fogti

View GitHub Profile
const ostag = @import("builtin").os.tag;
const std = @import("std");
const testing = std.testing;
const Allocator = std.mem.Allocator;
fn findExt(name: []const u8) usize {
var start: usize = 0;
// search for last segment after "."
while (std.mem.indexOfPos(u8, name, start, ".")) |delim_start| {
start = delim_start + 1;
@fogti
fogti / fefe-only-links.py
Created October 14, 2023 18:38
fefe, but only the links (without the comments)
@fogti
fogti / README.md
Last active July 17, 2024 11:49
polymake
@fogti
fogti / hiprofun.idr
Created September 15, 2023 09:21
Dependent Profunctor
interface HiProfunctor (0 p : (0 xt : Type) -> (xt -> Type) -> Type) where
dimap : (a, b : Type) -> (c : b -> Type) -> (d : (a -> Type))
-> (ab : (a -> b)) -> ((y : a) -> c (ab y) -> d y)
-> p b c -> p a d
data DepFun : (0 xt : Type) -> (xt -> Type) -> Type where
DF : (0 xt : Type) -> (yt : xt -> Type) -> ((x : xt) -> yt x) -> DepFun xt yt
HiProfunctor DepFun where
dimap a b c d ab acd (DF _ _ bc) = DF a d (\av : a => acd av (bc (ab av)))
@fogti
fogti / Ast.zig
Created August 24, 2023 18:27
trying to get familiar with ASTs in Zig again...
//! Abstract Syntax Tree for yanais source code
const std = @import("std");
const assert = std.debug.assert;
const testing = std.testing;
const Allocator = std.mem.Allocator;
nodes: NodeList.Slice,
extra_data: []const u8,
@fogti
fogti / yanais-00.yns
Created August 17, 2023 22:51
possible Yanais introductory example (proglang planning phase)
(*
what language features do we want?
* free tagged unions
* dependent types
*)
mod Example {
pub tag True;
@fogti
fogti / basic_block.zig
Created January 23, 2022 08:12
LC1C partially (without peephole optimizer) ported to Zig (original = https://github.com/zseri/lc1c)
const std = @import("std");
const Allocator = std.mem.Allocator;
pub fn BasicBlock(comptime Stmt: type, comptime Cond: type) type {
return struct {
// entry points
labels: std.ArrayList([]const u8),
entp_cnt: usize,
// exit points
@fogti
fogti / PythonMock.nix
Created January 12, 2022 06:42
DS-G19 2021 Nix stuff
{ buildPythonPackage
, lib
, pytestCheckHook
, runCommandNoCC
, xorg
}:
pvl:
let
@fogti
fogti / inspect.js
Created January 10, 2022 20:21
nixpkgs/lib/systems with-import cycle
let nixOp = nixBlti.nixOp;
let nixBltiRT = nixBlti.initRtDep(nixRt);
let nixInScope = nixBlti.mkScopeWith();
return async (nixBound) => {
nixBound = await nixBound;
let nix__lib = nixOp._lambdaA2chk(nixBound, "lib");
return (async (nixInScope) =>
(async (nixInScope) =>
(async (nixInScope) =>
nixBlti.PLazy.from(async () => {
@fogti
fogti / dbwospof.md
Created December 22, 2021 23:46
RFC: distributed build without single points of failure

distributed build without single points of failure

problem statement

If we want to distribute a build across several build nodes, and want to avoid a "single point of failure", what needs to be considered?

motivation

  • distribute the build across several build nodes, because some packages take extremely long to build