Skip to content

Instantly share code, notes, and snippets.

View u1735067's full-sized avatar

Alexandre L. u1735067

View GitHub Profile
@u1735067
u1735067 / paramiko.channel.monkey-patch.py
Last active June 17, 2021 07:32
Patch Paramiko channel.py to add channel logging (to debug SCP for example)
import paramiko
def patch_paramiko():
from paramiko.common import DEBUG
recv_ori = paramiko.channel.Channel.recv
send_ori = paramiko.channel.Channel.send
exec_command_ori = paramiko.channel.Channel.exec_command
def patched_exec_command(self, command):
self._log(DEBUG, 'Executing command: {}'.format(command))
@u1735067
u1735067 / MkBootUSB.bat
Last active June 14, 2021 12:52
Windows All-In-One bootable USB key maker script
@echo off
:: MkBootUSB
:: @author: u1735067
:: @date: 2015-07-30
:: @url: https://gist.github.com/Alex131089/0d742138b978c28a1695
setlocal enableextensions
set debug=0
:: Print some informations
@u1735067
u1735067 / imagehash.py
Last active June 14, 2021 12:52
Script to hash image content, avoiding differences in metadatas and others (--[0-9A-F]+-- tag, ..) ; relies on Pillow. Hopefully, Pillow will return the same bytes when EXIF orientation changes and when ICC profile is applied.
#!/usr/bin/env python3
''' BSD 3-Clause License — but if it was useful to you, you may tell me :)
Copyright (c) 2016, 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.
@u1735067
u1735067 / mkv-track-extractor.py
Last active June 14, 2021 12:51
Tool to extract one or many tracks from one or many mkv
#!/usr/bin/env 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
Constant Wrapper function Codec_ID Extension Extension alt. Python dict
MKV_A_AC3 xtr_base_c(new_codec_id, new_tid, tspec,"Dolby Digital (AC-3)"); A_AC3 ac3 'A_AC3': 'ac3'
MKV_A_EAC3 xtr_base_c(new_codec_id, new_tid, tspec,"Dolby Digital Plus (E-AC-3)"); A_EAC3 eac3 'A_EAC3': 'eac3'
A_MPEG/L* xtr_base_c(new_codec_id, new_tid, tspec,"MPEG-1 Audio Layer 2/3"); A_MPEG/L2 mp2 'A_MPEG/L2': 'mp2'
A_MPEG/L3 mp3 'A_MPEG/L3': 'mp3'
MKV_A_DTS xtr_base_c(new_codec_id, new_tid, tspec,"Digital Theater System (DTS)"); A_DTS dts 'A_DTS': 'dts'
MKV_A_PCM xtr_wav_c(new_codec_id, new_tid, tspec); A_PCM/INT/LIT wav 'A_PCM/INT/LIT': 'wav'
MKV_A_PCM_BE xtr_wav_c(new_codec_id, new_tid, tspec); A_PCM/INT/BIG wav 'A_PCM/INT/BIG': 'wav'
MKV_A_FLAC xtr_flac_c(new_codec_id, new_tid, tspec); A_FLAC flac ogg 'A_FLAC': 'flac'
MKV_A_ALAC xtr_alac_c(new_codec_id, new_tid, tspec); A_ALAC caf m4a 'A_ALAC': 'caf'
@u1735067
u1735067 / borg-wrappers.md
Last active June 14, 2021 12:51
Borg wrappers for server pull mode - scripts are now in project https://github.com/u1735067/bbbs.
From 412a091ab8f97a5964bc548c29ca3cfa646fcbc9 Mon Sep 17 00:00:00 2001
From: Alexandre L.
Date: Fri, 7 Nov 2014 04:28:58 +0100
Subject: [PATCH] Patch pour le C/C Gnome-style
---
config.c | 5 -----
putty.h | 3 +++
settings.c | 4 ++++
terminal.c | 15 +++++++++++++--
From 34db8a351b8fc43362bcbf0cba9e186b2c3a1b80 Mon Sep 17 00:00:00 2001
From: "Alexandre L."
Date: Tue, 7 Jul 2015 19:25:22 +0200
Subject: [PATCH] Dirty workaround
---
exportify.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/exportify.js b/exportify.js
#!/usr/bin/python
#-*- encoding: Utf-8 -*-
from hashlib import md5
from sys import argv
try:
from Crypto.Cipher import AES
except ImportError:
exit('Erreur : la bibliothèque "PyCryto" n\'est pas installée')
@u1735067
u1735067 / python_cheatsheets.txt
Created May 16, 2019 09:24
Collection of Python cheatsheet
https://docs.python.org/3/reference/index.html
https://docs.python.org/3/library/index.html
https://www.cs.put.poznan.pl/csobaniec/software/python/py-qrc.html
https://perso.limsi.fr/pointal/python:abrege
https://perso.limsi.fr/pointal/python:memento
https://perso.limsi.fr/pointal/_media/python:cours:abregepython.pdf
https://perso.limsi.fr/pointal/_media/python:cours:abregepython-english.pdf
https://perso.limsi.fr/pointal/_media/python:cours:mementopython3.pdf