Skip to content

Instantly share code, notes, and snippets.

View fclairamb's full-sized avatar
🤖

Florent Clairambault fclairamb

🤖
View GitHub Profile
@fclairamb
fclairamb / lbca.py
Last active August 22, 2019 09:43
Script python de création d'email d'alerte pour le bon coin. Le script a un mode graphique et un mode email.
#!/usr/bin/python
import urllib
import requests
import re
import sqlite3
import os
import argparse
import gettext
import logging
import logging.handlers

Keybase proof

I hereby claim:

  • I am fclairamb on github.
  • I am fclairamb (https://keybase.io/fclairamb) on keybase.
  • I have a public key ASA3MsMSqP-rEvGEE4ps2nlLlSwZ_j2_TNiGGbJPUw8pIAo

To claim this, I am signing this object:

@fclairamb
fclairamb / hosts
Last active November 14, 2016 17:32
TINC setup ansible playbook It generates a private/public key pair on each host, get each public key and push them back to each server
# sample config file
[do]
198.199.74.236 tinc_ip=10.1.1.1 hostname=ca_1_1 tinc_connectto=ca_2_2
192.34.60.13 tinc_ip=10.1.1.2 hostname=ca_1_2 tinc_connectto=ca_1_1
198.199.70.163 tinc_ip=10.1.1.3 hostname=ca_1_3 tinc_connectto=ca_1_2
198.199.71.204 tinc_ip=10.1.2.1 hostname=ca_2_1 tinc_connectto=ca_1_3
198.199.70.208 tinc_ip=10.1.2.2 hostname=ca_2_2 tinc_connectto=ca_2_1
@fclairamb
fclairamb / logrotate-default-parameters
Last active May 30, 2016 05:45
Logrotate parameters to have small and easy to backup logs. Because xz consume a lot of CPU, setting cron with a idle ionice and a 19 nice level.
# /etc/logrotate.d/00-default-parameters
weekly
rotate 12
create
compress
delaycompress
dateext
compresscmd /usr/bin/xz
uncompresscmd /usr/bin/unxz
compressext .xz
#!/bin/sh
# Quick IP banning script
# This is a very simple and effective way to ban IP address from any kind of webapp.
#
# * To ban an IP for two minutes
# echo "120" >/tmp/iptables-banip/1.2.3.4 && /usr/local/bin/banip
#
# * To bypass the ban timeout and unban an IP sooner
# echo "0" >/tmp/iptables-unbanip/1.2.3.4 && /usr/local/bin/banip
@fclairamb
fclairamb / server.go
Created January 4, 2014 22:09
Simple TCP line receiving Go Server
package main
import (
"bufio"
"fmt"
"io"
"log"
"net"
"os"
"runtime"
@fclairamb
fclairamb / color.py
Last active December 25, 2015 06:19
RGB 24 --> 16 bits
def rgb16(r, g, b):
r = (r & 255) >> 3 # RED (5 bits)
g = (g & 255) >> 2 # GREEN (6 bits)
b = (b & 255) >> 3 # BLUE (5 bits)
c = (r << (6+5)) | (g << 5) | b
return "0x{0:04x}".format(c)
@fclairamb
fclairamb / ctest.c
Last active December 23, 2015 09:48
Producer/Consumer exercice as requested by superman. v2, superman wasn't happy enough.
#ifdef SHELL
SCENARIO=$1
if [ "${SCENARIO}" = "" ]; then
SCENARIO=1
fi
gcc -pthread -O3 -DSCENARIO=${SCENARIO} -Wall -Werror $0 && ./a.out
exit 0
#endif
#include <pthread.h>
#include <stdio.h>
@fclairamb
fclairamb / Makefile
Created September 17, 2013 16:35
sikuli supplemental linuxvision converted the crappy "makeVisionProxy" into a makefile
OBJS=build/cvgui.o build/finder.o build/imgdb.o build/pyramid-template-matcher.o build/sikuli-debug.o build/tessocr.o build/vision.o build/visionJAVA_wrap.o
INCS=-I/usr/local/include -I/usr/include -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux
OPTS= -O3 -fPIC -MMD -MP $(INCS)
LIB=dist/libVisionProxy.so
all: $(LIB)
#ifdef SHELL
gcc -Wall -Werror $0 && ./a.out 10
exit 0
#endif
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char * argv [] ) {
int size = atoi(argv[1]);