Skip to content

Instantly share code, notes, and snippets.

View u1735067's full-sized avatar

Alexandre L. u1735067

View GitHub Profile
@u1735067
u1735067 / atlas_dns-geo-analysis.py
Last active July 23, 2016 03:57
RIPE Atlas : script to analyse geolocation of returned servers, based on probe's geolocation (or vice-versa)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# pip3 install requests dnslib geoip2 geonamescache
#
import sys, os, base64
import geoip2.database, geonamescache, geonamescache.mappers
import requests, dnslib
#import urllib.request, dns, dns.message
from pprint import pprint
@u1735067
u1735067 / gptbin_reader.py
Last active February 9, 2023 16:23
Python gpt.bin decoder (gpt.bin for Xiaomi MiPad2, but probably for other plateforms too) ; you'll want https://gist.github.com/u1735067/b3a23c9461e95433387f285f6e0860ca
#!python3
''' BSD 3-Clause License — but if it was useful to you, you may tell me :)
Copyright (c) 2016-2017, Alexandre Levavasseur
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
@u1735067
u1735067 / guids.py
Last active April 2, 2025 07:22
GPT GUID List (manually constructed from different sources)
#!python3
from uuid import UUID
from datetime import date
# https://github.com/d-fence/frit/blob/master/frit/fritutils/fsprobe.py
# https://gist.github.com/sque/dc7a057e66371717e921
# https://en.wikipedia.org/wiki/GUID_Partition_Table
# https://github.com/n0fate/raw/blob/master/gpt_parser.py
# https://sourceforge.net/u/guikcd93/gptfdisk/ci/master/tree/parttypes.cc#l179
@u1735067
u1735067 / fsck.aufs
Last active July 29, 2016 15:04
AUFS fsck based on fsck.mergerfs
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Based on https://github.com/trapexit/mergerfs-tools/blob/master/src/fsck.mergerfs
# © 2016, Antonio SJ Musumeci <[email protected]>
# © 2016, Alexandre Levavasseur <[email protected]>
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
@u1735067
u1735067 / mounts.py
Created February 23, 2016 21:15
Simple mount parser (modified)
"""Produce a table of mounted file systems on UNIX. Tested on Solaris 2.6,
Redhat Linux 6.2 and HP-UX 10.20.
Copyright 2001 WideAwake Ltd.
Permission is granted to use or modify this code for any purpose.
WideAwake Ltd accepts no liability for any loss or damage caused by use of
this code."""
# Found at http://www.gossamer-threads.com/lists/python/python/25546
import os
@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']
@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 / 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 / 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 / gist:d2b28966009d70a70928
Created September 18, 2015 21:29
TASK ERROR: clone failed: lvcreate 'vms/pve-vm-119' error: Failed to activate new LV.
root@camille:/etc/pve# lvcreate -L 16M -n vm-119-disk-1 vms
device-mapper: create ioctl on vms-vm--119--disk--1 failed: Device or resource busy
Failed to activate new LV.
root@camille:/etc/pve#
==> http://setaoffice.com/2015/03/25/device-mapper-create-ioctl-failed-device-or-resource-busy/
root@camille:/etc/pve#
root@camille:/etc/pve# dmsetup
Usage: