{{ message }}

Instantly share code, notes, and snippets.

# Thomas Chaumenytchaumeny

• Paris, France
Last active Feb 17, 2017
Converting amount of money (including cents) to words using num2words
View money_amount_words.py
 from num2words import num2words def money_amount_words(amount, units='euros', cents='centimes', lang='fr'): """ Returns an iterator over the words describing the given amount Args: amount: decimal.Decimal, the amount of money units: str, the currency units
Last active May 24, 2020
Polynomial type in Python
View polynomial.py
 # See https://lipsum.dev/2020-05-1-pourquoi-les-polynomes/ from numbers import Number class Polynomial: def __init__(self, *coefficients): self.degree = -1 self.coefficients = tuple(coefficients) for i, coef in enumerate(self.coefficients): if coef != 0:
Last active Oct 10, 2020
View RotatingCube.js
 // RotatingCube React component, used in https://lipsum.dev/2020-09-1-rotations/ import * as BABYLON from 'babylonjs' import * as GUI from 'babylonjs-gui' import React, { useEffect, useRef, useState } from 'react' const canvasWidth = 500; const canvasHeight = 300; function initScene(canvas, rotationCb) { const engine = new BABYLON.Engine(canvas);
Last active Dec 24, 2020
View AoC24.py
 from cmath import e, pi from collections import Counter import fileinput def tokenize(s): prev = None for i, c in enumerate(s): if prev is None: if c in ('s', 'n'): prev = c
You can’t perform that action at this time.