Skip to content

Instantly share code, notes, and snippets.

View vincentbernat's full-sized avatar

Vincent Bernat vincentbernat

View GitHub Profile
@vincentbernat
vincentbernat / dh_virtualenv.1
Created December 1, 2013 13:26
Manual page for dh-virtualenv
.Dd December 01, 2013
.Dt DH_VIRTUALENV 1
.Sh NAME
.Nm dh_virtualenv
.Nd deploy a Python package in a self-contained virtualenv
.Sh SYNOPSIS
.Nm
.Sh DESCRIPTION
.Nm
is a tool that aims to combine Debian packaging with self-contained
@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 / logstash-test.sh
Created January 20, 2014 09:37
Testing logstash filter
#!/bin/sh
usage() {
cat <<EOF >&2
Usage: $0 [ -t type ] input-filter.conf
Test a filter configuration for Logstash. The filter is specified in
the provided \`input-filter.conf'. This file is expected to contain a
filter only (enclosed in \`filter' directive). The logs will be read
from stdin and the parsed result will be output to stdout.
@vincentbernat
vincentbernat / atomic.go
Last active January 4, 2016 11:29
Bug in golang with respect with atomic
package main
import (
"sync/atomic"
)
type StandardEWMA struct {
alpha float64
init bool // Remove to remove the bug
rate float64
@vincentbernat
vincentbernat / postinst
Created March 20, 2014 16:03
fpm-cook recipe for Serf
#!/bin/sh
set -e
case "$1" in
configure|reconfigure)
;;
*)
adduser --system --disabled-password --disabled-login --home /nonexistent \
--no-create-home --quiet --force-badname --group _serf
@vincentbernat
vincentbernat / dispatch.sh
Last active August 29, 2015 13:57
More flexible dispatcher for Serf
#!/bin/sh
SERFDIR="${SERFDIR:-/etc/serf}"
# Dispatch an event to the appropriate handlers.
#
# $ tree /etc/serf
# /etc/serf
# └── handlers
# ├── member-failed
@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');
@vincentbernat
vincentbernat / iptables-ns.sh
Created April 28, 2014 10:19
Use of Linux network namespace to test and commit a firewall
#!/bin/zsh
# Use a dedicated network namespace to build and test firewall rules
# before applying them.
set -e
zparseopts -D n=dryrun -dry-run=dryrun t=trace -trace=trace f=iptables
[[ -n $trace ]] && setopt xtrace
[[ -z $iptables ]] && {
@vincentbernat
vincentbernat / .mbsyncrc.txt
Created June 8, 2014 20:34
mbsync configuration
# -*- conf -*-
FSync no
#
# Luffy
#
IMAPStore remote-luffy
Host imap.luffy.cx
[Unit]
Description = XBMC Media Center
After = remote-fs.target
After = syslog.target
[Service]
User = xbmc
Group = xbmc
Type = simple
Restart = always