Skip to content

Instantly share code, notes, and snippets.

View sdomi's full-sized avatar
💽
Delist this page from search results. Instead point to git.sakamoto.pl/domi/

sdomi

💽
Delist this page from search results. Instead point to git.sakamoto.pl/domi/
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
@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
@izabera
izabera / readfile.md
Last active January 6, 2025 17:44
reading a file line by line in your shell

context: shells want to leave the seek position at the right offset so external commands can continue reading from the same fd


i saw this somewhat surprising tally of syscalls in bash. let's investigate

surprise

one iteration:

  • unblock all signals

A funky shell thingy that I've never seen before

So you're in posix sh and you want to do the equivalent of this in bash:

foo | tee >(bar) >(baz) >/dev/null

(Suppose that bar and baz don't produce output. Add redirections where needed if that's not the case.)

Advanced Recursive Diffing™

Ever needed to diff two trees of files, while doing some preprocessing on modified files? Well - we've got a solution for you. Or rather... our long friend git has.

Turns out it's perfectly legal to just use git diff --no-index on directories outside of (any) git repository. With that, we can (ab-)use built in git diff per-path/extension preprocessing feature.

@katef
katef / plot.awk
Last active November 20, 2024 23:27
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@szepeviktor
szepeviktor / signal-without-smartphone.md
Last active July 11, 2025 20:49
Install Signal without a smartphone
@dideler
dideler / bot.rb
Last active August 6, 2025 08:11
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#

Using the fs-net libtransistor fork

This guide assumes you are already familliar with setting up RetroArch with libtransistor.

Clone the fs-net branch from https://github.com/davidbuchanan314/libtransistor:

git clone https://github.com/davidbuchanan314/libtransistor --recursive -b fs-net

Build libtransistor as usual.

@izabera
izabera / try-catch.sh
Last active June 28, 2025 09:44
silly try/catch
# try catch for bash/mksh/zsh/dash/busybox
[ "$BASH_VERSION" ] && shopt -s expand_aliases
alias try='tryblock ()'
alias throw='return'
alias catch='if tryblock; then :; else '
alias end_try='fi'
alias exceptions:='case $? in x) '
alias except=';;'
alias end_exceptions='esac'
alias always=' '