Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ilyaevseev's full-sized avatar

Ilya Evseev ilyaevseev

  • Loyaltyplant.com
  • Nazareth, Israel
  • 14:53 (UTC +03:00)
  • LinkedIn in/ilyaevseev
View GitHub Profile
@ilyaevseev
ilyaevseev / esdedupe.patch
Created March 17, 2021 00:37
Fix esdedupe runtime errors
diff --git a/esdedupe/esdedupe.py b/esdedupe/esdedupe.py
index 749615e..3e56e90 100755
--- a/esdedupe/esdedupe.py
+++ b/esdedupe/esdedupe.py
@@ -23,6 +23,7 @@ class Esdedupe:
def __init__(self):
self.log = getLogger('esdedupe')
+ self.total = 0
@ilyaevseev
ilyaevseev / zkDeleteOldLocks.py
Last active November 22, 2020 09:27
Delete old locks from Zookeeper
#!/usr/bin/python
import os
MAX_DEL = int(os.getenv('MAX_DEL','10'))
MAX_AGE = int(os.getenv('MAX_AGE', '7'))
DRY_RUN = int(os.getenv('DRY_RUN', '0'))
QUIET = int(os.getenv('QUIET', '0'))
import time
@ilyaevseev
ilyaevseev / killtree-multipass.sh
Last active October 12, 2020 23:25
Kill process tree - shell function and script.
#!/bin/sh
KILLSIG=""
walktree() { local p=""; for p in "$@"; do walktree $(pgrep -P "$p"); echo $p; done; }
test "${1#-}" != "$1" && KILLSIG="$1" && shift
test $# = "0" && echo "Usage: ${0##*/} pid ..." && exit
PIDS="$(walktree "$@")"
@ilyaevseev
ilyaevseev / sysctl-compare.pl
Created April 27, 2020 23:52
Compare two sysctl outputs.
#!/usr/bin/perl
use strict;
use warnings;
die "Usage: $0 sysctl1.lst sysctl2.lst\n" if @ARGV != 2;
sub file2list($) {
my $fname = shift;
open F, $fname or die "Cannot open $fname: $!\n";
@ilyaevseev
ilyaevseev / server.py
Last active December 17, 2019 12:52 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@ilyaevseev
ilyaevseev / ffmpeg-cuda-install.sh
Created August 13, 2019 16:07
Try to automate CUDA dependencies installation for https://cdnnow.ru/blog/ffmpeg-cuda/
#!/bin/sh
yum -y install epel-release
yum -y install curl
rpm -q docker-release >/dev/null 2>&1 ||
yum install -y http://repo.docker.ru/pub/linux/centos/7/noarch/docker-release-1-1.el7.noarch.rpm
yum -y install ffmpeg-cuda
@ilyaevseev
ilyaevseev / QemuServer.pm.diff
Created July 30, 2019 03:26
ProxmoxVE patch for Ceph RBD tuning.Taken from https://pve.proxmox.com/pipermail/pve-devel/2018-June/032787.html with debugging output
diff -u /usr/share/perl5/PVE/QemuServer.pm*
--- /usr/share/perl5/PVE/QemuServer.pm0 2019-05-25 12:40:24.000000000 +0300
+++ /usr/share/perl5/PVE/QemuServer.pm 2019-06-24 07:06:34.825186937 +0300
@@ -1881,6 +1881,18 @@
$device .= ",serial=$serial";
}
+ my $volid = $drive->{file};
+ if ($volid && $drive->{discard}) {
+ my $storage_name = PVE::Storage::parse_volume_id($volid);
SELECT nspname || '.' || relname AS "relation",
pg_total_relation_size(C.oid) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
LEFT OUTER JOIN pg_inherits I ON (C.relfilenode = I.inhrelid OR C.relfilenode = I.inhparent)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
AND I.inhrelid is null
UNION ALL
@ilyaevseev
ilyaevseev / es-delete-old-indexes.sh
Created June 4, 2019 16:23
Delete old time-based indexes from ElasticSearch
#!/bin/sh
MAX_DAYS="30"
ES_ADDR="127.0.0.1"
D0="$(date -d "$MAX_DAYS days ago" +%s)"
curl -sS "http://$ES_ADDR:9200/_cat/indices" |
awk 'match($3, /-([0-9][0-9][0-9][0-9])[\.\-]([0-9][0-9])[\.\-]([0-9][0-9])$/, m) { printf "%s-%s-%s %s\n", m[1],m[2],m[3],$3 }' |
while read D1 idx; do
@ilyaevseev
ilyaevseev / psiprobe-htmltoplain.pl
Created May 6, 2019 15:48
Read apps list from PSI-Probe HTML output and print as plain text
#!/usr/bin/perl
use strict;
use warnings;
use XML::LibXML;
die "Usage: $0 file.html\n" if @ARGV != 1;
my $dom = XML::LibXML->load_html(