Skip to content

Instantly share code, notes, and snippets.

@ThomasChiroux
ThomasChiroux / proton
Created March 3, 2017 16:07
protonvpn connector
#!/bin/env python
# connect to proton mail
import argparse
import random
import subprocess
import time
zones = {
'ch': [
@ThomasChiroux
ThomasChiroux / gist:c4701f4b7a9c9695db2b
Created February 3, 2015 18:25
test bt socket python 2
case BTPROTO_HCI:
{
struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret;
#if defined(__NetBSD__) || defined(__DragonFly__)
char *straddr = PyBytes_AS_STRING(args);
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
if (straddr == NULL) {
PyErr_SetString(PyExc_OSError, "getsockaddrarg: "
"wrong format");
@ThomasChiroux
ThomasChiroux / gist:f888e307929509913d07
Last active August 29, 2015 14:14
test python socket bluetooth
case BTPROTO_HCI:
{
struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret;
#if defined(__NetBSD__) || defined(__DragonFly__)
char *straddr = PyBytes_AS_STRING(args);
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
if (straddr == NULL) {
PyErr_SetString(PyExc_OSError, "getsockaddrarg: "
"wrong format");
#!/usr/bin/env python
"""walk into the current directory and subdirs, looks for hg repos, checks
local and remote status and report into
"""
import os
import subprocess
max_depth = 2
@ThomasChiroux
ThomasChiroux / version.py
Created September 27, 2012 13:08
get git current version on a repo (last tag and rev number)
# -*- coding: utf-8 -*-
# Author: Douglas Creager <dcreager@dcreager.net>
# This file is placed into the public domain.
# Calculates the current version number. If possible, this is the
# output of “git describe”, modified to conform to the versioning
# scheme that setuptools uses. If “git describe” returns an error
# (most likely because we're in an unpacked copy of a release tarball,
# rather than in a git working copy), then we fall back on reading the
# contents of the RELEASE-VERSION file.
@ThomasChiroux
ThomasChiroux / httpserve.py
Created September 26, 2012 09:11
python2 and python3 compliant simple http server
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""launch small http server
"""
import sys
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
@ThomasChiroux
ThomasChiroux / version.py
Last active November 22, 2021 11:50
get mercurial (hg) current version on a repo (last tag and rev number)
# -*- coding: utf-8 -*-
"""get version number from dvcs
"""
from subprocess import Popen, PIPE
def get_hg_version():
"""uses mercurial to get last tag and last revision number