Skip to content

Instantly share code, notes, and snippets.

View SpotlightKid's full-sized avatar

Christopher Arndt SpotlightKid

View GitHub Profile
SpotlightKid /
Last active April 19, 2024 20:50
Count occurences of same lines read from standard input.
"""Count occurences of same lines read from standard input.
Outputs a table sorted by descending count.
import sys
from collections import Counter
import natsort
SpotlightKid / Makefile
Last active April 11, 2024 12:49
Generic FAUST to LV2 plugin makefile
PREFIX ?= /usr
LV2_DIR ?= $(PREFIX)/lib/lv2
FAUSTFLAGS ?= -nvoices 4
NAME ?= mydsp
LV2_BUNDLE = $(NAME).lv2
ROOT_DIR:=$(shell dirname "$(realpath $(firstword $(MAKEFILE_LIST)))")
SpotlightKid /
Last active April 3, 2024 22:38 — forked from thingsiplay/selectfile
Use rofi to select file or folder until file is selected, then print it.
#!/usr/bin/env bash
# rofi-selectfile
# Use rofi to select file or folder until file is selected, then print it.
# Arguments
# $1=directory to start, defaults to "." (specified in variable default_dir)
# Adapted from:
SpotlightKid /
Last active March 22, 2024 18:18
Basic FastAPI app template with Jinja2 templating and static files
"""Template for a minimal FastAPI app serving just one page from a Jinja2 template and a favicon.
Place the Jinja2 "index.html" template in "templates/jinja2" and a "favicon.ico" icon file in
"static/img" and additional static files (JavaScript, CSS, images) below "static". You can then
reference them in the template like this ("path" is relative to "static"):
{{ url_for('static', path='/dir/file.txt') }}
SpotlightKid /
Last active February 14, 2024 21:49
Run klick metronome and tap tempo with enter/return key
# Run klick metronome and tap tempo with enter/return key
cleanup() {
stty echo
oscsend localhost 9001 /klick/metro/stop
SpotlightKid /
Created August 2, 2023 14:21
Send bytes given on the command line as hexadecimal digit pairs to selected MIDI output
#!/usr/bin/env python3
import sys
from rtmidi.midiutil import open_midioutput
if sys.argv[1:]:
midiout, _ = open_midioutput()
midiout.send_message(bytearray.fromhex(" ".join(sys.argv[1:])))
SpotlightKid /
Created June 2, 2023 18:53
Examine an RSS feed retrieved from given URL
#!/usr/bin/env python
"""Examine an RSS feed retrieved from given URL."""
import sys
from xml.dom.minidom import parseString as parse_xml
import feedparser
import requests
SpotlightKid /
Created April 24, 2023 19:02
Display waveform of an audio file using PyQt/QPainter
#!/usr/bin/env python
"""Display waveform of an audio file."""
import argparse
import logging
import sys
from statistics import fmean
from PyQt6 import QtCore, QtGui, QtWidgets
from PyQt6.QtCore import Qt
SpotlightKid / cchorus.dsp
Last active February 26, 2023 23:31
FAUST versatile stereo chorus effect
declare name "CChorus";
declare version "0.5";
declare author "Christopher Arndt";
declare license "MIT License";
declare description "Versatile stereo chorus effect";
PI = ma.PI;
TWOPI = 2.0 * ma.PI;
SpotlightKid / pthreads_cython.pyx
Last active December 4, 2022 18:59 — forked from jerryvig/pthreads_cython.pyx
Basic demonstration of how to use pthreads (POSIX threads) in Cython.
# cython: language_level=3, boundscheck=False
from cython.operator cimport dereference
from libc.stdio cimport printf
from posix.unistd cimport usleep
cdef extern from "pthread.h" nogil:
ctypedef int pthread_t
ctypedef struct pthread_attr_t: