Skip to content

Instantly share code, notes, and snippets.

Alexandre L. Alex131089

Block or report user

Report or block Alex131089

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Alex131089 /
Last active Jan 14, 2020
Patch Paramiko to add channel logging (to debug SCP for example)
diff --git a/ b/
index 41b1895..2766b94 100644
--- a/
+++ b/
@@ -187,6 +187,9 @@ class Channel(ClosingContextManager):
`.SSHException` -- if the request was rejected or the channel was
+ self._log(DEBUG, 'Requesting PTY (termtype={}, width={}, heigth={}, width_pixel={}, heigth_pixel={})'.format(
+ term, width, height, width_pixels, height_pixels
Alex131089 / extract-android-tabs.bat
Created Jan 5, 2020
Script to extract opened tabs from Android (Chromium-based browsers)
View extract-android-tabs.bat
@echo off
echo Waiting for device ..
Z:\Dev\Android\adb.exe wait-for-device
echo Connected to device, open Chrome and wait a bit
Z:\Dev\Android\adb.exe forward tcp:9222 localabstract:chrome_devtools_remote
chcp 65001 > nul
Z:\Utils\curl.exe -s | Z:\Utils\jq.exe -r "sort_by(.id) | .[] | ""-" [\(if (.title ^| length) ^> 0 then .title ^| gsub(""^'""";"""'""")" else .url end)](\(.url))"""
Z:\Dev\Android\adb.exe kill-server
Alex131089 / 01-php-fpm_source_handler.conf
Created Nov 28, 2019
Apache 2.4 conf to display .phps (or any file type marked with handler `application/x-httpd-php-source`) as highlighted, like with mod_php. Thanks VBart for the original nginx idea (Apache is a bit more tricky ..). There's 2 files.
View 01-php-fpm_source_handler.conf
### PHP-FPM Source (.phps) type handler ; conditions are taken from CentOS8 php.conf
<IfModule !mod_php5.c>
<IfModule !mod_php7.c>
<Directory "/real/path/to/">
Require all granted
<If "%{REQUEST_URI} == '/php-fpm/highlight.php'">
Redirect 404
Alex131089 /
Last active Oct 20, 2019
Workaround to convert simple tar backup to borg backup, without leading path, using ratarmount (should works with archivemount too) and mergerfs
mkdir -p /chroot_tmp/{logs,mnt,archive_mnt,bins_mnt/dev,bins_mnt/lib,bins_mnt/lib64,bins_mnt/tmp/repo}
cd /chroot_tmp
wget -O /bins_mnt/tmp/borg
chmod +x /chroot_tmp/bins_mnt/tmp/borg
wget -O /bins_mnt/tmp/busybox
chmod +x /chroot_tmp/bins_mnt/tmp/busybox
wget -O
wget -o
Alex131089 /
Created Sep 18, 2019
Chardet ( automatic open (from CLI example)
from chardet.universaldetector import UniversalDetector
def open_chardet(file, *args, **kwargs):
detector = UniversalDetector()
with open(file, mode='rb') as fh:
for line in fh:
line = bytearray(line)
if detector.done:
Alex131089 / Vagrantfile
Last active Nov 4, 2019
CentOS + Cockpit + Docker + Portainer
View Vagrantfile
Vagrant.configure("2") do |config|
# rundll32 sysdm.cpl,EditEnvironmentVariables
#config.vm.box_check_update = false = "centos/7"
config.vm.provider "virtualbox" do |vb|
#vb.cpus = 2
vb.memory = "768"
vb.default_nic_type = "virtio"
Alex131089 / keybindings.json
Last active Jul 11, 2019
VS Code: move line to the right buffer / editor / group
View keybindings.json
"key": "ctrl+alt+right",
"command": "-workbench.action.moveEditorToNextGroup"
"key": "ctrl+alt+right",
"command": "multiCommand.moveLineRightGroup"
rename_node() {
RABBITMQ_NODENAME=$1 rabbitmqctl rename_cluster_node $1 $2 && (
mv /var/lib/rabbitmq/mnesia/$1 /var/lib/rabbitmq/mnesia/$2
mv /var/lib/rabbitmq/mnesia/$1-plugins-expand /var/lib/rabbitmq/mnesia/$2-plugins-expand
mv /var/lib/rabbitmq/mnesia/$1-rename /var/lib/rabbitmq/mnesia/$2-rename
mv /var/lib/rabbitmq/mnesia/$ /var/lib/rabbitmq/mnesia/$
rename_node old@node new@localhost
Alex131089 / python_cheatsheets.txt
Created May 16, 2019
Collection of Python cheatsheet
View python_cheatsheets.txt
Alex131089 /
Created Apr 24, 2019
Abandoned Python PATH editor script ; `rundll32 sysdm.cpl,EditEnvironmentVariables` is simpler to use and takes care of the ENV refresh
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
from collections import OrderedDict
import configparser
import pathlib
import json
import requests
You can’t perform that action at this time.