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
# Part of Odoo. See LICENSE file for full copyright and licensing details.
"""
Utilities to work with partial zip files.
The zipfile library found in the python standard library only work with
full zipfile, i.e. the entire zipfile must be created/loaded in memory.
There are situations where we don't want to load the entire thing in
memory, e.g. to craft a zipfile out of many large file and to send it
over the network.
@Julien00859
Julien00859 / ciphers.csv
Last active October 30, 2025 00:35
TLS 1.2 ciphers
iana id key_exchange authentication encryption digest
TLS_NULL_WITH_NULL_NULL 0x00 None None None None
TLS_RSA_WITH_NULL_MD5 0x01 RSA RSA None MD5
TLS_RSA_WITH_NULL_SHA 0x02 RSA RSA None SHA
TLS_RSA_EXPORT_WITH_RC4_40_MD5 0x03 RSA RSA RC4_40 MD5
TLS_RSA_WITH_RC4_128_MD5 0x04 RSA RSA RC4_128 MD5
TLS_RSA_WITH_RC4_128_SHA 0x05 RSA RSA RC4_128 SHA
TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 0x06 RSA RSA RC2_CBC_40 MD5
TLS_RSA_WITH_IDEA_CBC_SHA 0x07 RSA RSA IDEA_CBC SHA
TLS_RSA_EXPORT_WITH_DES40_CBC_SHA 0x08 RSA RSA DES40_CBC SHA
#!/usr/bin/env python3
import docutils.core
import fileinput
import inspect
import sys
from docutils import nodes
from docutils.parsers.rst import roles
from docutils.parsers.rst.directives.admonitions import Note
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.md
Last active January 25, 2025 22:15
Commitstrip date/title/jpg-link database

Description

Le CTO est assit à son bureau, son chat sur les épaules, il fait passer un entretient à un candidat. L'entretient semble bien se passer jusqu'à ce que le CTO apprenne que le candidat utilise internet explorer 7 pour développer.

Transcript

CTO: Et le code HTTP 418 tu connais ?
Candidat: Oui "I'm a teapot RFC 2324"

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