Skip to content

Instantly share code, notes, and snippets.

View davidbirdsong's full-sized avatar

david birdsong davidbirdsong

  • san francisco, ca
View GitHub Profile
@davidbirdsong
davidbirdsong / haproxy_prom.txt
Created October 30, 2019 21:09
haproxy-prometheus example
# HELP haproxy_process_nbthread Configured number of threads.
# TYPE haproxy_process_nbthread gauge
haproxy_process_nbthread 4
# HELP haproxy_process_nbproc Configured number of processes.
# TYPE haproxy_process_nbproc gauge
haproxy_process_nbproc 1
# HELP haproxy_process_relative_process_id Relative process id, starting at 1.
# TYPE haproxy_process_relative_process_id gauge
haproxy_process_relative_process_id 1
# HELP haproxy_process_start_time_seconds Start time in seconds.
@davidbirdsong
davidbirdsong / haproxy-compile
Created October 29, 2019 18:58
haproxy compile
HA-Proxy version 2.0.8 2019/10/23 - https://haproxy.org/
Build options :
TARGET = linux-glibc
CPU = generic
CC = gcc
CFLAGS = -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv -Wno-unused-label -Wno-sign-compare -Wno-unused-parameter -Wno-old-style-declaration -Wno-ignored-qualifiers -Wno-clobbered -Wno-missing-field-initializers -Wtype-limits
OPTIONS = USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_TFO=1 USE_NS=1 USE_SYSTEMD=1
Feature list : +EPOLL -KQUEUE -MY_EPOLL -MY_SPLICE +NETFILTER +PCRE -PCRE_JIT -PCRE2 -PCRE2_JIT +POLL -PRIVATE_CACHE +THREAD -PTHREAD_PSHARED -REGPARM -STATIC_PCRE -STATIC_PCRE2 +TPROXY +LINUX_TPROXY +LINUX_SPLICE +LIBCRYPT +CRYPT_H -VSYSCALL +GETADDRINFO +OPENSSL -LUA +FUTEX +ACCEPT4 -MY_ACCEPT4 +ZLIB -SLZ +CPU_AFFINITY +TFO +NS +DL +RT -DEVICEATLAS -51DEGREES -WURFL +SYSTEMD -OBSOLETE_LINKER +PRCTL +THREAD_DUMP -EVPORTS
@davidbirdsong
davidbirdsong / hap-do-resolve
Created October 29, 2019 18:56
do-resolve woes
global
log stdout local0
defaults
mode http
resolvers main_resolver
nameserver dns1 8.8.8.8:53
frontend fe_forwarder
@davidbirdsong
davidbirdsong / repilcate_file
Created October 17, 2017 23:19
replicate endpoint
local http = require('ext.resty.http')
local c = require('imgix.hwy.common')
local cjson = require('cjson')
local _ngx = ngx
if _ngx.req.get_method() ~= 'REPLICATE' then
_ngx.status = _ngx.HTTP_NOT_ALLOWED
local e = string.format('unsupported method: %s', _ngx.req.get_method())
_ngx.say(e)
_ngx.log(_ngx.ERR, e)
@davidbirdsong
davidbirdsong / spigot_segv
Created April 6, 2017 21:13
spigot segv backtrace
*** Segmentation fault
Register dump:
RAX: 000000000e0b2270 RBX: 00007f6d21771ae0 RCX: 000000004108f810
RDX: 0000000041366b88 RSI: 0000000000000002 RDI: fffffffb411b4378
RBP: 0000000040ac6710 R8 : 0000000001ca19c0 R9 : 0000000001ca19c0
R10: 00000000401bd490 R11: 0000000000000000 R12: 0000000040cac460
R13: 00007ffc4d750ca0 R14: 00000000411b6da8 R15: 000000004045cdf0
RSP: 00007ffc4d6e45e0
51 yes
52 no
53 no
54 yes
55 no
56 no
57 yes
58 yes
59 no
60 no
global
pidfile /var/run/haproxy.pid
stats socket /var/run/haproxy.sock mode 600 level admin
maxconn 10240
user produser
group produser
log-tag gp_proxy
# daemon
description general purpose proxy, no image traffic through here
frontend gp-tls
bind 10.0.1.1:443 ssl crt /tmp/certs
bind 127.0.0.1:8001
mode tcp
log 127.0.0.1:5114 local2
option contstats
tcp-request inspect-delay 10s
tcp-request content accept if HTTP
tcp-request content accept if { src 127.0.0.1 }
@davidbirdsong
davidbirdsong / tcp_syslog.lua
Last active June 24, 2016 19:09
tcp syslog test
local coroutine = require('coroutine')
local socket = require('socket')
local string = require('string')
local table = require('table')
local io = require('io')
local write = io.write
local syslog_grammar, address, port
if read_config then
@davidbirdsong
davidbirdsong / leveldb_cache_stress
Created June 15, 2016 23:36
demonstrate ordering of calls to leveldb.Cache
package main
import (
"github.com/syndtr/goleveldb/leveldb/cache"
"fmt"
"sync"
"time"
)