Skip to content

Instantly share code, notes, and snippets.

@dafta
dafta / usb-ether.sh
Last active September 13, 2024 22:23
Steam Deck USB Ethernet
#!/bin/sh
if [ "$UID" -ne 0 ]; then
echo "This script needs to be executed as root"
exit 1
fi
vendor_id="0x3000" # Valve
product_id="0x28DE"
serial_number="$(dmidecode -s system-serial-number)" # The Steam Deck's serial number
@dafta
dafta / .sh
Last active October 11, 2020 14:47
ssh with .ssh/sshrc forwarding
# Forwarding your .ssh/sshrc file and sourcing it as .bashrc
# A function sudoi is defined on the remote machine, used
# instead of sudo -i, to run a shell as the specified user,
# or root as default, and source the local .ssh/sshrc.
function ssh() {
tmprc=$(/usr/bin/ssh "$@" "mktemp" 2>/dev/null)
rsync ~/.ssh/sshrc "$1:$tmprc" >/dev/null 2>&1
echo "function sudoi() { sudo -u \"\${1:-root}\" bash --rcfile \"$tmprc\"; }" | /usr/bin/ssh "$@" "cat - >> \"$tmprc\"" >/dev/null 2>&1
/usr/bin/ssh -t "$@" "chmod a+r \"$tmprc\"; bash --rcfile \"$tmprc\" ; rm \"$tmprc\""