Skip to content

Instantly share code, notes, and snippets.

View jonas-klesen's full-sized avatar

Jonas Klesen jonas-klesen

View GitHub Profile
@jonas-klesen
jonas-klesen / bash-install.sh
Created February 19, 2026 23:30
"curl | bash" is evil and I'm here to fight it. Blogpost: https://blog.jonas-klesen.de/bash-install
#!/usr/bin/env bash
# bash-install: Safe wrapper for "curl ... | bash" install patterns.
# Reads a piped script, shows it in a pager, and lets you accept, deny,
# or ask an LLM to review it before running.
set -euo pipefail
OPENAI_MODEL="gpt-4.1-mini"
OPENAI_API_URL="https://api.openai.com/v1/chat/completions"
LLM_MAX_BYTES="${BASH_INSTALL_LLM_MAX_BYTES:-102400}" # 100 KB default
@jonas-klesen
jonas-klesen / conversion.py
Created February 20, 2020 15:03
PyCairo to cv2 VideoWriter color conversion example with igraph
# After lots of trying, for some really weird reason this is the way it has to be done:
import cv2
import cairo
from igraph import drawing
w = 1000
h = 1000
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h)