Skip to content

Instantly share code, notes, and snippets.

View vincentbernat's full-sized avatar

Vincent Bernat vincentbernat

View GitHub Profile
@vincentbernat
vincentbernat / .mbsyncrc.txt
Created June 8, 2014 20:34
mbsync configuration
# -*- conf -*-
FSync no
#
# Luffy
#
IMAPStore remote-luffy
Host imap.luffy.cx
@vincentbernat
vincentbernat / gist:4391597
Created December 27, 2012 20:19
`socat` as an SSH reverse proxy (or anything TCP-based)
local$ socat TCP-LISTEN:2222,bind=127.0.0.1,reuseaddr,fork TCP-LISTEN:2223,reuseaddr
local$ ssh -p 2222 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no localhost
remote$ socat TCP:10.0.2.2:2223 TCP:127.0.0.1:22
@vincentbernat
vincentbernat / metrics.go
Created March 8, 2022 07:33
Converting Sarama's metrics to Prometheus
package kafka
import (
"strings"
"github.com/prometheus/client_golang/prometheus"
gometrics "github.com/rcrowley/go-metrics"
"flowexporter/reporter"
)
#!/usr/bin/env python
"""
SNMP helper for HAproxy implementing EXCELIANCE-MIB with
`pass_persist` protocol. Data are retrieved from multiple instances of
haproxy using HTTP.
"""
def toOid(oid):
"""Convert a string to tuple OID"""
/* Proof of concept of the inability to attach to an existing NS in
* the same user namespace. */
#define _GNU_SOURCE 1
#include <sys/wait.h>
#include <sys/utsname.h>
#include <sched.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

pytest all the things

@vincentbernat
vincentbernat / Rakefile.rb
Created December 17, 2013 22:59
Rakefile for running parallel serverspec
require 'rake'
require 'rspec/core/rake_task'
require 'xpool'
require 'colorize'
$REPORTS = "./reports" # Where to store JSON reports
$PARALLEL = 10 # How many parallel tasks should we run?
# Return all roles of a given host
def roles(host)
@vincentbernat
vincentbernat / preseed.txt
Created November 11, 2013 12:26
Preseed file for Debian Installer to use a merged local repository
d-i mirror/country string manual
d-i mirror/http/hostname string packages.dm.gg
d-i mirror/http/directory string /dailymotion
d-i apt-setup/restricted boolean false
d-i apt-setup/universe boolean false
d-i apt-setup/backports boolean false
d-i apt-setup/proposed boolean false
d-i apt-setup/security_host string
d-i apt-setup/local0/repository string http://packages.dm.gg/dailymotion precise main restricted universe multiverse
d-i apt-setup/local0/source boolean false
@vincentbernat
vincentbernat / 0001-EDNS0-client-subnet-support.patch
Last active March 11, 2020 14:36
EDNS0 client subnet support for BIND
From 83f0062d385fd4f111b31c1f26b571cabd7e0e4c Mon Sep 17 00:00:00 2001
From: Vincent Bernat <vincent.bernat@dailymotion.com>
Date: Thu, 5 Sep 2013 16:52:45 +0200
Subject: [PATCH] EDNS0 client subnet support.
---
bin/named/client.c | 227 +++++++++++++++++++++++++++++++--------
bin/named/include/named/client.h | 4 +
bin/named/include/named/server.h | 81 +++++++-------
bin/named/sortlist.c | 4 +-
@vincentbernat
vincentbernat / migrations.js
Created April 9, 2014 08:08
Test database migration result with Sequelize.js
'use strict';
var setup = require('../.'),
should = require('should'),
path = require('path'),
Sequelize = require('sequelize'),
db = require('../../lib/db'),
config = require('../../lib/config'),
logger = require('../../lib/logger');