Skip to content

Instantly share code, notes, and snippets.

View vincentbernat's full-sized avatar

Vincent Bernat vincentbernat

View GitHub Profile
@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 / 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 / erc.conf.el
Created November 6, 2013 00:23
Tentative to reattach timestamps from ZNC correctly
;; ZNC will replay a buffer and prefix each message with a
;; timestamp. Let's extract this timestamp and redefine current-time
;; to make them appear as regular timestamp. We use an advice to be
;; able to locally define `current-time` function.
(defadvice erc-add-timestamp (around vbe/erc-add-timestamp)
"Extract timestamp beginning a message and display it like a regular timestamp"
(save-match-data
(goto-char (point-min))
(if (looking-at "^\\s-*\\S-+ \\[\\([0-9][0-9]\\):\\([0-9][0-9]\\):\\([0-9][0-9]\\)\\] ")
(let ((hours (match-string 1))
@vincentbernat
vincentbernat / pinba.sql.H_engine-05.adm.dailymotion.com
Created November 7, 2013 13:34
Non default Pinba SQL tables
CREATE TABLE IF NOT EXISTS `tag_info_counter` (
`tag_value` varchar(32) DEFAULT NULL,
`req_count` int(11) DEFAULT NULL,
`req_per_sec` float DEFAULT NULL,
`hit_count` int(11) DEFAULT NULL,
`hit_per_sec` float DEFAULT NULL,
`timer_value` float DEFAULT NULL
) ENGINE=PINBA COMMENT='tag_info:counter';
CREATE TABLE IF NOT EXISTS `tag_info_group` (
@vincentbernat
vincentbernat / osx-system-users.txt
Created November 10, 2013 08:47
OSX system users (starting with an underscore)
_amavisd 83
_appleevents 55
_appowner 87
_appserver 79
_ard 67
_assetcache 235
_atsserver 97
_avbdeviced 229
_calendar 93
_ces 32
@vincentbernat
vincentbernat / email-changes.sh
Created November 10, 2013 22:23
email-changes hook for reprepro
#!/bin/sh
[ -n "${REPREPRO_OUT_DIR}" ] || {
echo "needs to be run by reprepro!" >&2
exit 1
}
cd "${REPREPRO_OUT_DIR}" || exit 1
dsc() {
dsc="$(readlink --canonicalize "$1")"
@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 / SearchDailymotion.scala
Created November 22, 2013 19:53
Gatling scenario with step up and quick ramp down
package dailymotion
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.http.Headers.Names._
import scala.concurrent.duration._
import bootstrap._
import assertions._
object SearchDailymotion {
@vincentbernat
vincentbernat / elasticsearch.erl
Last active December 29, 2015 14:09
Erlang module for Tsung to extract data from MySQL
-module(elasticsearch).
-export([autocomplete/1, autocomplete/0,
search/1, search/0,
start/0,
stop/0,
loop/1]).
-on_load(start/0).
%% Return an autocomplete request
autocomplete() ->
@vincentbernat
vincentbernat / elasticsearch.erl
Created November 30, 2013 07:50
Erlang module for Tsung to extract data from large files
-module(elasticsearch).
-export([autocomplete/1, autocomplete/0,
search/1, search/0,
start/0,
stop/0,
loop/1]).
-on_load(start/0).
%% Return an autocomplete request
autocomplete() ->