Skip to content

Instantly share code, notes, and snippets.


Jérôme Carretero zougloub

View GitHub Profile
zougloub / argh.cpp
Created Jun 5, 2018
When you have too many warnings in a piece of code and then track down a corruption issue...
View argh.cpp
#include <cstdio>
class C {
C() {
printf("%s this=%p\n", __func__, this);
~C() {
printf("%s this=%p\n", __func__, this);
zougloub /
Last active May 21, 2018
RAM usage script
#!/usr/bin/env python
# -*- coding: utf-8 vi:noet
# Measure RAM usage by a process (and its children) on Linux
import sys, io, os, logging, subprocess, time
def ram_usage(pid, depth=0):
pss = 0
logging.debug("%s Checking %d", " " * depth, pid)
#!/usr/bin/env python
# -*- coding: utf-8 vi:noet
# Characterization test for SMR drives
import sys, os, subprocess, time, mmap
if __name__ == "__main__":
device = sys.argv[1]
zougloub /
Last active Jun 12, 2021
Tiny DVR for RTSP/H264 cameras
#!/usr/bin/env python
# -*- coding:utf-8 vi:noet
# RTSP/H264 simple camera DVR
__author__ = "Jérôme Carretero <>"
__license__ = "MIT"
import sys, io, os, re, time, datetime
import gi
zougloub / README.rst
Last active Apr 6, 2017
QR code abuse: when the code is decoded by a computer, we can pervert it by adding moar extra data in chroma...
View README.rst

QR Code Abuse


QR code with additional data in grey level.

#!/usr/bin/env python
# -*- coding: utf-8 vi:noet
# Example of data source using subprocess, python 2 & 3 compatible
This illustrates in a short example, a solution to a few caveats:
- read() that can hang if the subprocess closes
- select() that knows nothing about the subprocess closing
# Create a big file (sparse)
truncate --size=100G huge.bin
# check the stuff to make sure it's not a virus
cat *.py *.sh
# Run this in one terminal
# Run this in another
zougloub / gist:f3656a7ba4abe65f1fe2270cd2f8efc6
Last active Nov 10, 2016
Fedora 25 install on machine w/ SAS - Fedora-Server-dvd-x86_64-25-20161108.n.1.iso
View gist:f3656a7ba4abe65f1fe2270cd2f8efc6
Traceback (most recent call last):
File "/usr/lib64/python3.5/site-packages/pyanaconda/", line 251, in run, *args, **kwargs)
File "/usr/lib64/python3.5/", line 862, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.5/site-packages/blivet/", line 1175, in storage_initialize
File "/usr/lib/python3.5/site-packages/blivet/", line 45, in run_with_lock
return m(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/blivet/", line 273, in reset
#!/usr/bin/env python
# -*- coding: utf-8 vi:noet
# Thermoco reader
import subprocess
class Thermoco(object):
def __init__(self, mac):
self._mac = mac
zougloub /
Last active Nov 12, 2016
Simple H100i GTX controller script - puzzle du jour
#!/usr/bin/env python
# -*- coding: utf-8 vi:noet
# Corsair H100i GTX driver
import struct, time, binascii, sys, io
import usb
import scipy.interpolate
(0x1b1c, 0x0c03), # H100i GTX