Skip to content

Instantly share code, notes, and snippets.

{
"__inputs": [],
"__requires": [
{
"type": "panel",
"id": "gauge",
"name": "Gauge",
"version": ""
},
{
@xxmail
xxmail / taskset.sh
Created November 16, 2021 10:10 — forked from ayufan/taskset.sh
KVM CPU pinning for Proxmox VE
#!/bin/bash
set -eo pipefail
VMID=200
cpu_tasks() {
expect <<EOF | sed -n 's/^.* CPU .*thread_id=\(.*\)$/\1/p' | tr -d '\r' || true
spawn qm monitor $VMID
expect ">"
@xxmail
xxmail / qemu-networking.md
Created November 29, 2021 07:56 — forked from extremecoders-re/qemu-networking.md
Setting up Qemu with a tap interface

Setting up Qemu with a tap interface

There are two parts to networking within QEMU:

  • The virtual network device that is provided to the guest (e.g. a PCI network card).
  • The network backend that interacts with the emulated NIC (e.g. puts packets onto the host's network).

Example: User mode network

#!/bin/bash
set -e -o errexit -o pipefail -o nounset
###################################
# This script can be used by itself, but it's recommended that you read
# a tutorial on Proxmox forum first: https://forum.proxmox.com/threads/hey-proxmox-community-lets-talk-about-resources-isolation.124256/
###################################
# Do not modify these variables (set by Proxmox when calling the script)
vmId="$1"
@xxmail
xxmail / isolate-cpus.sh
Created January 19, 2024 14:27 — forked from denji/isolate-cpus.sh
CPU isolation bash script for KVM QEMU VFIO gpu passthrough for virtual machine performance optimizations using libvirt-hooks and cgroups
#!/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
@xxmail
xxmail / vm1-start.sh
Created January 19, 2024 14:27 — forked from p7cq/vm1-start.sh
Dynamic CPU isolation in QEMU/KVM
#!/usr/bin/env bash
#
# CPU isolation in QEMU/KVM
#
# As the cset scripts no longer work (systemd switched to cgroups v2), this is my
# attempt at emulating its functionality. It may be incorrect and/or it may break
# stuff. Blind copy-pasting with some reasoning follows.
#
# Host:
@xxmail
xxmail / ovs-cheat.md
Created January 19, 2024 14:43 — forked from djoreilly/ovs-cheat.md
OVS cheat sheet

DB

ovs-vsctl list open_vswitch
ovs-vsctl list interface
ovs-vsctl list interface vxlan-ac000344
ovs-vsctl --columns=options list interface vxlan-ac000344
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl -f csv --no-heading --columns=_uuid list controller
ovs-vsctl -f csv --no-heading -d bare --columns=other_config list port
@xxmail
xxmail / gist:c026b68b59682ba69888d2f899868f09
Last active January 19, 2025 17:30
Добавить в ipset IP адреса из rejectlog
#!/bin/bash
# Путь к файлу лога
LOGFILE="rejectlog"
# Проверяем, существует ли файл
if [[ ! -f "$LOGFILE" ]]; then
echo "Ошибка: Файл $LOGFILE не найден!"
touch "$LOGFILE"
chown Debian-exim:adm "$LOGFILE"