Skip to content

Instantly share code, notes, and snippets.

@sueszli
sueszli / llvmlite.py
Last active December 28, 2025 23:21
llvmlite
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "llvmlite==0.46.0",
# ]
# ///
import llvmlite.binding as llvm
import llvmlite.ir as ir
@sueszli
sueszli / contribute.sh
Last active December 27, 2025 10:52
cheat sheet
git switch -c <name>
git push origin <name>
git branch -r
# ---------- reset to upstream
git remote add upstream https://github.com/xdslproject/xdsl/
git config pull.rebase false
git pull upstream main
git remote -v
@sueszli
sueszli / or_xor.py
Last active December 27, 2025 12:01
canonicalization patterns
from xdsl.builder import Builder, InsertPoint
from xdsl.context import Context
from xdsl.dialects import riscv
from xdsl.dialects.builtin import ModuleOp
from xdsl.transforms.canonicalize import CanonicalizePass
from xdsl.printer import Printer
ctx = Context()
ctx.load_dialect(riscv.RISCV)
@sueszli
sueszli / experiment.py
Created December 25, 2025 18:09
experiment
# /// script
# dependencies = [
# "lark",
# "typing_extensions",
# "immutabledict",
# ]
# ///
import argparse
from functools import lru_cache
@sueszli
sueszli / toilet.txt
Created October 2, 2025 16:19
toilet fonts
❯ ls /opt/homebrew/share/figlet/*.tlf | xargs -n 1 basename | sed 's/\.tlf$//' | while read font; do echo "FONT: $font"; toilet -f $font "sample"; done
FONT: ascii12
mmmm
""##
mm#####m m#####m ####m##m ##m###m ## m####m
##mmmm " " mmm## ## ## ## ##" "## ## ##mmmm##
""""##m m##"""## ## ## ## ## ## ## ##""""""
#mmmmm## ##mmm### ## ## ## ###mm##" ##mmm "##mmmm#
"""""" """" "" "" "" "" ## """ """" """""
@sueszli
sueszli / CMakeLists.txt
Last active September 30, 2025 05:39
ossf compiler hardening with cmake
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
project(demo LANGUAGES C)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED ON)
if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 14.0.0)
message(FATAL_ERROR "GCC is outdated: ${CMAKE_C_COMPILER_VERSION}")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0)
@sueszli
sueszli / robust_compiler_options.py
Last active September 29, 2025 14:02
make your compiler mighty strong hehehhe
#
# Usage: `uv run robust_compiler_options.py > options.json`
# See: https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies
#
#
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "requests==2.32.4",
# "markdown==3.6",
@sueszli
sueszli / docker-compose.yml
Last active November 28, 2024 22:55
gfortran for R packages on ARM based machines
# this container just serves to install the `klaR` package
#
# usage:
#
# $ docker compose up -d
# $ docker compose exec main Rscript -e "rmarkdown::render('ex7.rmd', output_format = 'pdf_document')"
services:
main:
container_name: main
@sueszli
sueszli / mnist.py
Created November 11, 2024 18:05
dependency free python implementation of mnist
def sigmoid(x): return 1/(1 + __import__('math').exp(-x))
def train_mnist():
# Generate mock MNIST data (28x28 images)
X = [[float(i%2) for i in range(784)] for _ in range(100)] # Mock input
y = [[1 if i==j else 0 for i in range(10)] for j in range(100)] # Mock labels
# Initialize weights and biases
W1 = [[0.01*((i+j)%2) for j in range(784)] for i in range(30)]
W2 = [[0.01*((i+j)%2) for j in range(30)] for i in range(10)]
@sueszli
sueszli / allennlp.md
Last active June 19, 2024 17:30
allennlp==1.2.2 with python3.6.12

how to install

  • conda:

    works great. no issues.

  • docker:

    works well - unless you want to use the latest stable vscode version as of may 2024.