Skip to content

Instantly share code, notes, and snippets.

View ctavan's full-sized avatar

Christoph Tavan ctavan

View GitHub Profile
net.netfilter.nf_conntrack_max = 655350
net.netfilter.nf_conntrack_generic_timeout = 60
net.netfilter.nf_conntrack_tcp_timeout_established = 600
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 5
@ctavan
ctavan / aggregation-rules.conf
Last active August 29, 2015 14:06
carbon.conf
# The form of each line in this file should be as follows:
#
# output_template (frequency) = method input_pattern
#
# This will capture any received metrics that match 'input_pattern'
# for calculating an aggregate metric. The calculation will occur
# every 'frequency' seconds and the 'method' can specify 'sum' or
# 'avg'. The name of the aggregate metric will be derived from
# 'output_template' filling in any captured fields from 'input_pattern'.
#
@ctavan
ctavan / gist:6185925
Created August 8, 2013 16:01
user-agent-of-the-day
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; Sie gehen über die Firewall der Gemeinde Alfter ins Internet)
var RTBkit = require('../build/x86_64/bin/rtb.node');
var services = require('../build/x86_64/bin/services.node');
var zookeeperUri = "localhost:2181"; //must point to same Zookeeper as routers
var services = new services.ServiceProxies();
services.bootstrap('bootstrap.json');
var agent = new RTBkit.BiddingAgent('myAgent', services);
{
- title: "openrtb-v2_0-schema-bid_request"
+ title: "openrtb-v2_1-schema-bid_request"
- description: "json schema for an openrtb v2.0 bid request (http://www.iab.net/media/file/OpenRTB_API_Specification_Version2.0_FINAL.PDF)"
+ description: "json schema for an openrtb v2.1 bid request (http://www.iab.net/media/file/OpenRTB-API-Specification-Version-2-1-FINAL.pdf)"
definitions: {
+ vast_companion_type: {
+ type: "integer"
+ minimum: 1
+ maximum: 3
@ctavan
ctavan / remove-merged-branches.sh
Created May 14, 2013 15:54
Remove merged git branches
#!/bin/sh
REMOTE=${1:-origin}
BRANCH=$(git symbolic-ref -q HEAD) || BRANCH='(unknown branch)'
BRANCH=${BRANCH##refs/heads/}
REMOTE_MERGED=$( git branch -r --merged |
grep -v master |
grep -v "$BRANCH" |
sed -n "s,$REMOTE/,,p"
@ctavan
ctavan / gist:4482825
Last active February 18, 2019 16:09
Init-script for optionally starting multiple redis instances on the same host running Ubunut/Debian. Highly inspired by the memcached init script that comes with the Ubuntu package. This is useful since redis is single-threaded.
#! /bin/bash
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@ctavan
ctavan / parse_broken_csv.py
Created October 12, 2012 11:46
Decode CSV file with broken encodings.
#!/usr/bin/env python
"""
This script parses a tab-separated CSV-file where fields may contain strings
with broken encodings. Each line of the CSV-file is parsed into a dictionary.
"""
import csv
import json
import sys
@ctavan
ctavan / Makefile
Created September 29, 2012 12:54
Make targets for linting javascript code (node.js)
JSFILES = $(shell find lib test -name "*.js")
jshint: force
jshint $$JSFILES --config test/share/jshint.conf
gjslint: force
gjslint --debug_indentation --nojsdoc --unix_mode \
-e test/fixtures -r lib -r test
check: jshint gjslint
@ctavan
ctavan / gist:3800152
Created September 28, 2012 14:21
Convert list of strings to valid JSON array for loading in node.js
cat list.txt | sed 's/\(.*\)/"\1",/;1s/^/[/;$s/.$/]/' > list.json