Skip to content

Instantly share code, notes, and snippets.

View blokyk's full-sized avatar
🏳️‍⚧️
"queer-coded? you're telling me a queer coded this??"

blokyk

🏳️‍⚧️
"queer-coded? you're telling me a queer coded this??"
View GitHub Profile
@blokyk
blokyk / scons2dot.hs
Last active September 12, 2026 23:13
turn the output of `scons --tree=all,status` into a graphviz graph. tiny change from @lpenz's original script, just to enable it to read from stdin instead of running scons itself
#!/usr/bin/env nix-shell
#! nix-shell --pure -i runghc -p "ghc.withPackages (pkgs: [])"
-----------------------------------------------------------------------------
-- |
-- scons2dot - Generates graphviz file of scons dependency information
-- Copyright (C) 2008 Leandro Penz
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@blokyk
blokyk / typst.nanorc
Last active November 4, 2026 01:01 — forked from abenson/typst.nanorc
typst.nanorc
syntax default
color ,green "[[:space:]]+$"
syntax "typst" "\.typ(st)?"
# a lot of typst files start with setting the text language or the page format
header "^#set (page|text)\(.*"
# how to comment single lines
comment "// |"
@blokyk
blokyk / nseq.nix
Created April 4, 2026 00:59
Get arbitrarily-deep `seq`/`deepSeq` with nix
# Usage: nseq <depth> <expr to strict-ify> <return value>
# Example:
# { ... }@args:
# builtins.trace (builtins.nseq 3 args args) 45
# (ps: yes, this is probably extremly inefficient but for my defense i have bigger problems right now)
nseq = n: val: ret:
if n == 0 then
builtins.seq val ret
else if builtins.isList val then
@blokyk
blokyk / npins-shell.sh
Last active March 6, 2026 01:24
Create a new shell with a NIX_PATH based on `npins` pins (by default, from `npins/sources.json`). Useful for faking channels while still pinning stuff.
#!/bin/bash
# shellcheck shell=bash
# create a new shell/env with a NIX_PATH based on the pins in npins/sources.json
pinsDir="${NPINS_DIRECTORY:-npins}"
if [[ -v 1 ]] && { [[ "$1" = "-d" ]] || [[ "$1" = "--directory" ]]; }; then
shift
[[ -v 1 ]] || (echo "Option '--directory' expected an argument"; exit 1)
pinsDir="$1"
@blokyk
blokyk / nixp.sh
Last active March 7, 2026 03:43
a cursed little bash script to search though nixpkgs packages without having to open a repl. open to suggestions! up to date version in my hm config repo
#!/bin/bash
# shellcheck shell=bash
# print information about a given package (by default, from nixpkgs)
if [[ "${1:-}" = "-h" ]] || [[ "${1:-}" = "--help" ]]; then
exe="$(basename "$0")"
echo -e "\x1b[1m$exe: search packages and print info about them\x1b[0m"
echo -e
echo -e "usage:"
@blokyk
blokyk / Makefile
Created December 30, 2025 15:52
automatic makefile help text
# from: https://nikita.computer/posts/makefile-tips/
.PHONY: help
help: ## Show this help message
@grep --no-filename -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | awk 'BEGIN { \
FS = ":.*?## "; \
printf "\033[1m%-30s\033[0m %s\n", "TARGET", "DESCRIPTION" \
} \
{ printf "\033[32m%-30s\033[0m %s\n", $$1, $$2 }'
@blokyk
blokyk / I FUCKING HATE AI CODING.md
Last active March 9, 2026 20:45
I FUCKING HATE AI CODING

A friendly message to other coders using AI for PRs. For more information, see: justsayno.ai

@blokyk
blokyk / README.md
Last active April 16, 2025 16:39
NFTables-based rerouter (+service file) for blokyk/ebpf-rerouter

This is a small shell script + systemd service file that reroutes/NATs all outgoing traffic through a local-running tunnel (listening on port 18000).

This is meant to be used with the tunnel and systemd files from ebpf-tunnel. In fact, it should be a drop-in replacement for ebpf-rerouter (and its service file). However, the two cannot coexist, so if you've already installed the first one, you'll need to disable ebpf-rerouter:

sudo systemctl stop ebpf-rerouter.service
sudo systemctl disable ebpf-rerouter.service
@blokyk
blokyk / -.sh
Created February 25, 2025 00:32
Routing all outgoing traffic to a local tunnel that then connects to a local Cntlm proxy (make sure Cntlm is started under the `cntlm` user)
nft add table ip nat
nft add chain ip nat output '{ type nat hook output priority 0 ; }'
nft add rule ip nat output 'meta skuid cntlm ip protocol tcp accept ;'
nft add rule ip nat output ip protocol 'tcp ip daddr != 127.0.0.1/24 dnat ip to 127.0.0.1:18000 ;'
@blokyk
blokyk / syno.sh
Last active September 4, 2026 14:41
A very simple CLI thesaurus with fuzzy search (using `fzf`) // Un chercheur de synonymes avec recherche approximative (avec `fzf`)
#!/usr/bin/env bash
# syno -- a basic thesaurus CLI based on fzf
#
# == USAGE ==
# You can either start syno directly, or give an initial query
# syno
# syno 'lovely'
# This will open `fzf` in interactive mode, displaying a list
# of matching words on the left, and the thesaurus enties on the right.