Skip to content

Instantly share code, notes, and snippets.

@tomty89
tomty89 / qobuz
Last active January 19, 2024 17:12
#!/bin/bash
# https://play.qobuz.com/resources/5.6.2-b016/bundle.js
# from bundle.js
app_id="" # base_url="https://play.qobuz.com"
# from bundle.js
initialSeed="" # window.utimezone.berlin
info="" # Europe/Berlin
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int main() {
size_t sz;
void * buf;
sz = sysconf(_SC_PAGESIZE);
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int main() {
int ret;
bindsym XF86AudioPrev exec --no-startup-id "amixer -c STX set \\"Analog Output\\" Speakers; amixer -c STX set Master 255 on"
bindsym XF86AudioNext exec --no-startup-id "amixer -c STX set Master 169 on; amixer -c STX set \\"Headphones Impedance\\" \\"300-600 ohms\\"; amixer -c STX set \\"Analog Output\\" Headphones"
bindsym XF86AudioPlay exec --no-startup-id pacmd load-module module-jack-sink
bindsym XF86AudioStop exec --no-startup-id "pkill jackd; amixer -c STX set Master off; amixer -c STX set \\"Analog Output\\" Speakers"
bindsym XF86AudioMute exec --no-startup-id "pkill jackd; amixer -c STX set Master off; amixer -c STX set \\"Analog Output\\" Speakers"
bindsym XF86AudioRaiseVolume exec --no-startup-id flock /run/user/1000/.amixer_lock amixer -c STX set Master 1+
bindsym XF86AudioLowerVolume exec --no-startup-id flock /run/user/1000/.amixer_lock amixer -c STX set Master 1-
#!/bin/bash
set -e
gpt=$(losetup -f --show /home/$SUDO_USER/$1/gpt.img)
sed "s/\/dev\/loop0/${gpt//\//\\\/}/" /home/$SUDO_USER/$1/table | dmsetup create $1
setfacl -m u:tom:rw /dev/mapper/$1
hv-vpindex,hv-synic,hv-time,hv-stimer,hv-vapic
@tomty89
tomty89 / bridge1.conf
Last active February 1, 2022 11:23
nftables rules for a bridge that enslaves a passthru macvlan created on top of a wlan interface
port=0
dhcp-relay=192.168.1.150,192.168.1.1,bridge1
@tomty89
tomty89 / sdsway
Last active January 4, 2022 04:53
#!/bin/sh
if [ -z "$XDG_VTNR" ] || [ -z "$XDG_SESSION_ID" ]; then
exit 1
fi
exec systemd-run --user -u sway-"$XDG_VTNR" -E XDG_SESSION_ID="$XDG_SESSION_ID" -G -t bash -lc sway
@tomty89
tomty89 / Meh.java
Last active November 20, 2021 06:20
Example to clarify re-assignment of references
class Huh {
public int huh;
public Huh() {
huh = 123;
}
}
public class Meh {
// Re-implement "toString()" for String
@tomty89
tomty89 / Huh.java
Created November 27, 2021 02:04
An attempt to differentiate object instance and reference
class Meh {
@Override
protected void finalize() {
try {
super.finalize();
} catch (Throwable e) {
;
}
System.out.println("\"" + this + "\" " + "destroyed");
}