Skip to content

Instantly share code, notes, and snippets.

🐍
🐍

Julien Palard JulienPalard

Block or report user

Report or block JulienPalard

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
View gist:442504706e0c91380236e334e9fc21e5
### Keybase proof
I hereby claim:
* I am julienpalard on github.
* I am julienpalard (https://keybase.io/julienpalard) on keybase.
* I have a public key ASC7dVPPYwLtCqT2bOTWWE-JgQ40WPTZCTkgFS4JEZqm1wo
To claim this, I am signing this object:
@JulienPalard
JulienPalard / find_in_po.py
Created Oct 5, 2018
Find a word in msgids, show msgstrs.
View find_in_po.py
#!/usr/bin/env python3
import argparse
from glob import glob
import os
from textwrap import fill
import regex
import polib
from tabulate import tabulate
@JulienPalard
JulienPalard / python-build.20180623214511.15791.log
Last active Jun 23, 2018
./bin/pyenv install 3.7.0rc1 failing
View python-build.20180623214511.15791.log
/tmp/python-build.20180623214511.15791 ~/.pyenv
/tmp/python-build.20180623214511.15791/Python-3.7.0rc1 /tmp/python-build.20180623214511.15791 ~/.pyenv
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
@JulienPalard
JulienPalard / backup.py
Last active Jul 11, 2018
Backup UBNT edgeswitch over SSH
View backup.py
"""Usage: ./backup.py login@host
"""
import sys
import pexpect
import getpass
child = pexpect.spawn('ssh ' + sys.argv[1])
while True:
match = child.expect(['password:', '\(.*\) >'])
View uri_multi_expand.py
#!/usr/bin/env python3
import itertools
from uritemplate import URITemplate
def dict_product(a_dict):
"""Iterate over the product of all values of the given dict.
>>> for d in dict_product({'foo': [1, 2], 'bar': [1, 2]}):
@JulienPalard
JulienPalard / asynczip.py
Created Apr 2, 2016
Aggregation of asynchronous iterables
View asynczip.py
import asyncio
SOON = 'SOON'
PAIRED = 'PAIRED'
class AsyncZip:
"""Aggregates async iterables, like `zip` or `select`.
The current state is stored in `self.iterating` as the `__anext__()`
@JulienPalard
JulienPalard / mail-parse.py
Created Feb 16, 2016
Not-so-good example of mail header / body parsing
View mail-parse.py
import os
import re
import sys
from email.parser import Parser
from email.header import decode_header
import logging
logger = logging.getLogger(__name__)
@JulienPalard
JulienPalard / curry.py
Created Aug 1, 2014
KISS Python curry
View curry.py
#!/usr/bin/env python
def curry(func):
"""
Decorator to curry a function, typical usage:
>>> @curry
... def foo(a, b, c):
... return a + b + c
You can’t perform that action at this time.