Skip to content

Instantly share code, notes, and snippets.

View FlorianCassayre's full-sized avatar

Florian Cassayre FlorianCassayre

View GitHub Profile
@FlorianCassayre
FlorianCassayre / Fractals_.gitignore
Created January 23, 2016 14:21
Fractals generator
# Created by https://www.gitignore.io/api/intellij
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
*.iml
## Directory-based project format:
.idea/
public class InfiniteSeries
{
public static void main(String[] args)
{
/*
1 + 2 + 4 + 8 + ... = -1
This algebraic proof is an analogy to Euler's approach to divergent series.
See https://en.wikipedia.org/wiki/1_%2B_2_%2B_4_%2B_8_%2B_%E2%8B%AF
*/
@FlorianCassayre
FlorianCassayre / BrainfuckInstruction.java
Last active June 3, 2017 19:42
A basic Brainf*** interpreter in java (with uncensored class names).
public enum BrainfuckInstruction
{
INCREMENT('+'),
DECREMENT('-'),
CURSOR_RIGHT('>'),
CURSOR_LEFT('<'),
LOOP_START('['),
LOOP_END(']'),
INPUT(','),
OUTPUT('.');
final int HIDDEN_LAYERS = 1;
final int INPUTS = 4 * 2;
final int OUTPUTS = 4;
final int NEURONS_PER_LAYER = 16;
final float LEARNING_RATE = 0.1;
final float[][] neurons = new float[2 + HIDDEN_LAYERS][]; // [layer][neuron]
final float[][][] axons = new float[1 + HIDDEN_LAYERS][][]; // [layer][previous_neuron][next_neuron]
{"layers":[{"out_depth":1,"out_sx":24,"out_sy":24,"layer_type":"input"},{"sx":5,"sy":5,"stride":1,"in_depth":1,"out_depth":8,"out_sx":24,"out_sy":24,"layer_type":"conv","l1_decay_mul":0,"l2_decay_mul":1,"pad":2,"filters":[{"sx":5,"sy":5,"depth":1,"w":{"0":-0.002005437436999499,"1":0.11800762769429841,"2":0.15288575246122227,"3":0.17926717613376164,"4":-0.08993469726722844,"5":-0.20254829450417103,"6":0.15791114405597814,"7":0.31846451260019604,"8":0.01467962792660115,"9":-0.13848296305157726,"10":0.10341788356249301,"11":-0.06268045391638183,"12":0.6978074481239207,"13":-0.2938077242420065,"14":-0.5089319294176927,"15":-0.12264368305380181,"16":0.44763879656035277,"17":0.3359516007279942,"18":-0.06184286836783794,"19":-0.482255823490501,"20":0.3677897224446566,"21":0.10207491930585594,"22":0.21835092856908758,"23":-0.02092531346874951,"24":0.13842120306943864}},{"sx":5,"sy":5,"depth":1,"w":{"0":-0.43289539339825756,"1":-0.5130859925805419,"2":0.02528701695327489,"3":0.3359550133438127,"4":0.218543747256232,"5
@FlorianCassayre
FlorianCassayre / WorldGenCaves.java
Created January 3, 2016 13:08
Modify the minecraft cave generation behavior by increasing/decreasing caves density.
import net.minecraft.server.v1_8_R2.*;
import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R2.generator.NormalChunkGenerator;
import java.lang.reflect.Field;
/**
* @author Florian Cassayre (6infinity8)
*/
public class WorldGenCaves extends net.minecraft.server.v1_8_R2.WorldGenCaves
final int INITIAL_K = 0;
int k = INITIAL_K;
final int POINTS_PER_CLUSTER = 100;
final float POINTS_DEVIATION = 50;
final int INTERVAL = 100;
final ArrayList<Point> points = new ArrayList<Point>();
final ArrayList<Point> centroids = new ArrayList<Point>();
final HashMap<Point, Point> map = new HashMap<Point, Point>();
@FlorianCassayre
FlorianCassayre / SelfDescription.java
Created September 10, 2017 20:42
Reproduction of "Self-Description" by xkcd (https://xkcd.com/688).
// Reproduction of "Self-Description" by xkcd (https://xkcd.com/688).
// @author Florian Cassayre
final int PANEL_WIDTH = 500, PANEL_HEIGHT = 400, PADDING = 50, WEIGHT = 4;
PFont font;
void setup()
{
surface.setSize(PANEL_WIDTH * 3 + PADDING * 2, PANEL_HEIGHT);
object CompteBonCombinations extends App {
val plates = {
val small = (1 to 10).toList
val big = List(25, 50, 75, 100)
small ++ small ++ big
}
val grouped = plates.groupBy(identity).mapValues(_.size)
import scala.util.Random
import Fiddle.draw._
import org.scalajs.dom.{Event, EventTarget, MouseEvent}
import scala.collection.mutable.ArrayBuffer
val square = 50
val (width, height) = (Fiddle.canvas.width, Fiddle.canvas.height)
val (mapWidth, mapHeight) = (20 * square, 20 * square)
val (borderLeft, borderRight, borderTop, borderBottom) = (0, mapWidth, 0, mapHeight)