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 / 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 / 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 / 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
@fclairamb
fclairamb / debug.c
Created September 3, 2013 16:42
An evil way to test debug macro: ./debug.c BEGIN! ./debug.c:main:19: test! ./debug.c:main:20: test! END ! BEGIN! END !
#ifdef SHELL
gcc $0 && ./a.out
gcc -DNDEBUG $0 && ./a.out
exit 0
#endif
#include <stdio.h>
#ifndef NDEBUG
#define DEBUG(fmt, arg...) \
@fclairamb
fclairamb / unitialized_value.c
Created September 3, 2013 16:55
valgrind demo
#ifdef SHELL
gcc $0 -g -Wall -Werror && valgrind -q ./a.out
exit 0
#endif
#include <stdio.h>
int main( int argc, char * argv [] ) {
int i;
for(; i < 10; i++ ) {
#ifdef SHELL
gcc $0 && ./a.out
gcc -m32 $0 && ./a.out
exit 0
#endif
#include <stdio.h>
void nb1() {
char * str = "999999999999";
#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]);