Skip to content

Instantly share code, notes, and snippets.

@bazzargh
bazzargh / README.md
Last active November 1, 2026 01:07
An extremely basic jellyfin client for running on SteamOS

I use jellyfin on steam OS, but I really, really don't like the client. It's completely mouse-oriented. For a basic thing like exiting jellyfin, you have to navigate to the user in the top right then find exit. What I want is a tv mode that acts like a tv mode: navigation with arrow keys, select and back only.

To simplify my needs a bit, I'm going to split my client into 3: one for movies, one for shows, and one for music. That means I can navigate between the item types as non-steam apps with the native steam browser, reducing the amount I have to do in the application itself.

Movies is the simplest one: I have (only) a couple of hundred movies, they all load in a single call to /Items in jellyfin, which makes it easy to display the posters. I used pygame and made them render

@bazzargh
bazzargh / README.md
Created October 27, 2026 11:19
p5js halftone experiment.
image

Experiment in halftoning. This is all a bit shonky but from reading https://en.wikipedia.org/wiki/Halftone I needed to convert RGB to CMYK, then for each colour, find the nearest grid point (each channel in CMYK is a grid at a different angle) and decide if the pixel lies in the dot. Then convert the values back to RGB.

Wikipedia supplies grid angles, but not dot sizes, so I just posterize each of the channels and pick a dot size in [0,1,2,3], with a grid size of 5.

@bazzargh
bazzargh / README.md
Last active October 9, 2026 16:53
an attempt to make movies display in the steam library

I have jellyfin on a steam machine using jellyfin-on-SteamOS but I don't like the media browser, and it feels off running it from Steam.

All of my movie files have NFO and images set up by tinyMediaManager. This script tries to use the NFO, movie file, and images to generate an entry in steam's shortcuts so the movie appears 'like a game'.

so far:

  • all the movies do appear in the library, with images
  • the command I've told it to run (using systemd-inhibit to stop the screen timing out while movies are playing, and flatpak mpv to play media files) does work on desktop
@bazzargh
bazzargh / shining.js
Created February 5, 2026 02:25
p5.js program to show a scene from The Shining with an animated carpet. Intended for use in https://editor.p5js.org/
const redrum = "#8a1d1e"
const dunny = "#46281c"
const torange = "#bb6538"
let img
let gr
const s3 = Math.sqrt(3)
function preload() {
img = loadImage("https://i0.wp.com/boingboing.net/wp-content/uploads/2018/07/the-shining-carpet-corridor-danny-600435-1.jpg")
@bazzargh
bazzargh / crossstitch.js
Created December 20, 2025 10:31
cross-stitch generator. paste into p5js.org to see it. fakes "3d" just by drawing threads 3 times in different shades.
const bf = [
" XXX XXXX XXXX XXXX XXXXX XXXXX XXXX X X XXXXX XX X X X X X X X XXX XXXX XXX XXXX XXXX XXXXX X X X X X X X X X X XXXXX",
"X X X X X X X X X X X X X X X X X XX XX XX X X X X X X X X X X X X X X X X X X X X X X ",
"XXXXX XXXX X X X XXX XXX X XX XXXXX X X XXX X X X X X X X X X XXXX X X XXXX XXX X X X X X X X X X X X ",
"X X X X X X X X X X X X X X X X X X X X X X XX X X X X X X X X X X X X X XX XX X X X X ",
"X X XXXX XXXX XXXX XXXXX X XXX X X XXXXX XXX X X XXXXX X X X X XXX X XX X X X XXXX X XXX X X X X X X XXXXX"
]
const b1 = [
" ",
@bazzargh
bazzargh / circles.js
Last active April 12, 2025 22:40
"place specimens on the grid at randomly selected points until no more can be placed: "no more" because each specimen has a neighborhood radius r_i such that no other specimens may be placed within that radius."
function initialiseGrid(w, h) {
// first get all the initial max radii
let temp = []
for (let x = 0; x < w; x++) {
for (let y = 0; y < h; y++) {
let k = JSON.stringify([x, y])
temp.push([k, Math.min(x, y, w-x, h-y)])
}
}
// now shuffle, so that we do not need to filter
@bazzargh
bazzargh / nostromo.js
Created February 2, 2025 18:24
"Landing The Nostromo" implemented in p5.js
// based on Landing the Nostromo by Alan Sutcliffe
// https://archive.org/details/creativecomputing-1981-06/page/n51/mode/2up?ui=embed&view=theater
let aspect = 46
let probe = 7
let line_stat = 14
let z=[]
let panel1=""
let panel2=""
@bazzargh
bazzargh / waffle.py
Created April 23, 2024 09:59
generate waffle puzzles
#!/usr/bin/env python3
import fileinput
import random
# words contains the 5 letter wordle solution list
with fileinput.input(files=("words")) as f:
words = [line.strip() for line in f]
@bazzargh
bazzargh / aocwatch.sh
Created December 15, 2023 13:14
for advent of code, run on save of .py or .txt data. Used as: tmux new -s aoc -n log aocwatch \; splitw -h
#!/bin/bash
echo Starting watch in $(pwd)
fswatch --event=Updated . | while read -r event; do
if [[ "$event" == *.py ]]; then
echo Setting script to ${event}. Data is ${data:-not set}
script=$event
elif [[ "$event" == *.txt ]]; then
echo Setting data to ${event}. Script is ${script:-not set}
data=$event;
@bazzargh
bazzargh / cmd-line-fu.sh
Last active November 9, 2023 21:31
insert prepared snippets when you press Esc-j, with fuzzy search
# insert prepared snippets when you press Esc-j, with fuzzy search
fu-complete() {
# the whole command line up to last pipe left of the cursor
local prefix=$(printf "%s" "${LBUFFER}"|sed -E 's/(.*[|] *).*/\1/')
# everything left of cursor after the last pipe, gets used as the fzf prompt
local suffix=$(printf "%s" "${LBUFFER}"|sed -E 's/.*[|] *//')
# Grab snippets from ~/.cmd-line-fu . The file can have optional one-line comments before
# commands, which appear in fzf inlined and are searchable, eg:
# # print first column
# awk '{print $1}'