Skip to content

Instantly share code, notes, and snippets.

View graphaelli's full-sized avatar

Gil Raphaelli graphaelli

View GitHub Profile
@graphaelli
graphaelli / sampleflaskapm.py
Created February 27, 2018 20:45
sample elastic apm flask app
#!/usr/bin/env python
import elasticapm
from elasticapm.contrib.flask import ElasticAPM
from flask import Flask
# initialize using environment variables from elasticapm.contrib.flask import ElasticAPM
app = Flask(__name__)
@graphaelli
graphaelli / somaxconn.go
Created March 21, 2018 20:50
fetch kern.ipc.somaxconn
if somaxconn, err := unix.Sysctl("kern.ipc.somaxconn"); err != nil {
panic(err)
} else {
var backlog uint16
r := strings.NewReader(somaxconn)
if err := binary.Read(r, binary.LittleEndian, &backlog); err != nil {
fmt.Println("binary.Read failed:", err)
}
fmt.Println(backlog)
}
@graphaelli
graphaelli / Gopkg.toml
Created March 23, 2018 21:19
messing around with the prometheus client
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
@graphaelli
graphaelli / number_test.go
Created March 27, 2018 20:56
useNumber benchmark
package main
import (
"bytes"
"encoding/json"
"testing"
)
var (
data map[string]interface{}
@graphaelli
graphaelli / LICENSE
Last active April 25, 2018 14:45
Flickr Archive Utilities - MIT License
Copyright 2018 Gil Raphaelli
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@graphaelli
graphaelli / auditbeat-seccom-x86_64.yml
Created April 23, 2018 12:53 — forked from andrewkroh/auditbeat-seccom-x86_64.yml
Elastic Beat Seccomp Profiles
seccomp:
default_action: errno
syscalls:
- names:
- accept
- accept4
- arch_prctl
- bind
- brk
- clone
benchmark old ns/op new ns/op delta
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceValidate-4 6977 9455 +35.52%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceDecode-4 3238 3192 -1.42%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessValidate-4 9093 10978 +20.73%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessDecode-4 3766 3803 +0.98%
BenchmarkBackendProcessor/TestProcessErrorFullValidate-4 58480 77015 +31.69%
BenchmarkBackendProcessor/TestProcessErrorFullDecode-4 14368 14116 -1.75%
BenchmarkBackendProcessor/TestProcessErrorNullValuesValidate-4 39119 43806 +11.98%
BenchmarkBackendProcessor/TestProcessErrorNullValuesDecode-4 7862
@graphaelli
graphaelli / vars.json
Last active July 27, 2018 14:23
apm-server debug vars
{
"libbeat.config.reloads": 0,
"libbeat.config.module.starts": 0,
"libbeat.config.module.stops": 0,
"libbeat.config.module.running": 0,
"libbeat.output.type": "elasticsearch",
"libbeat.output.events.duplicates": 0,
"libbeat.output.events.active": 0,
"libbeat.output.events.batches": 0,
"libbeat.output.events.total": 0,
{
"apm-6.2.3": {
"aliases": {},
"index_patterns": [
"apm-6.2.3-*"
],
"mappings": {
"doc": {
"_meta": {
"version": "6.2.3"
#!/usr/bin/env python3
import json
import os
def direct_dep(pkg):
for d in {
"github.com/Bowery/prompt",
"github.com/apache/thrift",