Skip to content

Instantly share code, notes, and snippets.

View bhugueney's full-sized avatar

bhugueney

View GitHub Profile
@bhugueney
bhugueney / statistical-paradoxes-regression-to-the-mean-hands-on_fr-fr.ipynb
Created September 25, 2023 00:08
Statistical-Paradoxes-Regression-to-the-Mean-Hands-on_fr-FR.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
name: history
channels:
- defaults
dependencies:
- conda
- python=3.7
- conda-env
- conda-build
- conda-verify
- anaconda-navigator
@bhugueney
bhugueney / NestedIfs.java
Last active January 1, 2019 23:05
Using ASM for control flow : example from asmifier
public class NestedIfs {
public static int run(int a, int b){
int res= 0;
if( (a-b) == 0){
int c= a+b;
if(c != 0){
c= 5;
}else{
c= 2;
}
@bhugueney
bhugueney / GeoPoint.java
Last active October 4, 2018 09:09
reading vertices and edges data from URL
public static GeoPoint[] read(String vUrl, String eUrl)throws IOException {
List<GeoPoint> res= new SingleLinkedList<GeoPoint>();
try(BufferedReader vBr = new BufferedReader(new InputStreamReader(new URL(vUrl).openStream()));
BufferedReader eBr = new BufferedReader(new InputStreamReader(new URL(eUrl).openStream()))) {
for(String line= vBr.readLine(); line != null; line= vBr.readLine()){
String[] coords= line.split(" ");//latitude, longitude
res.add(new GeoPoint(Double.parseDouble(coords[0]), Double.parseDouble(coords[1])));
}
for(String line= eBr.readLine(); line != null; line= eBr.readLine()){
String[] data= line.split(" ");//start end nbDirs Duration Length
@bhugueney
bhugueney / lazy-examples.clj
Created September 27, 2018 13:31
Examples of lazy sequences in Clojure
(def fib-seq
(lazy-cat [0 1] (map + (rest fib-seq) fib-seq)))
(def primes (lazy-cat [2] (filter (fn[candidate]
(not-any? #(zero? (mod candidate %1))
(take-while (partial > (Math/sqrt candidate))
primes)))
(iterate (partial + 2) 3))))
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(defn sizes[k n]
(condp = k
n #{(vec (repeat k 1))}
1 #{[n]}
(reduce (fn [res s0]
(reduce #(conj % (sort (conj %2 s0)))
res
(sizes (dec k) (- n s0))))
#{}
(take (- n k)(iterate inc 1)))))
@bhugueney
bhugueney / chaos-game-double.cxx
Created January 2, 2018 21:27
début de réimplémentation du chaos game en C++. Sans paramétrage sur le type numérique : double
#include <iostream>
#include <tuple>
#include <cmath>
#include <cstdlib>
#include <vector>
/*
STEPS=100;
PREFIX=chaos-game-frame-${STEPS}
for i in $(seq $((3 * $STEPS)) $((8 * $STEPS))); do
./chaos-game-double $(bc -l <<< "scale=2;$i / $STEPS") | convert pgm:- ${PREFIX}-$i.png;