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
@kvaps
kvaps / indent-to-nindent.sh
Created December 28, 2021 12:10
Oneliner to replace indents with nindents in Helm chart
grep -rnoP '(?<= indent )[0-9]+' > /tmp/11
cat /tmp/11 | awk -F: '{print $1 " " $2 " " $3}' | while read file line indent; do echo "file=$file line=$line indent=$indent"; sed -i -e "$line s/^ *{{-\?/$(printf '%0.s ' $(seq 1 $indent)){{-/" -e "$line s/ indent \([0-9]\+\)/ nindent \1/g " $file; done
@kvaps
kvaps / raw_mode_posix.go
Created August 22, 2021 22:09 — forked from EddieIvan01/raw_mode_posix.go
syscall to set raw-mode-input terminal in Go (Posix/Windows)
// +build darwin linux
package main
import (
"os"
"syscall"
"unsafe"
)
@kvaps
kvaps / envoy.yaml
Last active July 26, 2021 15:27
ACME-proxy for multiple backends on envoy
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 10000 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
@kvaps
kvaps / one_xmlrpc_client.sh
Created June 29, 2021 17:35
OpenNebula XML-RPC shell client debug script
#!/bin/bash
print_value() {
case "$1" in
string:*) echo ' <param><value><string>'${1##string:}'</string></value></param>' ;;
i4:*) echo ' <param><value><i4>'${1##i4:}'</i4></value></param>' ;;
int:*) echo ' <param><value><int>'${1##int:}'</int></value></param>' ;;
boolean:*) echo ' <param><value><boolean>'${1##boolean:}'</boolean></value></param>' ;;
array:*)
echo ' <param><value><array><data>'
@kvaps
kvaps / old-firefox-jre-docker.sh
Created May 3, 2021 12:51
Run old firefox with the java applet in the container to access old iLO and KVM consoles
mkdir -p /tmp/1
cd /tmp/1
cat > Dockerfile <<\EOT
FROM i386/ubuntu:12.04
RUN apt-get update \
&& apt-get install -y firefox=11.0+build1-0ubuntu4 icedtea-6-plugin libstdc++5
EOT
docker build -t firefox-jre .
@kvaps
kvaps / 3par
Last active November 12, 2020 21:36
3par-linstor-benchmark
# fio -ioengine=libaio -name=test -bs=4k -direct=1 -numjobs=1 -iodepth=1 -randrepeat=0 -rw=randwrite -filename=/dev/mapper/mpathc -runtime=60
test: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=1
fio-3.16
Starting 1 process
Jobs: 1 (f=1): [w(1)][0.6%][w=176KiB/s][w=44 IOPS][eta 02h:57m:30s]
test: (groupid=0, jobs=1): err= 0: pid=4129882: Thu Nov 12 16:02:14 2020
write: IOPS=2448, BW=9796KiB/s (10.0MB/s)(583MiB/60958msec); 0 zone resets
slat (usec): min=4, max=685, avg=36.64, stdev=19.01
clat (usec): min=198, max=1012.8k, avg=366.08, stdev=3744.08
lat (usec): min=208, max=1012.8k, avg=403.32, stdev=3744.27
@kvaps
kvaps / opennebula-filter.py
Created August 11, 2020 09:34
Example XML-RPC filtering script for OpenNebula
#!/usr/bin/env python3
from xmlrpc.server import SimpleXMLRPCServer
import xmlrpc.client
import xmltodict
import re
import os
import argparse
import logging
from socketserver import ThreadingMixIn
apiVersion: v1
kind: Secret
metadata:
name: restund
type: Opaque
data:
awsKeyId: TkFFVEhFQjhJRVNIOUZFQ0gyVE8=
awsSecretKey: YmFpNWVraWkzUGUyYWdlZTVvb25nZWlSb2lnaGllNHNodWg4ZmVlNA==