Skip to content

Instantly share code, notes, and snippets.

View nickpegg's full-sized avatar

Nick Pegg nickpegg

View GitHub Profile
@nickpegg
nickpegg / shuttlecraft-feedinbox.sh
Last active January 12, 2023 22:39
Pull in Shuttlecraft's experimental feedinbox branch on Glitch
# if you've made any local changes, commit them first
git commit -a -m "changed some things"
git remote add benbrown https://github.com/benbrown/shuttlecraft
git fetch benbrown
git checkout benbrown/benbrown/feedinbox
# Save the branch so you can move to it later if you want
git checkout -b benbrown/feedinbox
@nickpegg
nickpegg / 90-libvirt-usb.rules
Last active June 9, 2024 17:13
KVM USB auto-passthrough using udev
# File location: /etc/udev/rules.d/90-libvirt-usb.rules
ACTION=="bind", \
SUBSYSTEM=="usb", \
ENV{ID_VENDOR_ID}=="6b62", \
ENV{ID_MODEL_ID}=="6869", \
RUN+="/usr/local/bin/kvm-udev attach <domain>"
ACTION=="remove", \
SUBSYSTEM=="usb", \
ENV{ID_VENDOR_ID}=="6b62", \
ENV{ID_MODEL_ID}=="6869", \
#!/bin/sh
[ "$VERBOSITY" = 1 ] && set -x
[ "$ADDRFAM" = meta ] && exit 0
add_master()
{
# Return if $BOND_MASTER is already a bonding interface.
[ -f "/sys/class/net/$BOND_MASTER/bonding/slaves" ] && return
#!/bin/bash
# requires that imagemagick and wkhtmltopdf are installed
mkdir -p progress
git checkout master
mkhtmltoimage --crop-w 1920 --crop-h 1080 https://nickpegg.com progress/0000.png
count=0
#!/bin/bash
set -x
set -e
# This sets up QoS using HTB, which is a simplified algorithm. How it works is
# that I set up three classes, each class gets a guaranteed rate ('rate') and
# a maximum-usable rate ('ceil'). The ceiling is set to my uplink rate, so
# any class can use the full pipe assuming no better class trumps it.
#
# The classes are:
#!/bin/sh
while true; do
echo "DERP"
sleep 60
done
interface br0
{
AdvSendAdvert on;
prefix $ROUTED_64
{
};
};
# The loopback network interface
auto lo
iface lo inet loopback
# outside
allow-hotplug eth0
iface eth0 inet dhcp
hwaddress ether AA:BB:CC:DD:EE:FF
dns-search home.nickpegg.com nickpegg.com
dns-nameservers 8.8.8.8 8.8.4.4
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type echo-request -j ACCEPT
-A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type destination-unreachable -j ACCEPT
-A INPUT -i br0 -p ipv6-icmp -m icmp6 --icmpv6-type neighbour-solicitation -j ACCEPT
-A INPUT -i br0 -p ipv6-icmp -m icmp6 --icmpv6-type neighbour-advertisement -j ACCEPT
irb(main):001:0> foo = 'hi there'
=> "hi there"
irb(main):002:0> thing = :"#{foo}"
=> :"hi there"
irb(main):003:0> thing
=> :"hi there"
irb(main):004:0> foo = 'hi_there'
=> "hi_there"
irb(main):005:0> thing = :"#{foo}"
=> :hi_there