Skip to content

Instantly share code, notes, and snippets.

@digitalsignalperson
digitalsignalperson / qemu_netdev_socket_vlan.md
Created June 10, 2022 18:47 — forked from mcastelino/qemu_netdev_socket_vlan.md
QEMU usermode virtual vlan using -netdev socket

Goal

How to launch multiple QEMU based VM's that can communicate with the outside world and between each other other without any setup on the host.

This uses two features available in qemu

  • User Mode Networking stack - SLIRP
  • Socket networking backend allows you to create a network of guests that can see each other

This allows us to have

@digitalsignalperson
digitalsignalperson / readme.md
Last active March 31, 2023 08:24
Mixxx midi output mappings generator for touchosc-dj (WIP)

Summary

What this does: controlling volume for deck 1 or deck 2 from any interface (midi controllers, GUI, or TouchOSC) results in midi output sent back to TouchOSC to update their positions

Note: I did this without reading https://github.com/mixxxdj/mixxx/wiki/midi%20scripting and I think the midi scripting interface probably resolves the issues I had and simplifies the approach.

Work log

A google of mixxx osc turned my afternoon into this...

https://www.reddit.com/r/DJs/comments/rwq59j/djing_on_a_budget_homemade_touchosc_controller/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>
#include <X11/Xatom.h>
// Enable clickthrough, transparency, and always on top for a given window
// x-clickthrough <windowid> <alpha (0-100)>
//
@digitalsignalperson
digitalsignalperson / zfs-native-encryption-test.sh
Last active June 27, 2023 17:58
zfs encryption speed test
#!/bin/bash
# From https://www.medo64.com/2022/10/native-zfs-encryption-speed-ubuntu-22-10/
# https://docs.google.com/spreadsheets/d/1spTTlEJESnVFSEsB98iVviA-l_unf6Hemx9Nh8KrBBI/edit#gid=1839759404
#
# Tweaks for faster test: only do 2 tests, only sleep 2 seconds, only use aes-256-gcm for zfs
# Tweaks to LUKS config
# don't use sync=always
# use only 1 vdev
@digitalsignalperson
digitalsignalperson / lxd-common
Created September 12, 2023 00:32
arch linux LXD stuff
_source() {
source ${BASE_DIR}/lxd/lxd-common
}
#======================
# General VM functions
vm_bash() {
lxc exec "$VMNAME" -- bash "$@"
@digitalsignalperson
digitalsignalperson / disable-trackpad-timeout.py
Last active September 25, 2023 23:21
A script to auto-disable a trackpad N seconds after last press.
#!/bin/python
import time
import subprocess
import threading
def get_device_node(name, strip_path=False):
# output = subprocess.check_output(["xinput", "list-props", name]).decode('utf-8')
# for line in output.splitlines():
@digitalsignalperson
digitalsignalperson / fish_merge.py
Last active January 18, 2024 02:21
Merge multiple fish history files together using flock (untested)
#!/bin/python
import pathlib
import fnctl
import yaml
import time
# Watch for changes in other_history and merge them into local_history
local_history = pathlib.Path('~/.local/share/fish/fish_history').expanduser()
other_history = pathlib.Path('~/.local/share/fish/other_history').expanduser()
@digitalsignalperson
digitalsignalperson / linux-rt-lts and zfs-dkms.sh
Created November 17, 2023 23:14
example for how to install linux-rt-lts and zfs-dkms
if ! grep -qF "[archzfs]" /etc/pacman.conf; then
cat >> /etc/pacman.conf << 'EOF'
[archzfs]
Server = http://archzfs.com/$repo/x86_64
Server = http://mirror.sum7.eu/archlinux/archzfs/$repo/x86_64
Server = https://mirror.biocrafting.net/archlinux/archzfs/$repo/x86_64
EOF
fi
pacman-key -r F75D9D76
@digitalsignalperson
digitalsignalperson / zfs-force-inherit-example.sh
Created January 25, 2024 03:01
zfs force inherit encryptionroot on received dataset with pyzfs
#!/bin/bash
# Create test pool
dd if=/dev/zero of=/root/zpool bs=1M count=128
zpool create testpool /root/zpool
# Create encryptionroot and some datasets
echo "12345678" | zfs create -o canmount=off -o mountpoint=/mnt -o encryption=on -o keylocation=prompt -o keyformat=passphrase testpool/enc
zfs create testpool/enc/data1
zfs create testpool/enc/data2
@digitalsignalperson
digitalsignalperson / bwrap-firefox.sh
Created January 25, 2024 03:16
Bubblewrapped firefox with a fifo on the host to open links inside the container
#!/bin/bash
URL_FIFO=$HOME/Downloads/ff_fifo
mkfifo "$URL_FIFO"
ffscript=$(mktemp)
cat > "$ffscript" << EOF
#!/bin/bash
echo "Creating profile"