Skip to content

Instantly share code, notes, and snippets.

View taikedz's full-sized avatar

Tai Kedzierski taikedz

View GitHub Profile
@taikedz
taikedz / README.md
Created February 19, 2025 14:55
Install linuxbrew

Install Linuxbrew

Very basic linuxbrew installer for general use-case

I've done this in a podman container as root with success; should work in a native environment

Not tried yet in regular user/sudo mode.

@taikedz
taikedz / person-noalloc.zig
Created February 7, 2025 12:32
Zig: Alloctaion-less experiment
// Small allocation-less experiment.
// For sure, there are ways to not allocate at all: passing stack memory locations down.
// This does mean everything needs to be defined higher up where it is ultimately consumed fully
const std = @import("std");
const Person = struct {
name: []const u8 = "",
age: u8 = 0,
};
@taikedz
taikedz / README.md
Last active March 5, 2025 11:18
Process Timer in Go

ftime - basic timer process

ftime [-t TIMERFILE] -- COMMAND [ARGS ...]

Adapted further into a more featureful tool

@taikedz
taikedz / README.md
Last active January 9, 2025 16:36
Threads vs Processes in Python ; and Goroutines

A little experiment to demonstrate Python's use of threads is indeed concurrency and NOT parallelism

The script is designed such that a bunch of random numbers are processed - this is an attempt at avoiding chances of the execution runtime trying to optimize out some values. The final value is also printed - not because it's interesting, but so that there is no chance the runtime optimizes for the fact that a variable remains unused.

When running the experiment and displaying htop in another screen, it is visible that multi-processing is happening in procs mode (all CPUs blaze a short while), whilst when I use threads mode, the processing offers just some blips here and there as the main python process gets scheduled wherever it can. I also did an implementation in Go which uses goroutines, and observing the behaviour in htop indicates that these are doing some level of leveraging either multiprocessing or OS threads somehow, as go run gorun.go 10 clearly has all processes firing on all cylinder

@taikedz
taikedz / LICENSE
Last active November 21, 2024 09:24
Python simple logger
Copyright (C) Tai Kedzierski
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
@taikedz
taikedz / README.md
Last active November 18, 2024 14:15
Zis idea

Zis : a Zig-Inspired Scripting Language (idea)

These are notes for a Zig-inspired strongly-typed GC language, taking some aspects from Python, and retaining some smiilar simplicity as promised by Go.

Zig brings so several great ideas to the table, but a variant of its apporoach for application-space would be very welcome, so it would provide a similar experience to Zig with many of its characteristics:

  • error unions
  • optionals
  • defer
  • block scopes
@taikedz
taikedz / teepipe.py
Created September 2, 2024 10:13
TeePipe
""" Utility to behave like "tee"
Similar to the system "tee" program, attempts to write the same output to two different channels
In this present case, attempts to write to stdout/stderr , as well as retain for retrieval as string.
To do this, we wrap the pipe, direct the system pipe to write data to an interim temp file, and we read
that file content back into memory and write it through to the wrapped pipe ourselves.
"""
@taikedz
taikedz / README.md
Last active May 2, 2024 16:04
Periodic operations

Periodic Operations

A sched.scheduler wrapper to run continuously as a "service", to queue up one-time operations.

A PeriodicOperation based on native threading.Timer, runs as a "service".

Both can be stopped.

Timer could have been used in lieu of the scheduler, but the latter stands to have more precision.

@taikedz
taikedz / README.md
Last active January 17, 2024 09:39
Fate chances

Roll Fate

This is a quick script to see the chances of outcome of rolling Fudge/FATE dice against opposition.

Mainly, I am interested in rolling at Good skill against Good opposition , and seeing what happens.

Adding a +1 skill modifier is akin to being +1 shift above the Good opposition (skill Great).

  • -2 and below is abject failure
  • -1 is failure
@taikedz
taikedz / json-select-where.py
Last active January 11, 2024 10:58
Extract data from matching entries in a JSON file
from argparse import ArgumentParser
import json
from typing import List
OPERATIONS = {
"starts": lambda value, data: data.startswith(value),
"!starts": lambda value, data: not data.startswith(value),
"ends": lambda value, data: data.endswith(value),