Skip to content

Instantly share code, notes, and snippets.

View okikio's full-sized avatar
🏠
Working from home

Okiki Ojo okikio

🏠
Working from home
View GitHub Profile
@okikio
okikio / config-NetworkManager.sh
Created August 8, 2025 20:23
Setup network manager to work with tailwind
#!/bin/bash
# Define the path for the NetworkManager configuration file
CONFIG_FILE="/etc/NetworkManager/conf.d/99-tailscale.conf"
# Function to check if the script is run with sudo (root privileges)
check_root() {
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root (use sudo)."
exit 1
@okikio
okikio / disable-kcm-users.sh
Last active August 8, 2025 20:25
When using systemd-homed the normal ways of managing users via the KDE menu no longer work, to avoid errors we're disabling the user management menu in KDE.
#!/bin/bash
# Define the file paths for the kcm_users.so plugin and its disabled state
KCM_PATH="/usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_users.so"
KCM_DISABLED_PATH="$KCM_PATH.disabled"
# Function to check if the script is run with sudo (root privileges)
check_root() {
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root (use sudo)."
// Operators
// Transforms a stream of data (T) into another stream (R).
// Why: Allows flexible data processing. Solves chaining operations.
export type Operator<T, R> = (stream: ReadableStream<T>) => ReadableStream<R>;
// Like Operator, but output excludes errors.
// Why: Ensures error-free streams. Solves safe data handling.
export type SafeOperator<T, R> = Operator<T, Exclude<R, ObservableError>>;
// Combines Operator and SafeOperator.
@okikio
okikio / 1-rebase-to-branch.md
Last active February 15, 2025 22:39
Using git rebase to update your local branch.

Below is a step-by-step guide (in plain English) for rebasing your feature branch on top of main. The code is purely demonstrative—treat it as a starting point if you want an automated workflow around Git operations.

Tip

There is an attached bash script I call gitru.sh (git rebase update). It automatically rebases your local feature branch (basically it updates your local branch with changes from the main branch). Only run it on separate feature branches avoid running it on the main branch.


1. Scientific Method-Inspired Breakdown

1.1 Design Requirements & Use Cases

Solid UI is basically a fork of shadcn/ui for solidjs, it uses the exact same components and props. The only difference is that they add a couple new components, specifically

Progress Circle

Visual element to indicate progress, performance, or status represented in a circular shape.

import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar"
import { Card } from "~/components/ui/card"
import { ProgressCircle } from "~/components/ui/progress-circle"
@okikio
okikio / constrain-transform-stream-queues.md
Last active December 7, 2024 03:04
Queue's via TransformStreams

Using TransformStream in place of traditional queue implementations is an interesting approach that leverages the stream API's natural queuing and backpressure features. Below is a breakdown of how you might implement each queue type using TransformStream, adhering to the constraint of using no more than 2 TransformStreams per queue, and addressing any limitations that arise.

1. Simple Queue (FIFO Queue)

  • Implementation:
    • TransformStream 1: This stream simply passes data from the writable side to the readable side in FIFO order.
    • TransformStream 2: Not necessary in this case, as one TransformStream is sufficient to maintain the FIFO order.
const fifoQueue = new TransformStream(undefined, undefined, { highWaterMark: Infinity });
@okikio
okikio / split-iter.ts
Last active August 21, 2024 06:10
Splits a single iterator into 2 separate async iterators by some predicate or by whether an error occurs or not.
/**
* An async generator function that pulls values from the source async iterator.
*
* @template T The type of values being yielded from the source iterator.
*
* This generator yields values it receives from an external source (via `yield`).
* It also receives an initial value when invoked, which is yielded first.
*
* ### How it Works
*
// Target object
const target = {
foo: 1,
bar: 2,
};
// Fallback object
const fallback = {
bar: 20, // This will be overridden by target's bar
baz: 3,
import type { Logger as LogTapeLogger } from "@logtape/logtape";
import { deepMerge } from "@bundle/utils/utils/deep-equal.ts";
import { getLogger } from "@logtape/logtape";
export const initLogger = getLogger(["@bundle/core", "init"]);
export const buildLogger = getLogger(["@bundle/core", "build"]);
export const generalLogger = getLogger(["@bundle/core", "general"]);
// Add more loggers as needed
import type { Filter } from "./filter.ts";
import type { LogLevel } from "./level.ts";
import type { LogRecord } from "./record.ts";
import type { Sink } from "./sink.ts";
/**
* A logger interface. It provides methods to log messages at different
* severity levels.
*
* ```typescript