Skip to content

Instantly share code, notes, and snippets.

@denji
denji / zram-zwap.md
Last active Jul 24, 2022
Linux zSwap LZ4 (z3fold) sudo update-initramfs -k all -u / zram #lz4 #zstd #lz4hc #zbud #zsmalloc #z3fold #iot #router #embedded
View zram-zwap.md

/etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="... zswap.enabled=1 zswap.compressor=lz4 zswap.max_pool_percent=20 zswap.zpool=z3fold"

/etc/initramfs-tools/modules (Linux zSwap lz4+z3fold)

# List of modules that you want to include in your initramfs.
# They will be loaded at boot time in the order below.
#
@denji
denji / grub-transparent_hugepage.md
Last active Jul 24, 2022
transparent_hugepage grub&tmpfiles.d
View grub-transparent_hugepage.md

/etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="... transparent_hugepage=madvise"

sudo update-grub

/etc/tmpfiles.d/transparent_hugepage.conf

@denji
denji / linux-usb-file-copy-fix.md
Created Jul 20, 2022 — forked from 2E0PGS/linux-usb-file-copy-fix.md
Fix Ubuntu and other Linux slow/hanging file copying via USB.
View linux-usb-file-copy-fix.md

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local

@denji
denji / 60-vboxdrv.rules.save
Last active Jul 20, 2022
#udev #linux /etc/udev/rules.d/60-vboxdrv.rules.save ("udevadm control --reload-rules && udevadm trigger")
View 60-vboxdrv.rules.save
SUBSYSTEM=="usb_device", ACTION=="add", RUN+="/usr/share/virtualbox/VBoxCreateUSBNode.sh $major $minor vboxusers"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="/usr/share/virtualbox/VBoxCreateUSBNode.sh $major $minor vboxusers"
@denji
denji / hd_power_save.rules
Last active Jul 20, 2022
#udev #linux /etc/udev/rules.d/hd_power_save.rules ("udevadm control --reload-rules && udevadm trigger")
View hd_power_save.rules
# /etc/udev/rules.d/hd_power_save.rules
ACTION=="add", SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="med_power_with_dipm"
@denji
denji / isolate-cpus.sh
Created Jul 19, 2022 — forked from oleduc/isolate-cpus.sh
CPU isolation bash script for KVM QEMU VFIO gpu passthrough for virtual machine performance optimizations using libvirt-hooks and cgroups
View isolate-cpus.sh
#!/bin/bash
# Cores reserved for the host machine
# Must include QEMU IO/Emulation cores if configured
# Ex: 1st Core -> reserved=0
# Ex: 1st & 2nt Cores -> reserved=0,1
# Ex: 1st Physical Core (16 Virtual Cores) -> reserved=0,8
reserved=0,8
# Host core range numbered from 0 to core count - 1
@denji
denji / Windows-qemu-KVM.10.xml
Created Jul 19, 2022 — forked from rootfs/Windows-qemu-KVM.10.xml
Windows 10 qemu/kvm optimizations CPU usage #virt-manager
View Windows-qemu-KVM.10.xml
<domain type="kvm">
<!-- https://www.reddit.com/r/VFIO/comments/80p1q7/high_kvmqemu_cpu_utilization_when_windows_10/ -->
<!-- https://github.com/duncanthrax/scream -->
<!-- https://gitlab.com/YuriAlek/vfio -->
<!-- https://github.com/PiMaker/Win10-VFIO -->
<!-- https://gitlab.com/YuriAlek/vfio -->
<!-- https://github.com/sk1080/nvidia-kvm-patcher -->
<!-- https://github.com/T-vK/MobilePassThrough -->
@denji
denji / Arch Secure Laptop Install.md
Created May 2, 2021 — forked from Th3Whit3Wolf/Arch Secure Laptop Install.md
My install instruction for a secure Arch Linux (sway) laptop workstation
View Arch Secure Laptop Install.md

What's Cool

  • Encrypted root partition
    • AES-256 bit cipher
    • Argon2id variant for PBKDF
    • Sha3-512 bit hash
  • rEFInd bootloader
    • With dreary theme
    • Optimal Settings (optimized for aesthetics, and boot time)
  • Boot into backups thanks to refind-btrfs
@denji
denji / windows-keyboard-default-mode.md
Created Sep 29, 2020
Keyboard flags and indicators when start Windows 10
View windows-keyboard-default-mode.md

HKEY_USERS\.DEFAULT\Control Panel\Keyboard and edit the string value InitialKeyboardIndicators to one of the following values:

InitialKeyboardIndicators bitmask list:

  • 0 — turns off Scroll Lock, Num Lock, Caps Lock (default)
  • 1 — turn on Caps Lock
  • 2 — turn on Num Lock
  • 3 — turn on both Num Lock and Caps Lock
  • 4 — turn on Scroll Lock
  • 5 — turn on both Scroll Lock and Caps Lock
  • 6 — turn on both Scroll Lock and Num Lock
@denji
denji / postgresql90.md
Created Aug 27, 2020 — forked from kidpixo/postgresql90.md
PostgreSQL 9.0 cheatsheet from www.postgresonline.com
View postgresql90.md