Skip to content

Instantly share code, notes, and snippets.

View kvaps's full-sized avatar
🔳
This mess is mine!

Andrei Kvapil kvaps

🔳
This mess is mine!
View GitHub Profile
#!/bin/bash
# onevm monitoring for zabbix script
case $1 in
a* ) echo $(onevm list -l STAT | tail -n +2 | wc -l) ;;
r* ) echo $(onevm list -l STAT | tail -n +2 | grep 'runn\|boot' | wc -l) ;;
su* ) echo $(onevm list -l STAT | tail -n +2 | grep 'susp\|save' | wc -l) ;;
st* ) echo $(onevm list -l STAT | tail -n +2 | grep -v 'runn\|susp\|save\|boot\|err\|fail' | wc -l) ;;
e* ) echo $(onevm list -l STAT | tail -n +2 | grep 'err\|fail' | wc -l) ;;
* ) echo Need argument!; exit 1 ;;
@kvaps
kvaps / linstor_autoplace_troubleshooting.md
Last active February 18, 2024 17:15
Troubleshoot auto-placing with LINSTOR
# linstor r c blbla --auto-place 4 --replicas-on-same opennebula-1=true -s thindata
ERROR:
Description:
    Not enough available nodes
Details:
    Not enough nodes fulfilling the following auto-place criteria:
     * has a deployed storage pool named 'thindata'
     * the storage pool 'thindata' has to have at least '104857600' free space
     * the current access context has enough privileges to use the node and the storage pool
@kvaps
kvaps / rspamd-lists.md
Last active January 27, 2024 23:29
Howto create local whitelists and blacklists for Rspamd

Local whitelists and blacklists for Rspamd

  • cd /etc/rspamd
  • create rspamd.conf.local
  • create lists:
touch local_bl_from.map.inc local_bl_ip.map.inc local_bl_rcpt.map.inc \
local_wl_from.map.inc local_wl_ip.map.inc local_wl_rcpt.map.inc
  • change permissions:
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: test
namespace: test
spec:
clusterNetwork:
pods:
cidrBlocks:
@kvaps
kvaps / test_disk.sh
Last active January 6, 2024 04:20
Test disk with fio and parse results
#!/bin/sh
run(){
name="$1"
shift
(
set -x
# defailt parameters
fio -name="$name" -filename=$disk -output-format=json -ioengine=libaio -direct=1 -randrepeat=0 "$@" > results/$disk_dashed-$name.json
)
@kvaps
kvaps / nfs-ganesha-vs-kernel-benchmark.md
Last active December 7, 2023 23:48
NFS-Ganesha vs NFS-Kernel-Server Benchmark

local read: IOPS=12308, BW=48.1MiB/s write: IOPS=4111, BW=16.0MiB/s

nfs3-ganesha read: IOPS=7039, BW=27.5MiB/s write: IOPS=2352, BW=9.2MiB/s

nfs3-kernel read: IOPS=6571, BW=25.7MiB/s

@kvaps
kvaps / _GoPro_shrink_video_with_ffmpeg.md
Last active December 5, 2023 18:55
Скрипты для сжатия видео с GoPro и ковертирования RAW в JPG

Как сжать GoPro видео с помощью ffmpeg (инструкуция для windows)

Расскажу как круто можно ужимать видео с гопрошки без потери качества.

Видео как правило жмется очень хорошо, мне удавалось сжимать ролики до 70% безо всяких на то проблем.

Для windows-пользователей приложу инструкцию, linux-пользователи и так разберутся, все скрипты приведены ниже.

Установка

@kvaps
kvaps / fix.sh
Last active November 15, 2023 14:14
LINSTOR fix wrong storage pool in version before 1.25 (error: Storage driver 'LVM_THIN' not allowed for volume.)
# make backup
kubectl get crds | grep -o ".*.internal.linstor.linbit.com" | xargs kubectl get crds -ojson > crds.json
kubectl get crds | grep -o ".*.internal.linstor.linbit.com" | xargs -i{} sh -xc "kubectl get {} -ojson > {}.json"
---
# collect resources in weird states:
cat resources.internal.linstor.linbit.com.json | jq '.items[] | select(.spec.resource_flags>1024) | "\(.spec.resource_name) \(.spec.node_name) \(.spec.resource_flags)"' -r > list.txt
# reset them to 0:
@kvaps
kvaps / grub.cfg
Created January 18, 2018 15:38
Grub config for EFI and PXE boot
set timeout=3
menuentry 'Linux diskless' --class os {
insmod efi_gop
insmod efi_uga
# set server from option 66 (tftp-server-name) if not exist, use next_server
if ! net_get_dhcp_option net_default_server ${net_default_interface} 66 string; then
echo ' using next_server option instead.'
@kvaps
kvaps / loop.sh
Created October 16, 2023 22:27
mydumper/myload
#!/bin/bash
set -e -o pipefail
user=root
password=hackme
host=127.0.0.1
port=3306
dbs=$(mysql -u$user -p$password -h$host -P$port -e 'SHOW DATABASES;' | tail -n+2)