Skip to content

Instantly share code, notes, and snippets.

@user5145
Last active December 31, 2022 17:39
Show Gist options
  • Save user5145/934048b235ea42091d638d31d6c26871 to your computer and use it in GitHub Desktop.
Save user5145/934048b235ea42091d638d31d6c26871 to your computer and use it in GitHub Desktop.
linux notes
# pulseaudio latency
watch -n 1 "pactl list sink-inputs | grep Latency"
# how to use ar
mkdir openjdk
for deb in jdk8-debs/*.deb ; do ar p ${deb} data.tar.xz | unxz | tar x -C openjdk; done
# ghost script convert to pdf
gs -o repaired.pdf -dEmbedAllFonts=true -dCompatibilityLevel=1.6 -sDEVICE=pdfwrite \
-dDEVICEWIDTHPOINTS=1072 -dDEVICEHEIGHTPOINTS=1448 -dPDFSETTINGS=/prepress Unknown.pdf
# nexus 5x how to fix bootloop caused by unlocking bootloader when userspace is encrypted with pin
1. boot twrp & allow write
2. make_ext4fs /dev/block/by-name/$PATH_TO_YOUR_USERDATA
3. reboot to bootloop
4. enter twrp & allow write
5. should work now if some leftovers are left at the end of partition try to override it
# dracut
add_drivers+="pci_stub vfio vfio_iommu_type1 vfio_pci vfio_virqfd kvm kvm_intel"
# compilers flags check
gcc -march=znver1 -mtune=znver1 -Q --help=target
clang -E -march=znver1 - -march=native -###
links
(https://android.stackexchange.com/questions/98228/removing-encryption-from-recovery)
https://forums.opensuse.org/showthread.php/522015-VGA-PCI-Passthrough-guide-on-openSuSE-Leap-42-2
https://www.linux-kvm.org/page/Virtio/Block/Latency#Performance_data
https://libvirt.org/formatdomain.html#elementsFeatures
https://bugzilla.redhat.com/show_bug.cgi?id=1053847
https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/Virtualization_Deployment_and_Administration_Guide/sect-Virtualization-Tips_and_tricks-Libvirt_Managed_Timers.html
# notes that are the most important to me
#
# fix alsa 40% output limit
alsamixer
sudo alsactl store
# or put into user's file (e.g. ~/.profile)
alsamixer
alsactl --file ~/.config/asound.state store
# and put into a file (e.g. ~/.profile)
alsactl --file ~/.config/asound.state restore
# audio tweaks
resample-method
module-echo-cancel
# laptop powersaving
enable tlp-sleep and tlp
# additional kernel args
intel_iommu=on nvidia-drm.modeset=1 snd-hda-intel.enable_msi=1 snd-hda-intel.power_save=0
# alsa fix for weird sound cards
https://www.kernel.org/doc/html/latest/sound/hd-audio/models.html
# not so bad themes
Apps: adapta-eta
Cursor: breeze_cursors
Icons: papirus
Sheel: adapta-eta
# Btrfs Countdown
https://btrfs.wiki.kernel.org/index.php/Status
intel_iommu=on
nvidia-drm.modeset=1
snd-hda-intel.power_save=0
snd-hda-intel.enable_msi=1
rd.driver.pre=vfio-pci
vfio-pci.ids=10ec:8168
resume=/dev/sda5
resume_offset=34816
# modprobe
options kvm_intel nested=1
options kvm-intel enable-shadow_vmcs=1
options kvm-intel enable_apicv=1
options kvm_intel ept=1
#options kvm_amd nested=1
MODULES=(vfio vfio_iommu_type1 vfio_pci vfio_virqfd i915 intel_agp r8169)
HOOKS=(base systemd block keyboard autodetect modconf sd-vconsole sd-encrypt sd-lvm2 filesystems fsck)
# HOOKS=(base systemd sd-plymouth autodetect modconf keyboard sd-vconsole block sd-encrypt sd-lvm2 filesystems fsck)
#!/usr/bin/pulseaudio -nF
# load system configuration
.include /etc/pulse/default.pa
#
# send over network
# load-module module-simple-protocol-tcp source=alsa_output.pci-0000_00_1f.3.analog-stereo.echo-cancel.monitor record=true port=12340
#
# echo cancellation
set-default-source alsa_input.pci-0000_00_1f.3.analog-stereo
load-module module-echo-cancel use_master_format=1 aec_method=webrtc aec_args="analog_gain_control=0 digital_gain_control=0 voice_detection=1 extended_filter=1 drift_compensation=0" source_master=alsa_input.pci-0000_00_1f.3.analog-stereo
set-default-source alsa_input.pci-0000_00_1f.3.analog-stereo.echo-cancel
#
# additional arguments for drift compensation
# sink_master=alsa_output.pci-0000_00_1f.3.analog-stereo
#
# commands to select the default device
# set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
# pacmd list-sources | grep -Po '(?<=name: \<).*(?=\>)'
# pacmd list-sinks | grep -Po '(?<=name: \<).*(?=\>)'
high-priority = yes
nice-level = -16
realtime-scheduling = yes
realtime-priority = 50
resample-method = speex-float-10
avoid-resampling = yes
flat-volumes = no
default-sample-format = s24le
default-sample-rate = 48000
alternate-sample-rate = 44100
deferred-volume-safety-margin-usec = 4000
## nvidia
# http://us.download.nvidia.com/XFree86/Linux-x86/396.24/README/openglenvvariables.html
export __GL_NextGenCompiler=0
export __GL_THREADED_OPTIMIZATIONS=0
export __GL_GSYNC_ALLOWED=0
export __GL_SYNC_TO_VBLANK=0
export __GL_SHADER_DISK_CACHE=0
export __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 #128mb+
export __GL_SHADER_DISK_CACHE_PATH=/tmp/nv_shader_cache
export __GL_LOG_MAX_ANISO=4
#
#
## intel/amd
#
export LIBGL_DRI3_DISABLE=1
export MESA_LOADER_DRIVER_OVERRIDE=iris
export MESA_GLTHREAD=true
#
#
## wine logs
export WINEDEBUG="-all,-fixme-all,-relay,-fps,+loaddll,+seh,+msgbox"
export WINEDEBUG="+fps,+loaddll,+seh,+msgbox"
export WINEDEBUG="-all,+fps"
#
#
## may fix audio. Not recommended for wine
export PULSE_LATENCY_MSEC=100
#
# HUD
export GALLIUM_HUD=fps
export DXVK_HUD=1
export VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay
export VK_LAYER_MESA_OVERLAY_POSITION=bottom-left
export __GL_SHOW_GRAPHICS_OSD=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment