Skip to content

Instantly share code, notes, and snippets.

View izabera's full-sized avatar

Isabella Bosia izabera

  • DDN
  • Flitwick, UK
View GitHub Profile
@izabera
izabera / seds
Created July 31, 2025 13:21
funky sed commands from my /usr/share/dict/words
sed 'sentence;secede;secede' <<< canter # canter -> cancer -> dancer -> dander
sed 'severe;serene;secede' <<< cove # cove -> core -> cone -> done
sed 'septette;settee' <<< Capt # Capt -> Catt -> Ca
sed 'severe;serene' <<< Iva # Iva -> Ira -> Ina
sed 'severe;serene' <<< paves # paves -> pares -> panes
sed 'secrete;settee' <<< critter # critter -> titter -> tier
sed 'severe;serene' <<< v # v -> r -> n
sed 'severe;serene' <<< coves # coves -> cores -> cones
sed 'severe;serene' <<< vapes # vapes -> rapes -> napes

asking gemini to write some cube code

i'm writing another lil cube thing. if you've ever written a rubik's cube simulator/solver, you will know that some parts can be more akin to data than to code. one way or another, you always end up with lots and lots of tables to select the right pieces and move them to the right places. if good code reads like poetry and bad code reads like a phonebook, this is always easily in the top 10 most mind-numbingly boring programs of all time.

@izabera
izabera / check.awk
Last active July 8, 2025 11:06
floatcomplex nerd sniped me into testing how many sigwinches i can get per second via terminal resizes
1
/sent/ { stot += sent[s++] = $2 }
/recv/ { rtot += recv[r++] = $2 }
END {
if (r != s)
printf "error: s=%d r=%d\n", s, r
for (i in sent)
if (sent[i] < recv[i])
printf "error: sent[%d]=%d recv[%d]=%d\n", i, sent[i], i, recv[i]
printf "sent=%'d avg=%'d\n", stot, stot/s
#!/bin/bash
usage () {
cat << 'eof'
bgcmd manages a long running, interactive command in background
usage:
bgcmd START command [args...] # starts a command in background
@izabera
izabera / magic_namerefs.md
Last active July 8, 2025 15:10
magic namerefs

namerefs (introduced in bash 4.0) act as aliases for other variables

var=meow
declare -n ref=var

echo $ref  # prints meow

ref=moo
echo $var  # prints moo
@izabera
izabera / posixlist.c
Created May 4, 2025 00:50
minimal list of all posix function prototypes, forwarding everything (mostly correctly) and with zero includes
#if 0
#define _XOPEN_SOURCE 700
#include <aio.h>
#include <arpa/inet.h>
#include <assert.h>
#include <_Complex.h>
#include <ctype.h>
#include <dirent.h>
#include <dlfcn.h>
#include <errno.h>
@izabera
izabera / rpn.bash
Created February 28, 2025 08:08
basic rpn calculator with assignments
set -f
IFS=
rpn () {
for token do
case $token in
+|-|\*|/|%|\*\*) (( stack[-2] = stack[-2] $token stack[-1] )); unset stack[-1] ;;
=) (( ${stack[-2]} = stack[-1] )); unset stack[-1] stack[-1] ;;
*) stack+=($token) ;;
esac
@izabera
izabera / ipctest.c
Last active February 4, 2025 23:49
#include <arpa/inet.h>
#include <errno.h>
#include <netinet/in.h>
#include <pty.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/wait.h>
@izabera
izabera / sincos
Last active January 19, 2025 12:53
#!/bin/bash
pi=205667
scale=65536
maskf0=-$scale
mask0f=$((scale-1))
shift=16
pisq=42389628127
pi2=411775
pi_2=102944
pi_4=51472
@izabera
izabera / recursive_exp.md
Last active June 9, 2025 21:26
recursive expansions

for the latest chapter of what's becoming a blog on the most cursed bash you can imagine, let's do some maths together

euclid's algorithm for gcd could be written like this in python:

>>> def gcd(a, b):
...     if b:
...         return gcd(b, a%b)
... return a