Skip to content

Instantly share code, notes, and snippets.

@aejh
aejh / PW-WP-buzz-fix.sh
Created January 12, 2022 10:32
Pipewire + wireplumber buzzing when idle
# As root, for global fix
mkdir -p /etc/wireplumber/main.lua.d/
cp -a /usr/share/wireplumber/main.lua.d/50-alsa-config.lua /etc/wireplumber/main.lua.d/
# Add the following to the "apply_properties" section
["session.suspend-timeout-seconds"] = 0
# As user
systemctl --user restart wireplumber
@aejh
aejh / 40-usb-android.network
Created November 1, 2021 15:13
Android USB network tethering with systemd-networkd
[Match]
# Use udevadm info /sys/class/net/INTERFACE_NAME to list the udev properties and pick one or more
Property=ID_MODEL=SAMSUNG_Android "ID_USB_DRIVER=rndis_host"
[Network]
DHCP=ipv4
[DHCPv4]
# Default metric is 1024, setting a value lower makes this the default route
RouteMetric=512
@aejh
aejh / gist:9844903d056c4bce821e615016f2c027
Created July 12, 2021 09:42
Rebuild manually downloaded debs
# Assuming PKG_VER{.orig.tar.gz,.debian.tar.xz,.dsc} are in pwd
# Extract to ./PKG-VER
dpkg-source -x *.dsc
# build, likely:
cd PKG-VER
debuild -uc -us -b
@aejh
aejh / PA-buzz-fix.sh
Created July 2, 2021 08:13
Pulseaudio buzzing when idle
# Caused by the suspend on idle module, disable it
sudo sed -i -e 's/load-module module-suspend-on-idle/#\0/' /etc/pulse/default.pa /etc/pulse/system.pa
# Restart PA (assumes auto restart)
pulseaudio -k
@aejh
aejh / args.sh
Last active June 11, 2021 07:56
Shell script argument handling, quick n dirty
# For reference:
# $# The number of arguments
# $0 The program name
# $@ All arguments
# $1 .. $N Argument 1 .. N
while [ $# -gt 0 ]; do
# $1 contains next argument, process $1 here
echo $1
shift # Pops $1 off the argument stack
@aejh
aejh / mt-static-to_hosts.sh
Created February 2, 2021 15:29
Mikrotik static DNS records to hostsfile
ssh 10.0.0.1 /ip dns static print terse without-paging | sed -n 's/.*name=\(.*\) address=\([0-9.]*\) .*/\2 \1/p'
@aejh
aejh / _boot_cmdline.txt
Last active July 2, 2021 08:08
Rpi zero USB networking, with Linux host
# After rootwait:
modules-load=dwc2,g_ether
@aejh
aejh / Common Mikrotik commands
Last active January 4, 2021 09:59
Common Mikrotik settings easier to add by cli
# Used in a typical home environment, WAN IP to internet, with NAT to LAN
# Add a port foward
/ip firewall nat add chain=dstnat dst-address=<WAN-IP> dst-port=<PORT> protocol=[tcp|udp] action=dst-nat to-addresses=<LAN-IP>
# Add a static DHCP lease
/ip dhcp-server lease add address=<LEASED-ADDRESS> mac-address=<MAC-ADDR> server="<DHCP-SERVER-NAME>" disabled=no
# Add hostname to DNS server
/ip dns static add name=<HOSTNAME> address=<IP-ADDRESS>
# Set UK timezone
Backlog TimeZone 99; TimeDST 0,0,3,1,1,60; TimeSTD 0,0,10,1,2,0
@aejh
aejh / podman-aliases.sh
Created October 20, 2020 07:49
Podman aliases
# Default podman ps output is very wide, shows the infra containers and isn't column
alias podps='podman ps --format "{{.Names}} {{.Image}} {{.Status}}" | fgrep -v k8s.gcr.io/pause | co