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
@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

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.
"""
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"""
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
@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:
@Julien00859
Julien00859 / .gitignore
Last active November 12, 2018 00:36
unamur_regexp
*.pyc
__pycache__
@Julien00859
Julien00859 / .gitignore
Last active February 6, 2019 08:30
Sorting algos
error.json
__pycache__/
"""
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 / chain.py
Last active July 24, 2018 15:07
Python wrapper around builtin functions and itertools to chain functions from left to right
"""Wrapper around builtins and itertools to chain calls"""
from itertools import *
from functools import reduce
class Chain:
def __init__(self, data):
self._data = data
# Chain methods
#!/bin/bash
if [ -z $(which python3) ]; then
echo "Please install python3"
exit 1
fi
if [ -z $(which virtualenv) ]; then
echo "Please install python-virtualenv"
exit 1