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/

@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():
#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 / stream.sh
Last active March 31, 2024 12:38
xdp screen cast example, modified to pipe to ffmpeg
mkfifo /tmp/gfifo
./xdp-screen-cast-ffmpeg.py & # or run in another terminal
# Note the gstreamer pipeline
# 'pipewiresrc fd=%d path=%u ! videorate ! video/x-raw,framerate=60/1 ! videoconvert ! filesink location=/tmp/gfifo'
# I specified a 60/1 frameerate. You can do other pre-processing here, or offload it to ffmpeg.
# Encode the stream and pipe to netcat
# note: must specify correct resolution here
# we can now use h264_nvenc, mpegts, and anything else ffmpeg has
@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 / 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 / tabs.css
Created January 23, 2024 09:18
obsidian tabs in multiple rows
/* --------------compact tabs--------------------*/
.workspace .mod-root .workspace-tab-header {
width: unset;
max-width: var(--tab-width);
border: 1px solid var(--color-base-50);
}
/*.workspace-tab-header-inner {
width: unset;
}*/