Skip to content

Instantly share code, notes, and snippets.

View guillaumerose's full-sized avatar

Guillaume Rose guillaumerose

  • Apple
  • Paris
View GitHub Profile
require "rubygems"
require "mechanize"
agent = Mechanize.new
page = agent.get "https://cas.it-sudparis.eu/cas/login?service=http://si-etudiants.it-sudparis.eu/opdotnet/noyau/SSO/cas.aspx"
session = page.body.match(/jsessionid\=(.*?)\?service/)[1]
lt = page.body.match(/name\=\"lt\" value=\"(.*?)\"/)[1]
@guillaumerose
guillaumerose / netfilter-queue
Created April 7, 2011 09:00
Working with netfilter and libnetfilter-queue
TP 3: Working with netfilter and libnetfilter-queue
The objective of this TP is to work with netfilter kernel module creation and user-space processing of queued packets using libnetfilter-queue.
Important: The result of this TP should be sent to: [email protected] or [email protected] with TP3-yourname as a subject.
If you don't finish on time, consider it as a homework and send it before Friday April 15 at 8:00PM.
Context:
--------
Whenever the host receives an incomming ssh connection (on port 22), the module drops the packet.
@guillaumerose
guillaumerose / netfilter.c
Created April 7, 2011 09:17
Premier exercice
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <linux/types.h>
#include <linux/netfilter.h> /* for NF_ACCEPT */
#include <linux/ip.h>
#include <linux/tcp.h>
@guillaumerose
guillaumerose / filtre.c
Created April 7, 2011 10:23
Deuxieme exercice
#include <linux/module.h> //these are for every module
#include <linux/kernel.h>
#include <linux/types.h> //u_int && co
#include <linux/skbuff.h> //struct sk_buff
#include <linux/in.h> //basic internet shiat
#include <linux/ip.h> //protocol headers
#include <linux/tcp.h>
#include <linux/netfilter.h> //need this for register_
#include <linux/netfilter_ipv4.h> //..
@guillaumerose
guillaumerose / gist:1133955
Created August 9, 2011 12:48
dhcp.feature
# language: fr
Fonctionnalité: DHCP
Afin de distribuer des IPs
En tant qu'API appelée par le serveur DHCP
Je souhaite pouvoir répondre à celui-ci
Scénario: Répondre correctement
Soit un adhérent ayant la chambre 1005
Et une date de départ dans 1 an
Et un ordinateur avec pour mac 00-11-22-33-44-55
module Backend
class DHCP < Sinatra::Base
get '/options' do
content_type "application/json"
ordinateur = Ordinateur.where(:mac => params["mac"].try(:gsub, ":", "-")).limit(1).first
return '{}' if ordinateur.nil? || ordinateur.desactive?
ordinateur.vu!
@guillaumerose
guillaumerose / func.coffee
Created February 28, 2012 17:44
CoffeeScript + Rhino
hello = (name) ->
print "Hello #{name} !"
hello "Java"
@guillaumerose
guillaumerose / gist:7338869
Created November 6, 2013 16:08
Ordre d'arrivée différent, pourtant 1 seul thread coté client.
Serveur =
2013-11-06 16:56:43.127 HTTPElevator http://0.0.0.0:9292/reset?cause=Connexion+refus%C3%A9e
2013-11-06 16:56:44.126 HTTPElevator http://0.0.0.0:9292/call?atFloor=0&to=UP
2013-11-06 16:56:44.143 HTTPElevator http://0.0.0.0:9292/nextCommand UP
2013-11-06 16:56:45.126 HTTPElevator http://0.0.0.0:9292/call?atFloor=3&to=UP
2013-11-06 16:56:45.139 HTTPElevator http://0.0.0.0:9292/nextCommand UP
Client, premier essai =
127.0.0.1 - - [06/Nov/2013 16:56:43] "GET /reset?cause=Connexion+refus%C3%A9e HTTP/1.1" 200 - 0.0190
127.0.0.1 - - [06/Nov/2013 16:56:44] "GET /nextCommand HTTP/1.1" 200 2 0.0027
@guillaumerose
guillaumerose / keybase.md
Created February 25, 2015 16:49
keybase.md

Keybase proof

I hereby claim:

  • I am guillaumerose on github.
  • I am guillaumerose (https://keybase.io/guillaumerose) on keybase.
  • I have a public key whose fingerprint is 4C92 A833 9C48 C34E D917 7017 4FAB 23B1 A548 D15C

To claim this, I am signing this object:

@guillaumerose
guillaumerose / convert.sh
Created July 21, 2016 11:29
Agrégation des fichiers de la BD Alti de l'IGN. Reprojection en WGS84
find . -iname "*.asc" -exec gdal_translate -a_nodata none -a_srs EPSG:2154 {} {}.tif \;
gdal_merge.py -o france.tif *.tif
gdalwarp -overwrite -s_srs EPSG:2154 -t_srs EPSG:4326 france.tif france.wgs84.tif
gdal_translate -of AAIGrid -ot Int32 france.wgs84.tif france.asc