Skip to content

Instantly share code, notes, and snippets.

View fclairamb's full-sized avatar
🤖

Florent Clairambault fclairamb

🤖
View GitHub Profile
@fclairamb
fclairamb / cassandra_time_serie.py
Created March 2, 2013 22:28
A basic implementation of time series in python with pycassa. The idea is to explain how simple this can be.
#!/usr/bin/python
import pycassa
import datetime
import json
# This is a basic (and yet generic) implementation of time series using pycassa
class TimeSerie:
def __init__(self, keyspace, subject, sys=None):
# To make things easier, we can create the keyspace and column families ourself
@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
@fclairamb
fclairamb / Makefile
Last active December 15, 2015 17:48
This is a simple skeleton to build C/C++ projects without complex setup.This can be useful if you receive a project with a lot of code source and don't want to provide an IDE generated Makefile or use automake.It obviously doesn't support headers dependencies. Changing elements within a struct or a class require a clean & build.
ifeq "$(PREFIX)" ""
PREFIX=/usr
endif
ifeq "$(DESTDIR)" ""
DESTDIR=/
endif
@fclairamb
fclairamb / log4j2.rolling.xml
Last active April 6, 2023 16:45
log4j2.xml sample setup files: * rolling: To enable rolling logging. * setup file to log on file (rotation should be handled by logrote), syslog (to collect all the logs from the different services) and console...
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<properties>
<property name="name">app</property>
<property name="pattern">%d{yyyy-MM-dd HH:mm:ss.SSS} | %-5.5p | %-10.10t | %-20.20C:%-5.5L | %msg%n</property>
<!--
It will look like that:
2013-04-03 07:37:51.993 | WARN | main | lnetgateway.Server:56 | My app is logging stuff
-->
</properties>
#!/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 / at_session_startup.sh
Last active December 15, 2015 20:29
Add an SSH key with a password automatically. This can be added to bashrc for instance.
/usr/bin/expect >/dev/null <<EOF
set password mypassword
set key mykey.pub
spawn ssh-add /home/user/.ssh/$key
match_max 100000
expect ":"
send -- "$password\r"
expect eof
EOF
@fclairamb
fclairamb / install_java.yml
Created April 7, 2013 15:58
Ansible playbook to install Java automatically on Debian. I'm pretty sure you have to read and accept the java license before installing this. Using apt module surely is better but it requires to have python-apt installed.
- name: Java install
hosts: do
user: root
tasks:
- name: Create java repo list
action: shell echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main' >/etc/apt/sources.list.d/java.list
- name: Add repo key
action: command apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
- name: Accept java license
action: shell echo 'oracle-java7-installer shared/accepted-oracle-license-v1-1 select true' | debconf-set-selections
@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 / wifite-ino.py
Last active December 20, 2015 02:39
wifite.py with only the additionnal '--ignore-negative-one' after each aireplay-ng. This allows to use the Alpha AWUSO36NH (rt2800usb) with wifite the easy way. I used an updated Ubuntu 13.04 (raring) + aircrack 1.2 beta recompiled + this wifite.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
wifite
author: derv82 at gmail
Licensed under the GNU General Public License Version 2 (GNU GPL v2),
@fclairamb
fclairamb / build_jetty_package.sh
Last active December 21, 2015 20:09
Jetty debian package builder. It takes the jetty script as is and build a jetty server that runs at startup. It's quick & simple version. Improvements are welcome.
#!/bin/sh
JETTY_VERSION=9.0.5.v20130815
# We reset everything
rm -Rf jetty-distribution-${JETTY_VERSION} jetty
# We prepare the dirs
mkdir -p jetty/opt jetty/etc/init.d jetty/etc/default jetty/DEBIAN