Skip to content

Instantly share code, notes, and snippets.

View athoune's full-sized avatar

Mathieu Lecarme athoune

View GitHub Profile
@athoune
athoune / gist:2971618
Created June 22, 2012 09:23
test page content in a loop
var http = require('http');
var options = {
host: 'ze.garambrogne.net',
port: 80,
path: '/'
};
var cpt = 0;
var good = 0;
@athoune
athoune / gist:3170756
Created July 24, 2012 15:41
ugly script to spy http connection
import time
import pcap, dpkt, socket
# code stolen from:
# http://bramp.net/blog/2010/01/follow-http-stream-with-decompression/
pc = pcap.pcap('eth0')
count = 0
ports = (80, 8080, 888)
# Pcap writer
@athoune
athoune / gist:4116824
Created November 20, 2012 08:57
collectd to graphite, before 5.1
import time
from socket import socket
import collectd
sock = None
CARBON_SERVER = '127.0.0.1'
CARBON_PORT = 2003
def config(conf):
collectd.debug('Configuring Stuff')
#!/usr/bin/env python
from multiprocessing import Process, Pipe
from SimpleHTTPServer import SimpleHTTPRequestHandler
import SocketServer
ROOT = "."
def webserver(conn):
PORT = 8000
@athoune
athoune / gist:5639276
Last active December 17, 2015 16:29
Carbon driver for basho bench
-module(basho_bench_driver_carbon).
% basho bench needs only two functions
-export([new/1, run/4]).
-include("basho_bench.hrl").
-record(state, {
host,
port,
@athoune
athoune / gist:5777474
Last active August 28, 2018 22:20
Pushing mails to Elastic Search for a Kibana analysis.
#!/usr/bin/env python
import sys
# Lamson is an application, but also the best way to read email without
# struggling with "battery include" libraries.
from lamson.encoding import from_string as parse_mail
from pyelasticsearch import ElasticSearch
from pyelasticsearch.exceptions import ElasticHttpNotFoundError
{"facets": {
"facet1": {
"terms_stats": {
"key_field": "@fields.path",
"value_field": "@fields.time",
"order": "total",
"size": 20
},
"facet_filter": {
"fquery": {
@athoune
athoune / gist:7655769
Created November 26, 2013 09:42
Make a cluster with Vagrant, and fighting with vagrant's debian painful bug.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |main_config|
main_config.vm.define :alice do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
@athoune
athoune / Vagrantfile
Created December 13, 2013 14:51
Alice and Bob try to talks each other
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |main_config|
main_config.vm.define :alice do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
@athoune
athoune / gist:7984375
Created December 16, 2013 09:23
Rotten domain detector
#!/usr/bin/env python
import socket
import sys
import re
DOMAIN = re.compile("https?://([a-zA-Z0-9.-_]*\.[\w]{2,})")
dejavue = set()
for line in sys.stdin: