Skip to content

Instantly share code, notes, and snippets.

@alq666
alq666 / haproxy-error.awk
Last active March 4, 2016 23:55
Datadog from gawk
/app/ {
split($7, arr, "/");
host = arr[2];
if (host == "<NOSRV>") {
host = "nosrv";
}
split($8, arr, "/");
tq = arr[1];
tw = arr[2];
tc = arr[3];
@alq666
alq666 / README.hot
Created December 28, 2015 21:16
Copied from pg's mailing list
Heap Only Tuples (HOT)
Introduction
------------
The Heap Only Tuple (HOT) feature eliminates redundant index entries and
allows the re-use of space taken by DELETEd or obsoleted UPDATEd tuples
without performing a table-wide vacuum. It does this by allowing
single-page vacuuming, also called "defragmentation".
@alq666
alq666 / microbench_gaugedelta.py
Created November 28, 2015 16:32
Micro-benchmarks for gauge deltas
import timeit
import random
acc = None
def sample():
value = random.random()
if value >= 0.5:
return "+" + str(value)
else:
@alq666
alq666 / prlimit.c
Last active October 26, 2017 22:05
Increase the number of open files for a running process (without using GDB)
#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)
From 1814e7c904072f0f67c5128d53a20d26ebb56b1a Mon Sep 17 00:00:00 2001
From: Jun Rao <junrao@gmail.com>
Date: Tue, 12 May 2015 15:37:21 -0700
Subject: [PATCH 1/3] synchronize on getting size from watchers
---
core/src/main/scala/kafka/server/RequestPurgatory.scala | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/core/src/main/scala/kafka/server/RequestPurgatory.scala b/core/src/main/scala/kafka/server/RequestPurgatory.scala
@alq666
alq666 / packet-type3-dnetc.log
Created August 26, 2015 20:48
CPU benchmarks
dnetc v2.9111-520-CFR-13101401 for Linux (Linux 3.13.0-62-generic).
Please provide the *entire* version descriptor when submitting bug reports.
The distributed.net bug report pages are at http://bugs.distributed.net/
[Aug 26 20:28:39 UTC] Automatic processor type detection did not
recognize the processor (tag: "100063F2")
[Aug 26 20:28:39 UTC] OGR-NG: using core #0 (FLEGE-64 2.0).
[Aug 26 20:28:59 UTC] OGR-NG: Benchmark for core #0 (FLEGE-64 2.0)
0.00:00:17.02 [42,484,904 nodes/sec]
[Aug 26 20:28:59 UTC] OGR-NG: using core #1 (cj-asm-generic).
Crashlog created at 2015-05-31 15:54:57 -0400
===== MESSAGE:
ArgumentError: invalid byte sequence in US-ASCII
===== COMPILATION STACK:
- [item] /ja/examples/Graphing Functions/ (rep default)
@alq666
alq666 / fake-upstart.sh
Created April 24, 2015 19:21
Get out of dpkg errors when upstart is not running
# make dpkg think that upstart is always happy even when systemd is running the show
# credit: http://csgeek-random.blogspot.com/2015/04/ubuntu-1504-broken-upstart-working.html
sudo dpkg-divert --local --rename --add /sbin/initctl
sudo ln -s /bin/true /sbin/initctl
docker run -d --privileged --name dd-agent -h `hostname` \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /proc/mounts:/host/proc/mounts:ro \
-v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
-e API_KEY=`etcdctl get /ddapikey` \
datadog/docker-dd-agent
@alq666
alq666 / upgrade.sh
Created November 3, 2014 18:56
Working around pg8000 bug on SmartOS
cd /opt/local/datadog
source venv/bin/activate
pip install pg8000 --upgrade
bin/agent restart
# wait for 10s
bin/agent info # should show you proper postgres metrics