Skip to content

Instantly share code, notes, and snippets.

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

Julien Castiaux Julien00859

😴
425 - Too Early
View GitHub Profile
class TicTacToe:
def __init__(self, first_player="x"):
self.board = [[" " for _ in range(3)] for _ in range(3)]
self.player = first_player
self._turns = []
@property
def other_player(self):
return {"x": "y", "y": "x"}[self.player]
@Julien00859
Julien00859 / pyproject.toml
Last active August 4, 2023 23:27
pyproject sample
# src-layout
# replace the many <module>!
[build-system]
requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"
[project]
name = "<module>"
version = "0.0.1"
@Julien00859
Julien00859 / commitstrip.csv
Last active March 27, 2023 18:53
Commitstrip date/title/jpg-link database
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 1 column, instead of 2 in line 4.
date;title-en;title-fr;title-alt;link-en;link-fr
2012/02/22;Interview;Entretien… la Debug quoi ?;1sur4 Entretien;/2012/02/Strip-1sur4-interview-800-final1.jpg;/2012/02/Strip-1sur4-Entretien-800-final2.jpg
2012/02/23;Interview…harder than it seems;Entretien… Même Yahoo ça serait passé. Mais pas ça.;2sur4 entretien;/2012/02/Strips-2sur4-interview-800-final1.jpg;/2012/02/Strips-2sur4-entretien-800-final2.jpg
2012/02/24;Interview…almost!;Entretien…presque !;3sur4 entretiens;/2012/02/Strip-3sur4-interview-800-final--1024x321.jpg;/2012/02/Strip-3sur4-entretiens-800-final-1.jpg
2012/02/27;Interview…Let there be light, and there was light!;Entretien…et la lumière fut;4sur4 entretien;/2012/02/Strip-4sur4-interview-800-final.jpg;/2012/02/Strip-4sur4-entretien-800-final.jpg
2012/02/29;First meeting;Première rencontre;Rencontre PM;/2012/02/Meeting-PM-800-final3.jpg;/2012/02/Rencontre-PM-800-final1.jpg
2012/03/01;“Artistic” meeting!;Rencontre « artistique » !;Rencontre DA;/2012/03/Meeting-DA-800-final.jpg;/2012/02/Rencont
@Julien00859
Julien00859 / deemaze_large.txt
Created January 15, 2023 02:33
Deepmaze visualizer
#a# #b# #c#
################################# ### ###
################################### ### ##################
### ### ### ####################
### \\\\################# ### ### ### ###
### ////################# ### ### ### ###
### +----------###-+ ### ### +-###----------+ ###
l############## c | ### ### ##### a ####### #####d
###############l | ### ### ######l d###### #######
| | ### ### ### | | ###
# Using those electronic building blocs:
#
# NOT GATE NAND GATE NOR GATE
#
# GNR GNR GNR
# a------< a------< a------< |
# POW-ww-+-c b------< b------(-<
# POW-ww-+--c POW-ww-+-+--c
#
# We define "and" and "or":
@Julien00859
Julien00859 / odoo_controller.py
Last active January 8, 2021 10:55
Using wsgi, keep the worker alive after the request was fully sent
# Courtesy of JKE
from odoo import http
from functools import partial
from contextlib import closing
import datetime
import time
class JucController(http.Controller):
@Julien00859
Julien00859 / passlib.py
Last active August 31, 2020 16:15
Password hardening mini lib
import secrets
import hashlib
def harden_pwd(pwd: str, version=1) -> bytes:
# scrypt n factor should be at least 2<<15 for interfactive usage,
# oddly enough, a n value higher than 2<<13 doesn't work on my machine
# https://blog.filippo.io/the-scrypt-parameters/
if version == 1:
salt = secrets.token_urlsafe(16).encode() # so there is no $ symbol
hardened = hashlib.scrypt(pwd.encode(), salt=salt, n=2<<13, r=8, p=1)
@Julien00859
Julien00859 / .gitignore
Last active February 16, 2021 22:11
Parse memory and time value as int
__pycache__/
build/
dist/
*.egg-info/
*.pyc/
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 / 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