Skip to content

Instantly share code, notes, and snippets.

// printf -> print to console
#include <stdio.h>
// malloc -> heap memory allocations
#include <stdlib.h>
// Data of the Linked List
typedef struct NodeData {
int num;
} NodeData;
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / README.md
Last active September 30, 2025 19:35
Linux virtual audio sinks (pipewire, service)

Create virtual audio sinks for pipewire automatically using a system (user) service. With the patchbay software helvum the audio can then be routed/multiplexed for e.g. obs. It per default loops back to the default audio output.

# Create the script to unload the sink automatically
mkdir -p ~/.local/bin
nano ~/.local/bin/unload-virtual-sink.sh
chmod +x ~/.local/bin/unload-virtual-sink.sh
# Create the service
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / README.md
Last active July 27, 2025 15:07
Local (open-webui & ollama) LLM setup

Installed programs:

sudo pacman -S ollama
# AUR
yay -S open-webui
# > provides system service to start on Port 8080

Installed models:

Strings in C

Basics

  • the C programming language has a set of functions implementing operations on strings (character/byte strings) in its standard library

    • e.g. length, copying, concatenation, tokenization, searching
  • for character strings, the standard library uses the convention that strings are null-terminated:

@AnonymerNiklasistanonym
AnonymerNiklasistanonym / run.ps1
Created February 14, 2025 10:53
Invoke elevated command from within a PowerShell script
function Invoke-ElevatedCommand {
param (
[string]$Command
)
$ExpandedCommand = "Write-Host `"Command: `"$Command`"; $Command; Read-Host 'Press Enter to exit window and continue'"
Write-Host "Invoke-ElevatedCommand: `"$Command`""
$process = Start-Process powershell.exe -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"$ExpandedCommand`"" -PassThru
$process.WaitForExit()
}
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / render_code_to_svg.sh
Last active September 28, 2024 03:30
Render a code file to a with pdflatex and minted syntax highlighted and with inkscape from PDF converted SVG file
#!/usr/bin/env bash
# Usage: ./render_code_to_svg.sh hello_world.c
# -> Creates hello_world.svg
CODE_FILE="$1"
CODE_FILE_EXTENSION="${CODE_FILE##*.}"
CODE_FILE_OUT="${CODE_FILE%.${CODE_FILE_EXTENSION}}.svg"
BUILD_DIR=build
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / convert.sh
Created February 26, 2024 04:44
Horizontally flip png images and overlay an png image on top of them, then convert the png images to an animated webp image
#!/usr/bin/env bash
# Horizontally flip png images and overlay an png image on top of them
for filename in frame_*.png
do
echo "Update $filename"
# Horizontal flip
magick "$filename" -flop "$filename"
# Add overlay image
magick convert "$filename" "../overlay.webp" -gravity Center -composite "$filename"
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / package.json
Created February 19, 2024 21:30
Add colored stroke around objects in transparent (.png) image
{
"dependencies": {
"sharp": "^0.33.2",
"ts-node": "^10.9.2"
},
"scripts": {
"start": "ts-node script.ts"
}
}
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / erase.sh
Created February 9, 2024 07:43
Replace certain rectangles on images with transparent areas
#!/usr/bin/env bash
# Replace certain rectangles on an osu! skin with transparent areas
# Based on: https://stackoverflow.com/a/64823099
# Used skin: https://drive.google.com/file/d/1pEWOl8hRefi9ZGCitIrKaso-K7jBgj9b/view (- Project HKttyCatz V1.0.0 -.osk)
for filename in ./scorebar-bg*.png; do
WIDTH=$(identify -format '%w' "$filename")
HEIGHT=$(identify -format '%h' "$filename")
if [[ "$filename" == *@2x* ]]; then
@AnonymerNiklasistanonym
AnonymerNiklasistanonym / README.md
Last active December 28, 2023 09:53
Linux OBS Configuration to Stream to Twitch audio without saving it to the VOD

With the following configuration it is possible to stream 2 audio sinks to Twitch and then on the VOD mute one of the sinks while at the same time hearing forwarding both audio streams to your headphone audio output/sink.

Pipewire

How to add virtual audio sinks and make them loop back to another audio sink

See what audio sinks exist

pactl list | grep Name