Skip to content

Instantly share code, notes, and snippets.

@haller33
haller33 / shell.nix
Last active January 10, 2024 01:15
Nix Shell for Odin Programming Language with support for any* branch of the Main Project ( such as ex.: dev-2023-10 or master )
# MIT License
#
# Copyright (c) 2023 haller33
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@haller33
haller33 / scheduler.kernel.use.RR.diff
Created May 1, 2023 08:46
A change on Schedduler of Kernel for better performance
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index daff72f00..857577ea1 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4572,7 +4572,16 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p)
/*
* Make sure we do not leak PI boosting priority to the child.
*/
- p->prio = current->normal_prio;
+ /// Kernel Config from OS Running get config of existing linux running
@haller33
haller33 / tuple_like.odin
Last active December 26, 2022 11:06
a 'Tuple' like struct that can handle a polymorphic type ( but not have imutability ) at least, is a way of store random types of data at once.
package tuples_like
import "core:fmt"
// Values :: union #no_nil {string, int, f32, bool} // for now, compile assertion error problem :: https://github.com/odin-lang/Odin/issues/1918
Poly :: struct {
data : union { string, int, bool, f32 },
}
@haller33
haller33 / Either_main.odin
Last active December 6, 2023 12:32
Safe Divísion with Either "monad" on Odin programming language
package main
import "core:fmt"
// te error handling is just this two, struct and union
Left_Err :: struct {
nok: bool,
data: any,
msg: string,
@haller33
haller33 / monadic_odin_context.odin
Last active December 28, 2022 11:59
monadic return procedure with state using monads
package context_monad
import "core:fmt"
import "core:mem"
// SSA
// https://www.cs.purdue.edu/homes/suresh/502-Fall2008/papers/kelsey-ssa-cps.pdf
a : int = 0
multplo_global :: proc ( base_of : int ) -> proc ( int ) -> int {