Skip to content

Instantly share code, notes, and snippets.

View fakuivan's full-sized avatar

fakuivan

  • Posadas, Misiones, Argentina
  • 01:43 (UTC -03:00)
View GitHub Profile
@fakuivan
fakuivan / fakuivan_oriented_programming.md
Created June 11, 2026 03:47
fakuivan oriented programming

fakuivan oriented programming

Some rules I like AI assistants to follow. This should avoid burying themselves under their own dirt. There could be some repetition between sections. Code used for experimentation should not strictly follow these rules, although for long-running sessions that might be the right thing to do.

You might take some inspiration from between sections in case they apply.

Git etiquette

@fakuivan
fakuivan / python_cope.py
Created November 9, 2025 22:30
Python helpers to make working with `Result`s more like python
from typing import Concatenate, NoReturn, overload, NamedTuple, Any
from collections.abc import Callable
from returns.result import Result, Success, Failure
from returns.pipeline import is_successful
type EarlyReturnF[R] = Callable[[R], NoReturn]
def early_return_exc[**Spec, R](
@fakuivan
fakuivan / check_pdb.sh
Created September 26, 2024 23:17
Check if the bedrock dedicated server release contains a pdb file
with_temp_file () {
local temp
temp="$(mktemp)"
trap "rm ${temp@Q}" RETURN
"$@" "$temp"
}
download_has_pdb () {
local version="$1"
local temp_file="$2"
@fakuivan
fakuivan / install.sh
Created July 17, 2022 04:16
Install Magic Wormhole on Termux
# Source: https://www.reddit.com/r/termux/comments/ubtuua/hi_i_need_help_with_this_problem_any_ideas/
# binutils and libsodium are required to build pynacl
# while rust is required to build cryptography
pkg install python rust libsodium binutils
export CARGO_BUILD_TARGET=aarch64-linux-android
pip install magic-wormhole
@fakuivan
fakuivan / tplink_tlsg108e_v1_config_backup.md
Created February 20, 2022 20:07
TP-Link TL-SG108E V1 config backup format
@fakuivan
fakuivan / README.md
Last active June 12, 2021 21:27
Helper script for running VcXsrv from WSL

Helper script for running VcXsrv from WSL

Add it to .bashrc

# Autostart VcXsrv
. <(~/vcxserv_helpers.sh ~/.vcxsrv.port)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
% Evaporado ;0;10;20;30;40;50;60;70;80;90;100
Temperatura (°C) ;32;53;69;88;102;115;126;137;154;177;182
@fakuivan
fakuivan / gray.hs
Created April 30, 2021 22:09
Algorithm implemented in Haskell for generating Grey codes
-- generalized n-ary gray code generator
gray :: (Integral a) => [b] -> a -> [[b]]
gray elems 1 = map (:[]) elems
gray elems n =
concat $ zipWith ($) prependers $ flipN $ gray elems (n-1)
where flipN = (take $ length elems) . (iterate reverse)
prependers = [ map (elem:) | elem <- elems ]
@fakuivan
fakuivan / free_var.py
Created April 28, 2021 00:18
Free variable function pairs in python
from typing import overload, Any, Tuple, Callable, TypeVar
T=TypeVar('T')
@overload
def free_var(initial: T) -> Tuple[Callable[[T], T], Callable[[], T]]: ...
@overload
def free_var(*, like: T) -> Tuple[Callable[[T], T], Callable[[], T]]: ...
def free_var(*args, **kwargs):
#!/usr/bin/env python3.9
from itertools import chain
from typing import Iterator
import argh
ichain = chain.from_iterable
def up_to_multiple(mul: int, val: int) -> int:
"""
Rounds a value up to the nearest multiple
"""