Skip to content

Instantly share code, notes, and snippets.

View entwanne's full-sized avatar

Antoine Rozo entwanne

View GitHub Profile
@entwanne
entwanne / archive_list_images.py
Last active August 2, 2022 15:17
ZdS clean gallery
#!/usr/bin/env python
import json
import re
import sys
from zipfile import ZipFile
img_regex = re.compile(rb'!\[[^\]]*\]\(([^)]+)\)')
@entwanne
entwanne / battle.py
Created September 29, 2021 09:56
Un zeste de Python — Programme à déboguer
import json
def input_choice(prompt, choices):
value = None
prompt += '(' + '/'.join(choices) + ') '
while value not in choices:
print('Valeur invalide')
value = input(prompt)
return value
@entwanne
entwanne / tasks.py
Created July 31, 2018 09:33
Celery warm shutdown solo taskpool
import asyncio
import time
from celery import Celery
app = Celery('tasks')
class TaskBackend:
#!/usr/bin/env python
import itertools
import random
from collections import Counter
from enum import IntEnum
card_ranks = range(2, 15)
card_colors = '♠♥♦♣'
cards = list(itertools.product(card_ranks, card_colors))
#!/usr/bin/env python2
from glob import glob
#logins = glob('*.jpg')
#logins.sort()
#print '\n'.join(["'%s' : ''," % l.replace('.jpg', '') for l in logins])
logins = {
'arambu_b' : 'benjamin',
@entwanne
entwanne / gist:42050b38a35597f21601
Created April 25, 2015 13:51
Python tail-recursive
class tail_rec:
inside = False
def __init__(self, func):
self.func = func
def __call__(self, *args, **kwargs):
if tail_rec.inside:
self.args = args
self.kwargs = kwargs