Skip to content

Instantly share code, notes, and snippets.

View ArseniyShestakov's full-sized avatar

Arseniy Shestakov ArseniyShestakov

View GitHub Profile
@ArseniyShestakov
ArseniyShestakov / gpu-hotplug.md
Last active May 3, 2024 05:54
Current QEMU dual-VM configuration. Thanks to everyone who helped me!

Check it's working

DRI_PRIME=1 glxinfo | grep OpenGL

Unbind AMD GPU from Radeon driver

echo "1002 6719" > /sys/bus/pci/drivers/vfio-pci/new_id echo "0000:01:00.0" > /sys/bus/pci/devices/0000:01:00.0/driver/unbind echo "0000:01:00.0" > /sys/bus/pci/drivers/vfio-pci/bind echo "1002 6719" > /sys/bus/pci/drivers/vfio-pci/remove_id echo "1002 aa80" > /sys/bus/pci/drivers/vfio-pci/new_id echo "0000:01:00.1" > /sys/bus/pci/devices/0000:01:00.1/driver/unbind

@ArseniyShestakov
ArseniyShestakov / randomfiles.go
Created September 2, 2015 19:25
Simple tool to copy N files into different direcoty
package main
import (
"path"
"path/filepath"
"os"
"time"
"strconv"
"math/rand"
)
diff -rupN linux-3.15.old/Documentation/kernel-parameters.txt linux-3.15/Documentation/kernel-parameters.txt
--- linux-3.15.old/Documentation/kernel-parameters.txt 2014-06-08 15:19:54.000000000 -0300
+++ linux-3.15/Documentation/kernel-parameters.txt 2014-06-09 18:05:31.744055580 -0300
@@ -2554,6 +2554,16 @@ bytes respectively. Such letter suffixes
nomsi Do not use MSI for native PCIe PME signaling (this makes
all PCIe root ports use INTx for all services).
+ pcie_acs_override =
+ [PCIE] Override missing PCIe ACS support for:
+ downstream
@ArseniyShestakov
ArseniyShestakov / include_qemu_name_in_pulseaudio_client_name.patch
Created September 20, 2015 09:55
QEMU patch that make audio control easier when you run multiple VMs
diff --git a/audio/paaudio.c b/audio/paaudio.c
index fea6071..5a8a4b9 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -1,6 +1,7 @@
/* public domain */
#include "qemu-common.h"
#include "audio.h"
+#include "sysemu/sysemu.h"
@ArseniyShestakov
ArseniyShestakov / .bashrc
Last active November 8, 2015 22:11
Scripts for VCMI
# Git no pager
alias gitn="git --no-pager"
# Switch maps for VCMI
alias switchmaps="~/.local/share/vcmi/switchmaps.sh"
alias sm="switchmaps"
# VCMI debug
alias vcmitop="top -d 0,3 -H -p `pidof vcmiclient`"
@ArseniyShestakov
ArseniyShestakov / space_eng.bat
Created October 26, 2015 12:52
Space Engineers dedicated server update via SteamCMD
:: kill current server process
::taskkill /im SpaceEngineersDedicated.exe
cd steamcmd
steamcmd +login anonymous +app_update 298740 validate +quit
::cd steamcmd\steamapps\common\SpaceEngineersDedicatedServer\DedicatedServer
@ArseniyShestakov
ArseniyShestakov / cmds.sh
Last active August 3, 2017 19:30
Faster compiling for VCMI
### UPD: Automated benchmark is here:
https://gist.github.com/ArseniyShestakov/b96676d1db994983ca26
# My results are:
# GCC 4.8 compile whole VCMI project within 3:20-3:30
# Clang 3.7 compile it within 1:50-2.05
apt-get install clang-3.7
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-3.7 100
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.7 100
@ArseniyShestakov
ArseniyShestakov / buildbench.sh
Created October 30, 2015 04:59
VCMI build benchmark for different compilers, linkers and build systems
#!/bin/bash
# All compilation done in tmpfs
CFG_VCMI_GIT="https://github.com/vcmi/vcmi.git"
CFG_SRC_DIR="/dev/shm/vcmi_src"
CFG_BUILD_DIR="/dev/shm/vcmi_build"
CFG_BUILD_OPTIONS="-j 9"
# File size function
__check_files() {
echo "RESULT FILE SIZES:"
@ArseniyShestakov
ArseniyShestakov / 1_vcmi-linux-to-windows-mingw.sh
Last active November 23, 2016 16:09
VCMI cross compilation from Linux to Windows using MXE
## Building VCMI for Windows from Linux.
#
# Building of Qt5 make process a lot longer.
# Likely you only need game client so build without launcher.
#
# More comments available in forum topic:
# http://forum.vcmi.eu/viewtopic.php?p=14756#14756
# This one is now documented on Wiki:
# http://wiki.vcmi.eu/index.php?title=How_to_build_VCMI_(Linux/Cmake/MXE)
apt-get install expect python-xlib
QEMU command to start telenet server:
-monitor telnet:127.0.0.1:1234,server,nowait \