Skip to content

Instantly share code, notes, and snippets.

View Ethorbit's full-sized avatar

Ethorbit Ethorbit

View GitHub Profile
@Ethorbit
Ethorbit / gpupv-acceleration-tut.md
Last active April 22, 2024 20:53
Hyper-V tutorial to partition GPU for virtualization + achieve full GPU acceleration with it and daily drive it.
@Ethorbit
Ethorbit / xinput-mouse.sh
Last active February 14, 2024 06:20
Sets xinput acceleration for all mice devices of the same name, in this case 'Razer Razer DeathAdder V2'
for xinput_id in $(xinput list | grep 'Razer Razer DeathAdder V2' | grep -o 'id=[0-9]*' | cut -c 4-); do
xinput --set-prop "$xinput_id" "libinput Accel Speed" -0.7
done
@Ethorbit
Ethorbit / proxmox-evsieve-hooks.sh
Created December 30, 2023 11:56
proxmox-evsieve-hooks.sh Allows me to switch virtual machines at the press of a button without the need to login to the web ui
#!/bin/bash
source /root/.bashrc
KEY="$1"
if [ -z "$KEY" ]; then
key_combo="key:rightshift key:rightalt key:rightctrl"
evsieve --input /dev/input/by-id/uinput-persist-z12-keyboard0 \
--hook $key_combo key:f5 exec-shell="$0 f5" \
--hook $key_combo key:f9 exec-shell="$0 f9" \
@Ethorbit
Ethorbit / second-gpu.sh
Last active December 22, 2023 03:35
A Proxmox hookscript (/var/lib/vz/snippets/second-gpu.sh) that releases my NVIDIA GPU after the VM stops so that I can display the host terminal.
#!/bin/bash
SECOND_GPU="0000:01:00.0"
# First argument is the vmid
# Second argument is the phase
VMID="$1"
shift
PHASE="$1"
if [ "$PHASE" = "post-stop" ]; then
@Ethorbit
Ethorbit / vfio-unbind-gpu.sh
Created August 6, 2023 02:42
Unbinds my NVIDIA GPU from the VFIO drivers and binds them to the nvidia drivers so the GPU can be used normally on the host again.
#!/bin/bash
virsh nodedev-reattach pci_0000_26_00_0
virsh nodedev-reattach pci_0000_26_00_1
modprobe nvidia
modprobe nvidia_modeset
modprobe nvidia_uvm
modprobe nvidia_drm
systemctl start nfancurve.service
@Ethorbit
Ethorbit / vfio-bind-gpu.sh
Created August 6, 2023 02:41
Binds my NVIDIA gpu to VFIO drivers so the GPU can be used for virtualization
#!/bin/bash
systemctl stop nfancurve.service
virsh nodedev-detach pci_0000_26_00_0
virsh nodedev-detach pci_0000_26_00_1
@Ethorbit
Ethorbit / default-desktop.service
Created June 13, 2023 04:55
Systemd service to set the default Steam Deck desktop session
[Unit]
Description=Forces gamescope to be the desktop session on boot
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'grep gamescope /etc/sddm.conf.d/zz-steamos-autologin.conf || sudo -u deck /usr/sbin/steamos-session-select gamescope'
[Install]
WantedBy=multi-user.target
@Ethorbit
Ethorbit / switch-session-user.sh
Last active April 2, 2024 13:49
Switch Steam Deck desktop user with a single sudo command.
#!/bin/bash
user="$1"
if ! [[ `id "$user" 2> /dev/null` ]]; then
echo "Not a valid user" 1>&2 && exit 1
fi
if [[ `echo "$user" | grep "|"` ]]; then
echo "Username cannot have '|'" 1>&2 && exit 1
fi
@Ethorbit
Ethorbit / yt-dlp-wrapper.sh
Created December 18, 2022 07:10
Personal wrapper script for yt-dlp with options
#!/bin/bash
maxnum="99999999"
while getopts ":c:d:a:n:" opt; do
case "$opt" in
c) content=$OPTARG ;;
d) dest=$OPTARG ;;
a) audio=$OPTARG ;;
n) maxnum=$OPTARG ;;
@Ethorbit
Ethorbit / mount-wait.sh
Last active November 20, 2022 14:53
Haults execution until the specified mount is valid or the specified wait duration has been reached.
#!/bin/bash
MAX_WAIT="10"
[[ -z "$1" ]] && exit 1 || MOUNT="$1"
if [[ ! -z "$2" ]]; then
reg="^[0-9]+$" && [[ ! "$2" =~ $reg ]] && exit 1
MAX_WAIT="$2"
fi