Skip to content

Instantly share code, notes, and snippets.

View Julien00859's full-sized avatar
😴
425 - Too Early

Julien Castiaux (juc) Julien00859

😴
425 - Too Early
View GitHub Profile
"""
Overpopulation: if a living cell is surrounded by more than three living cells, it dies.
Stasis: if a living cell is surrounded by two or three living cells, it survives.
Underpopulation: if a living cell is surrounded by fewer than two living cells, it dies.
Reproduction: if a dead cell is surrounded by exactly three cells, it becomes a live cell.
"""
from curses import wrapper, curs_set
from math import sqrt
from numpy import array, int8, ndenumerate
@Julien00859
Julien00859 / .gitignore
Last active February 6, 2019 08:30
Sorting algos
error.json
__pycache__/
@Julien00859
Julien00859 / .gitignore
Last active November 12, 2018 00:36
unamur_regexp
*.pyc
__pycache__
@Julien00859
Julien00859 / oxo.py
Last active January 16, 2019 01:01
OXO written in python
#!/usr/bin/env python3
from collections.abc import MutableSequence
from itertools import zip_longest, chain
from io import StringIO
from sys import argv
def inputint(prompt="", lower_bound=None, upper_bound=None):
while True:
from itertools import product, chain, starmap
SURFACE = 0b01
SIDE = 0b10
def square(x, y, radius, min_x, min_y, max_x, max_y, mode):
"""
Coordinates in/on the square center: (x, y), side length: 2 * radius
:param x: The center abscissa
:param y: The center ordinate
"""
Simple infix mathematic expression calculator
Author: Julien Castiaux (github.com/Julien00859)
Licence: MIT
"""
from operator import add, sub, mul, truediv, mod
def shuntingyard(expr):
"""Convert infix expression to postfix"""
import re
from base64 import b64encode
specialsre = re.compile(r'[][\\()<>@,:;".]')
escapesre = re.compile(r'[\\"]')
def formataddr(pair):
"""Takes a 2-tuple of the form (realname, email_address) and returns
the string value suitable for an RFC 2822 From, To or Cc header.
@Julien00859
Julien00859 / README.md
Last active April 21, 2020 14:01
Odoo fontawesome v4 to v5 automatic file transcripter

Fontawesome v4 to v5

Applicable to Odoo XML and JS files. See LICENSE file on for full copyright and licensing details.

The script was applied to the entire odoo codebase and was able to automatically convert most icons in a few seconds.

Warning

from collections import deque
from itertools import cycle, chain, zip_longest
from pprint import pprint
from random import random, randint, sample, shuffle
class Sudoku:
def __init__(self, grid):
self.grid = grid
@Julien00859
Julien00859 / .gitignore
Last active February 16, 2021 22:11
Parse memory and time value as int
__pycache__/
build/
dist/
*.egg-info/
*.pyc/