Skip to content

Instantly share code, notes, and snippets.

Avatar

Denis Zhdanov deniszh

View GitHub Profile
@deniszh
deniszh / salt-2016.11-security.patch
Last active May 6, 2020
Fixes for CVE-2020-11651 and CVE-2020-11652 for Salt 2016.11 branch
View salt-2016.11-security.patch
# use https://github.com/deniszh/salt-security-backports instead
@deniszh
deniszh / salt-2015.5-security.patch
Last active May 6, 2020
Fixes for CVE-2020-11651 and CVE-2020-11652 for Salt 2015.5 branch
View salt-2015.5-security.patch
# use https://github.com/deniszh/salt-security-backports instead
@deniszh
deniszh / salt-2019.2-security.patch
Last active May 6, 2020
Fixes for CVE-2020-11651 and CVE-2020-11652 for Salt 2019.2 branch
View salt-2019.2-security.patch
# use https://github.com/deniszh/salt-security-backports instead
@deniszh
deniszh / CVE-2020-11651-11652.sls
Created Apr 30, 2020
How to patch Salt by salt
View CVE-2020-11651-11652.sls
{% if grains.saltversion == "2016.11.6" %}
# Just in case there is no patch command installed
patch:
pkg.installed
# We use directory name here (saltpath) to apply patches that touch multiple files
saltmaster_security_patch:
file.patch:
- name: '{{ grains.saltpath }}'
View oom_killer_stat.mtail
counter processes_oom_killed_total
counter processes_oom_killed_by_name by label
/Killed process (\d+) \((\S+)\) total-vm:\d+kB, anon-rss:\d+kB, file-rss:\d+kB$/ {
processes_oom_killed_total++
processes_oom_killed_by_name[$2]++
}
@deniszh
deniszh / set_nofile_limit.c
Created Nov 13, 2018 — forked from carlhoerberg/set_nofile_limit.c
Set nofile limit for a running process
View set_nofile_limit.c
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \
} while (0)
@deniszh
deniszh / whisper-cyanite.py
Last active Jun 5, 2018
Quick and dirty script to migrate Graphite from whisper to cyanite
View whisper-cyanite.py
#!/usr/bin/env python
import os
import mmap
import struct
import signal
import optparse
import cql
try:
@deniszh
deniszh / graphouse_api.py
Last active Sep 21, 2017
Graphouse finder for graphite-api
View graphouse_api.py
import json
import time
import traceback
import urllib.parse
import requests
from structlog import get_logger
from graphite_api.intervals import IntervalSet, Interval
from graphite_api.node import LeafNode, BranchNode
@deniszh
deniszh / graphite_0.9.15_epel_fnv1a.patch
Created Oct 19, 2016
Patch for FNV1A_CH support in graphite-web 0.9.15
View graphite_0.9.15_epel_fnv1a.patch
diff -u -r graphite_old/render/datalib.py graphite/render/datalib.py
--- graphite_old/render/datalib.py 2016-10-19 18:22:37.000000000 +0200
+++ graphite/render/datalib.py 2016-10-19 18:12:00.000000000 +0200
@@ -106,7 +106,7 @@
self.hosts = [ (server, instance) for (server, port, instance) in hosts ]
self.ports = dict( ((server, instance), port) for (server, port, instance) in hosts )
self.timeout = float(timeout)
- self.hash_ring = ConsistentHashRing(self.hosts)
+ self.hash_ring = ConsistentHashRing(self.hosts, hash_type=settings.CARBONLINK_HASHING_TYPE)
self.connections = {}
View wsgi2.py
import os
import sys
sys.path.append('/opt/graphite/webapp')
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphite.settings') # noqa