Skip to content

Instantly share code, notes, and snippets.

View aloisdg's full-sized avatar
🏠
Working from home

Aloïs de Gouvello aloisdg

🏠
Working from home
View GitHub Profile
@aloisdg
aloisdg / words.json
Created December 13, 2021 11:23
A list of nouns and verbs from lexique383
["exclure", "bonne", "cas", "insomnie", "accroc", "fermeture", "tonnelle", "articulation", "r\u00e8gne", "adjudant", "d\u00e9claration", "g\u00e9ographie", "instant", "forfait", "r\u00e9sumer", "dessiner", "renouer", "vitrer", "missel", "br\u00fbl\u00e9", "stabilit\u00e9", "survie", "court", "aider", "crypte", "plat", "aventure", "indiscr\u00e9tion", "exposition", "aide", "foncer", "marne", "mirette", "entraver", "madone", "amuser", "ivrogne", "autoroute", "ride", "p\u00e9tard", "clin", "rosier", "tourisme", "restriction", "recours", "traduction", "recourir", "diminuer", "nappe", "bonnet", "ficeler", "incendie", "nourrir", "charpie", "\u00e9tiquette", "distraire", "ob\u00e9issance", "graver", "sillage", "tousser", "\u00e9tranget\u00e9", "sous-entendu", "ordinaire", "mare", "embrun", "volcan", "r\u00e9ussite", "intuition", "d\u00f4me", "mazout", "vide", "consultation", "ferraille", "trap\u00e8ze", "garde-robe", "abeille", "z\u00e8le", "discr\u00e9tion", "tympan", "rayonnement", "regarder", "matou", "docker", "
@aloisdg
aloisdg / acronym.md
Created October 28, 2021 13:31
List of abbreviations used within the FOSS community, and their definitions

FOSS Community Acronyms

List of abbreviations used within the FOSS community, and their definitions.

Contributing

If you have a github account, you can click here to edit this file.

Acronyms

@aloisdg
aloisdg / ICantBelieveItCanSort.cs
Created October 5, 2021 13:40
Is this the simplest (and most surprising) sorting algorithm ever?
// https://news.ycombinator.com/item?id=28758106
// https://arxiv.org/abs/2110.01111
using System;
public class Program
{
public static void Main()
{
var n = new []{3,2,4,1};
@aloisdg
aloisdg / checker.fs
Created March 15, 2021 08:48
A script to generate checker board
let buildCell j i =
if j % 2 = 0 && i % 2 = 0 || j % 2 = 1 && i % 2 = 1
then
"0"
else
"1"
let buildRow j n =
[0 .. n]
|> List.map (fun i -> buildCell j i)
@aloisdg
aloisdg / Fibo.fs
Created March 9, 2021 13:43
Get nth fibonacci number
// Approximate value of golden ratio
let PHI = 1.6180339
let f = [ 0; 1; 1; 2; 3; 5 ]
let rec fibRec n (sum: float) t =
if t = n
then sum
else fibRec n (System.Math.Round(sum * PHI)) (t + 1)
import random
def transpose(groups):
# return list(map(list, zip(*groups)))
result = []
longest = max([len(x) for x in groups])
for index in range(longest):
sub = []
for group in groups:

Please stop using new T[0] to initialize an empty array


If you want an empty enumerable (and I know you should use one), you have Enumerable.Empty:

var a = Enumerable.Empty<T>();

If you face a case where you really need an empty array, you have Array.Empty:

Lets remove the , operator.

h2, h3 a {
  color: blue;
}

is a shortcut (with the , operator) to the following synthax:

h2 {

color: blue;

@aloisdg
aloisdg / luhn.fsx
Last active March 20, 2019 14:43
A F# implementation of Luhn's algorithm
// https://en.wikipedia.org/wiki/Luhn_algorithm
let inline charToInt (c:char) = int c - int '0'
let rec check (ccNumber:string) index sum alternate =
if index < 0 then
sum % 10 = 0
else
let n = ccNumber.[index] |> charToInt
let neoN =
@aloisdg
aloisdg / Tables.fsx
Last active November 20, 2022 23:21
Get a random element in a list in F#
type System.Random with
/// Generates an infinite sequence of random numbers within the given range.
member this.GetValues(minValue, maxValue) =
Seq.initInfinite (fun _ -> this.Next(minValue, maxValue))
member this.GetItems(items:_[]) =
Seq.initInfinite (fun _ -> items.[this.Next(0, items.Length - 1)])
let r = System.Random()