Skip to content

Instantly share code, notes, and snippets.

View orzklv's full-sized avatar
🇺🇿
Convincing government to do more Open Source.

Orzklv orzklv

🇺🇿
Convincing government to do more Open Source.
View GitHub Profile
@orzklv
orzklv / run.sh
Created January 19, 2026 22:41
LLVM as a benchmark suite
git clone https://github.com/llvm/llvm-project/ ./llvm
cd llvm && vim shell.nix
nix-shell
mkdir -p ./build && cd ./build
cmake $cmakeFlags -G Ninja ../llvm
time ninja
@orzklv
orzklv / tap.rs
Created January 8, 2026 21:01
Preserve self instance while applying a closure function.
/// Apply closure function preserving self instance
pub trait TryTap: Sized {
fn try_tap<E>(self, f: impl FnOnce(&Self) -> Result<(), E>) -> Result<Self, E>;
}
impl<T> TryTap for T {
fn try_tap<E>(self, f: impl FnOnce(&Self) -> Result<(), E>) -> Result<Self, E> {
f(&self)?;
Ok(self)
}
@orzklv
orzklv / async_and_then.rs
Created January 8, 2026 20:57
Async .and_then() for your perfectionism!
pub trait AsyncResult<T, E> {
async fn and_then_async<U, F: AsyncFnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E>;
}
impl<T, E> AsyncResult<T, E> for std::result::Result<T, E> {
#[inline]
async fn and_then_async<U, F: AsyncFnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> {
match self {
Ok(t) => op(t).await,
Err(e) => Err(e),
@orzklv
orzklv / create-installer.sh
Created November 8, 2025 11:52
Fetch and create latest MacOS Installer
# Source: https://unboundplanet.com/nova/the-cleanest-macos-tahoe-macos-26-mac-hackintosh-vm/
# List all avialable installers
softwareupdate --list-full-installers
# Fetch the latest installer
softwareupdate --fetch-full-installer --full-installer-version 26.0.1
# Check if installer has been fetched
ls -lh /Applications | grep -i "tahoe"
@orzklv
orzklv / runner-module.nix
Last active September 30, 2025 23:20
Module to generate runners from a single list.
{
lib,
config,
pkgs,
...
}: let
cfg = config.kolyma.runners;
user = {
users.users.${cfg.user} = {
@orzklv
orzklv / app.nix
Created September 28, 2025 18:32
Generate nix module config out of list
{
lib,
config,
inputs,
...
}: let
cfg = config.kolyma.www;
bnest = mod: lib.strings.splitString "." mod;
@orzklv
orzklv / package.nix
Last active October 2, 2025 06:39
E-IMZO manager early nix adoption package
{
stdenv,
lib,
libiconv,
fetchFromGitHub,
gcc,
llvmPackages,
appstream,
appstream-glib,
cargo,
@orzklv
orzklv / good-example.hs
Created March 28, 2025 18:10
Java devs, get the rope!
-- Algebraic data type definition
data Tree a = Empty | Node (Tree a) a (Tree a) deriving (Show)
-- Insertion function
insert :: (Ord a) => a -> Tree a -> Tree a
insert x Empty = Node Empty x Empty
insert x (Node left v right)
| x < v = Node (insert x left) v right
| otherwise = Node left v (insert x right)
{
lib,
stdenv,
jre8,
curl,
ccid,
fetchurl,
pcsclite,
pcsc-tools,
writeShellScript,
{
homeConfigurations = {
# ___ __
# / | ____ ____ / /__
# / /| | / __ \/ __ \/ / _ \
# / ___ |/ /_/ / /_/ / / __/
# /_/ |_/ .___/ .___/_/\___/
# /_/ /_/
# For all my current OSX machines
"sakhib@apple" = home-manager.lib.homeManagerConfiguration {