Skip to content

Instantly share code, notes, and snippets.

View u1735067's full-sized avatar

Alexandre L. u1735067

View GitHub Profile
@u1735067
u1735067 / whois.py
Created June 8, 2014 16:07
WhoisResEl
#!python3
import sys
import socket
import dns.resolver
import ipaddress
import re
socket.setdefaulttimeout(1)
resolver = dns.resolver.Resolver()
resolver.timeout = 1
@u1735067
u1735067 / hid-wiimote-modules.c
Last active August 29, 2015 14:05
hid-wiimote fixed Classic Controller KeyCode
/*
* Device Modules for Nintendo Wii / Wii U HID Driver
* Copyright (c) 2011-2013 David Herrmann <dh.herrmann@gmail.com>
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
@u1735067
u1735067 / hid-wiimote-modules.c
Last active August 29, 2015 14:05
hid-wiimote fixed Classic Controller KeyCode & optimized
/*
* Device Modules for Nintendo Wii / Wii U HID Driver
* Copyright (c) 2011-2013 David Herrmann <dh.herrmann@gmail.com>
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
@u1735067
u1735067 / hid-wiimote.log
Created August 22, 2014 15:36
hid-wiimote logs
pi@raspberrypi ~/sdl2-2.0.3/SDL2-2.0.3/test $ jstest /dev/input/js1
Driver version is 2.1.0.
Joystick (Nintendo Wii Remote Classic Controller) has 8 axes (X, Y, Rx, Ry, Hat0X, Hat0Y, Hat1X, Hat1Y)
and 11 buttons (BtnX, BtnY, BtnTL, BtnTR, BtnTR2, BtnSelect, BtnStart, BtnMode, ?, (null), (null)).
Testing ... (interrupt to exit)
Axes: 0: 0 1: 0 2: 0 3: 0 4: 0 5: 0 6:-32767 7:-32767 Buttons: 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off 8:off 9:off 10:off ^C
pi@raspberrypi ~/sdl2-2.0.3/SDL2-2.0.3/test $ ./testjoystick 0
INFO: There are 1 joysticks attached
INFO: Joystick 0: Nintendo Wii Remote Classic Controller
@u1735067
u1735067 / rak.py
Last active August 29, 2015 14:19
Botanik - rak.py
#!/usr/bin/env python3
import urllib.request, json
from datetime import datetime, timedelta, date, time
url='http://resel.fr/services/rak/menu.json'
error = "Désolé, le RAK n'a pas publié le menu ou il s'est produit une erreur :("
prefix = 'Au menu du RAK'
next = 'suivi de'
@u1735067
u1735067 / ldapimport_mod_resel.rb
Last active September 17, 2015 18:40
LDAP import & enforce script
# https://www.redmine.org/issues/1838
# https://www.redmine.org/boards/2/topics/34545
require File.expand_path('../../config/environment', __FILE__)
class AuthSourceLdap
def get_logins_filter(filter)
list = Set.new()
ldap_con = initialize_ldap_con(self.account, self.account_password)
search_filter = filter
ldap_con.search(
@u1735067
u1735067 / cacert-add.sh
Created October 12, 2015 18:16
CACert add script for Alpine
#!/bin/sh
# Cannot be a subdir (at least on Alpine)
cert_dir=/usr/local/share/ca-certificates/
cert_1=http://www.cacert.org/certs/root.crt
hash_1=3ecd6f84706512923d62fcd0340fb85c92f4d7067b66ef20d4ac41d9cabf3ff30173f1af0f3cbd6a8ce4222b9132df559fca8108b6c9ba527f93db9078d85119
cert_2=http://www.cacert.org/certs/class3.crt
hash_2=a141608eb73a065b6aa4595bd23572621e359332bb99f8cb79aafaeb82e076b4f4c697e80fbc80a8c7e456520a7bba21a637e1523229340989905c3072b1cda5
nb=2
@u1735067
u1735067 / gentcviz.sh
Created December 4, 2015 16:53
Modop'/script pour la génération de visualisation de TC.
mkdir tcviz && cd tcviz
git clone https://github.com/ze-phyr-us/tcviz.git .
for i in 0.990 994; do
tc qdisc show dev eth$i > qdisc.$i
tc class show dev eth$i > qdisc.$i
tc filter show dev eth$i > filter.$i
./tcviz.py qdisc.$i class.$i filter.$i | dot -Tsvg -o $1.svg
done
# Pour le dernier pipe, on peut aussi C/C l'output de TCViz sur un autre serveur, genre cyric, pour y faire le rendu (ce que j'ai fait, surtout que graphviz n'est pas sur loli)
@u1735067
u1735067 / marge.py
Last active January 11, 2016 09:01
Script de calcul de marge pour CO32B1 en Python
#!python3
#
# Alexandre Levavasseur - FIP16
# Pour le groupe projet CO32B1
#
# This work is licensed under a Creative Commons
# Attribution-NonCommercial-ShareAlike 4.0 International License
#
# Sources:
# https://docs.python.org/3/library/csv.html
@u1735067
u1735067 / importArango.py
Created January 20, 2016 00:33
ArangoDB : test d'import (unitaire et en masse, beaucoup plus rapide)
#!python3
import sys, glob, os, re, datetime, time, json
import traceback
import arango
from arango import Arango
client = Arango(host="localhost", port=8529)
db = client.db('jeu')
types = ['combinaisons', 'masse-enjeu', 'participants', 'rapports-definitifs', 'courses', 'tirelire', 'reunion', 'pronostics-detailles', 'performances-detaillees']