Skip to content

Instantly share code, notes, and snippets.

View xoolive's full-sized avatar
🏃‍♂️

Xavier Olive xoolive

🏃‍♂️
View GitHub Profile
@xoolive
xoolive / swarm.rb
Created September 30, 2014 21:16
Swarm algorithm visualised in gnuplot
#! /bin/ruby
# swarm algorithm
require 'gnuplot'
class Particule
attr_reader :x, :y
def initialize(size_x, size_y)
@size_x = size_x
@size_y = size_y
@xoolive
xoolive / mandelbrot.rb
Created September 30, 2014 21:20
Mandelbrot fractal in console
#! /bin/ruby
#
require 'complex'
class Mandelbrot
def initialize(bailout=10, iterations=100)
@bailout, @iterations = bailout, iterations
end
def mandelbrot(x, y)
@xoolive
xoolive / dvorak-fr
Created September 30, 2014 21:37
dvorak-fr (mouette) for X11
// Keymap Dvorak pour le Français
// par Josselin Mouette <josselin.mouette@ens-lyon.org>.
partial alphanumeric_keys
xkb_symbols "dvorak" {
name[Group1]= "France - Dvorak";
key <TLDE> { [ oe, OE, ae, AE ] };
@xoolive
xoolive / orbit.tex
Created December 28, 2014 20:36
Description des 6 paramètres orbitaux
\documentclass[border=10pt,varwidth]{standalone}
\usepackage[francais]{babel}
\usepackage[dvipsnames]{xcolor}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{tikz}
\usetikzlibrary{intersections}
@xoolive
xoolive / grades.r
Last active January 30, 2016 15:09
Distribution of grades in a student group
grades <- read.csv("grades.csv")
# I like to have first name, last name, grade
# Adapt the column number to your needs
x <- as.numeric(as.character(grades[,3]))
# Export to png?
# png("grades.png")
# Adapt the breaks to your grades
hist(x, col="lightgreen", freq=FALSE, breaks=seq(10,20,by=.5), family="Ubuntu") # I trashed Arial
# Play with the adjust (default: 1) parameter in density
lines(density(x[!is.na(x)]), col = "red", lwd = 2)
import facile
circuit = [facile.variable(0, Nv) for i in range(Nvmax + 1)]
facile.constraint(circuit[0] == 1)
for j in range(1, Nvmax + 1):
for i in range(j):
facile.constraint((circuit[j] == 0) | (circuit[i] != 0))
@xoolive
xoolive / test_int64.cpp
Created February 18, 2016 23:11
Check int64_t size with your compiler
#include <iostream>
#include <cstdint>
template <typename T>
bool is_int64() { return false; }
template <>
bool is_int64<int64_t>() { return true; }
int main()
@xoolive
xoolive / tufte-soul.sty
Created March 2, 2016 09:40
Conflict in soul with Tufte package
\ifxetex
\newcommand{\textls}[2][5]{%
\begingroup\addfontfeatures{LetterSpace=#1}#2\endgroup
}
\renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
\renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
\fi

Keybase proof

I hereby claim:

  • I am xoolive on github.
  • I am xoolive (https://keybase.io/xoolive) on keybase.
  • I have a public key whose fingerprint is 481C FB6C A003 AC28 A707 9CC2 F860 C160 A6B9 B1CD

To claim this, I am signing this object:

@xoolive
xoolive / parse_index.py
Last active February 23, 2021 05:39
Explore \index{} elements in your LaTeX aborescence
import sys
from collections import defaultdict
from itertools import repeat
from pathlib import Path
from typing import DefaultDict, Iterator, List, Optional, Tuple
import click
import regex as re
from rich import print