Skip to content

Instantly share code, notes, and snippets.

View BoboTiG's full-sized avatar
🐍
Charmeur de serpents

Mickaël Schoentgen BoboTiG

🐍
Charmeur de serpents
View GitHub Profile
@BoboTiG
BoboTiG / t.spec
Created October 3, 2020 14:56
Sample PyInstaller spec file for PyQt5.QtWebEngineWidgets
# -*- mode: python -*-
# coding: utf-8
import io
import os
import os.path
import re
import sys
@BoboTiG
BoboTiG / bench-xml-parser.py
Created May 6, 2020 18:50
[Python] XML parser benchmark
"""
http://www.tiger-222.fr/index.php?d=2020/05/03/12/59/13
"""
import xml.etree.ElementTree as ET
import xml.sax
import xml.sax.handler
from datetime import timedelta
from time import monotonic
from typing import Any, Dict, Generator
# -*- mode: python -*-
block_cipher = None
icon = '/Applications/Calculator.app/Contents/Resources/AppIcon.icns' # Eventually change me
a = Analysis(['systray.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
from PyQt5.QtCore import QDir, Qt, QTimer
from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtWidgets import (QApplication, QCheckBox, QFileDialog, QGridLayout,
QGroupBox, QHBoxLayout, QLabel, QPushButton, QSizePolicy, QSpinBox,
QVBoxLayout, QWidget, QSystemTrayIcon)
class Screenshot(QWidget):
def __init__(self):
super(Screenshot, self).__init__()
# coding: utf-8
from __future__ import print_function
import time
import numpy
from PIL import Image
import mss
@BoboTiG
BoboTiG / get_change_summary.py
Last active January 25, 2018 08:38
Concurrent calls to NuxeoDrive.GetChangeSummary.
# coding: utf-8
"""
Requires Python 3 and the Python client >= 2.0.0.
Usage:
python get_change_summary.py --users=30
"""
import argparse
import sys
import time
@BoboTiG
BoboTiG / benchmark_validus.py
Created December 19, 2017 20:51
Simple and naive benchmark for the PR
from timeit import Timer
setup = """
def func_orig(value):
return True if len(value) > 0 else False
def func_new(value):
return value != ''
"""
from skimage import color, img_as_float
from PIL import Image
import numpy as np
import datetime
import pyautogui
from mss import mss
counter = 0
redCarSide = 0
blueCarSide = 1
@BoboTiG
BoboTiG / deploy_jenkins_slave_python.ps1
Created February 9, 2017 17:44
Install a custom version of Python within the Jenkins current WORKSPACE.
# Usage: powershell ".\deploy_jenkins_slave_python.ps1"
# Stop the execution on the first error
$ErrorActionPreference = "Stop"
# Ensure we have a working WORKSPACE and a defined Python version
if (-Not ($Env:PYTHON_VERSION)) {
echo "PYTHON_VERSION not defined. Aborting."
exit 1
} elseif (-Not ($Env:WORKSPACE)) {
@BoboTiG
BoboTiG / hfs-disable-journal.c
Created August 5, 2016 16:24
Disable HFS+ journal
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
/*
* Disable HFS+ journal.
*