Skip to content

Instantly share code, notes, and snippets.

@sulincix
Last active November 1, 2023 16:26
Show Gist options
  • Save sulincix/3aad75830c9e8cf752f1f9b3c0562ae0 to your computer and use it in GitHub Desktop.
Save sulincix/3aad75830c9e8cf752f1f9b3c0562ae0 to your computer and use it in GitHub Desktop.

Usb autosuspend disable:

echo -1 > /sys/module/usbcore/parameters/autosuspend

Fix USB cable is bad or device descriptor issue

echo Y | tee /sys/module/usbcore/parameters/old_scheme_first

Wifi power save mode disable

echo on > /sys/class/net/[device name]/device/power/control

Disable Turbo boost

echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo

echo 0 > /sys/devices/system/cpu/cpufreq/boost

Set performance governor

echo performance > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Make zram and enable

#!/bin/bash
modprobe zram num_devices=4
totalmem=`free | grep -e "^Mem:" | awk '{print $2}'`
mem=$(( ($totalmem)* 1024 * 3)) # total ram * 3 (zram size calculation)
echo $mem > /sys/block/zram0/disksize
mkswap /dev/zram0
swapon -p 5 /dev/zram0

List acpi tables

$ strings /sys/firmware/acpi/tables/DSDT | grep Linux
Linux
$ strings /sys/firmware/acpi/tables/DSDT | grep Windows
Windows 2001
Windows 2001 SP1
Windows 2001 SP2
Windows 2001.1
Windows 2006
Windows 2009

Use other acpi tables

Kernel boot parameter:
acpi_osi="xxx"  # use xxx
acpi_osi="!xxx" # dont use xxx

Disable a pci device

echo 1 > /sys/bus/pci/devices/[card device id]/remove

Acpi wakeup setting (usb)

#list usb devices by name
grep . /sys/bus/usb/devices/*/product
# get current wakeup status
grep . /sys/bus/usb/devices/*/power/wakeup
# change status
echo "enable" | tee /sys/bus/usb/devices/[device name]/power/wakeup

Scale screen (X11)

#detect screen names
xrandr | grep -v disconnected | grep connected | cut -d' ' -f1
#scale output
xrandr --output "[screen name]" --scale 0.5x0.5 # default is 1.0x1.0

amdgpu glitch fix

# cmdline argument
amdgpu.sg_display=0

Enable hardware wakeups

# View current state
cat /proc/acpi/wakeup
# For all
find /sys/devices/ -type f -name "wakeup" | while read f ; do echo enabled > $f; done
# Single device 
echo enabled > /sys/devices/[device name]/power/wakeup

Reset USB module

# EHCI for usb2.0 / XHCI for usb 3.0
modprobe -rvf ehci_pci
modprobe -rvf xhci_pci
modprobe -fv ehci_pci
modprobe -fv xhci_pci

Disable cpu core

echo 0 > /sys/devices/system/cpu/cpu0/online

Disable network manager powersave

1. Create file
       /etc/NetworkManager/conf.d/default-powersave-off.conf 
2. Write this and save
       [connection]
       wifi.powersave = 2

Force reboot

sync && echo b > /proc/sysrq-trigger

Force poweroff

sync && echo o > /proc/sysrq-trigger

Clear PageCache, dentries and inodes

echo 3 > /proc/sys/vm/drop_caches

Clear efivars

rm -rf /sys/fs​/efi/efivars/dump-*

View efibootmgr valiables

efibootmgr -v

Remove an efi variable

efibootmgr -B -b [bootnum]

Get Winzort oem key if available

tail -c 32 /sys/firmware/acpi/tables/MSDM

Fix qemu guest ping issue. (Run in host)

sysctl -w net.ipv4.ping_group_range='0 2147483647'

Fix memory access issues

sysctl -w vm.mmap_min_addr=0

Use proton dx3d (steam)

PROTON_USE_WINED3D=1 %command%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment