Skip to content

Instantly share code, notes, and snippets.

View deniszh's full-sized avatar

Denis Zhdanov deniszh

View GitHub Profile
@deniszh
deniszh / set_nofile_limit.c
Created November 13, 2018 13:52 — forked from carlhoerberg/set_nofile_limit.c
Set nofile limit for a running process
#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 / graphouse_api.py
Last active September 21, 2017 08:44
Graphouse finder for graphite-api
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
import timeit
import re
EXPAND_BRACES_RE = re.compile(r'.*(\{.+?[^\\]\})')
def expand_braces_new(s):
res = list()
m = EXPAND_BRACES_RE.search(s)
if m is not None:
@deniszh
deniszh / graphite_0.9.15_epel_fnv1a.patch
Created October 19, 2016 16:36
Patch for FNV1A_CH support in graphite-web 0.9.15
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 = {}
import os
import sys
try:
# Django versions >= 1.9
from django.utils.module_loading import import_module
except ImportError:
# Django versions < 1.9
from django.utils.importlib import import_module
+--------------------------------+
| |
+----+ | 10.0.0.2:2004 |
| +------> |
| | | |
| | +--------------------------------+
| r1 |
+--------+ | | +--------------------------------+
| | | rf=1 | |
| | | +------> 10.0.0.3:2004 |
#!/usr/bin/env python
# coding=utf-8
#
# collectd-iostat-python
# ======================
#
# Collectd-iostat-python is an iostat plugin for collectd that allows you to
# graph Linux iostat metrics in Graphite or other output formats that are
# supported by collectd.
#
# Copyright 2008 Orbitz WorldWide
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@deniszh
deniszh / gist:272d8b9474feed69a3f1
Created February 29, 2016 18:00
### Keybase proof
### Keybase proof
I hereby claim:
* I am deniszh on github.
* I am deniszh (https://keybase.io/deniszh) on keybase.
* I have a public key whose fingerprint is A477 D65F 62A7 59DD 1333 16A9 841F F4A7 BEF1 7C12
To claim this, I am signing this object:
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