Skip to content

Instantly share code, notes, and snippets.

View athoune's full-sized avatar

Mathieu Lecarme athoune

View GitHub Profile
@athoune
athoune / gist:8460273
Created January 16, 2014 18:16
Compiling Influxdb on a Mac
$ go version
go version go1.2 darwin/amd64
$ go env
GOARCH="amd64"
GOBIN="/usr/local/bin"
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
@athoune
athoune / gist:8465184
Created January 16, 2014 23:01
Dumping http stuff from a tcpdump file
import sys
import socket
import dpkt
f = open(sys.argv[1], 'r')
pcap = dpkt.pcap.Reader(f)
buffers = {}
requests = {}
@athoune
athoune / gist:8654343
Last active January 4, 2016 17:29
Who is writing?
#!/usr/bin/env python
import subprocess
import re
WP = re.compile(r' +')
def lsof():
p = subprocess.Popen(['lsof', '/'], stdout=subprocess.PIPE)
headers = WP.split(p.stdout.readline()) # headers
@athoune
athoune / rotatated.py
Last active August 29, 2015 13:55
Checking logrotate coverage
#!/usr/bin/env python
from glob import glob
from fnmatch import fnmatch
from os import walk
from os.path import join
import re
DATE_OR_VERSION = re.compile('\.(\d{4}-\d{2}-\d{2})|(\d+)$')
@athoune
athoune / split.py
Created May 17, 2014 13:04
Splitting large mongodb log with mtools.
#!/usr/bin/env python
import sys
from mtools.util.logfile import LogFile
log = LogFile(open(sys.argv[1], 'r'))
day = None
out = None
for line in log:
d = line.datetime
@athoune
athoune / gist:5b8598e747598c2e3d29
Last active August 29, 2015 14:01
Implementing dhash with numpy and skimage.
import numpy as np
from skimage.data import imread
from skimage.transform import resize
from skimage.color import rgb2grey
"""
http://www.hackerfactor.com/blog/?/archives/529-Kind-of-Like-That.html
"""
TWOS = np.array([2 ** n for n in range(7, -1, -1)])
@athoune
athoune / gist:7e9d4eff5dd358d6dafa
Created June 4, 2014 09:18
Counting IP, and countries
package main
import (
"bufio"
"fmt"
"github.com/nranchev/go-libGeoIP"
"io"
"os"
"regexp"
"time"
@athoune
athoune / Dockerfile
Created August 2, 2014 14:01
Dockerfile for Fipes
FROM debian:7.5
MAINTAINER <Mathieu>
RUN apt-get update
RUN apt-get -q install -y erlang make git
RUN useradd -d /opt/fipes --system fipes
ADD Makefile /opt/fipes/
@athoune
athoune / Dockerfile
Created August 12, 2014 21:23
Building Influxdb
FROM debian:7.5
MAINTAINER mlecarme@bearstech.com
ENV DEBIAN_FRONTEND noninteractive
# Basic needed tools
RUN apt-get -q update
RUN apt-get -q install -y mercurial bzr protobuf-compiler flex bison \
valgrind g++ make autoconf libtool libz-dev libbz2-dev curl \
rpm build-essential git wget gawk procps
#!/usr/bin/env python
import sys
from tvdb_api import Tvdb
from tvnamer.config_defaults import defaults
from tvnamer.utils import Config, FileParser, FileFinder
from tvnamer.tvnamer_exceptions import (ShowNotFound, SeasonNotFound, EpisodeNotFound,