Skip to content

Instantly share code, notes, and snippets.

View aciceri's full-sized avatar
🍹
drinking spritz

Andrea Ciceri aciceri

🍹
drinking spritz
View GitHub Profile
@aciceri
aciceri / compleanno.py
Last active December 31, 2015 18:09
Soluzione del problema del compleanno scritta in Python. http://it.wikipedia.org/wiki/Paradosso_del_compleanno
#!/usr/bin/env python3
import matplotlib.pyplot as plt
gg = 365
fattoriale = lambda n: 1 if n == 0 else fattoriale(n-1)*n
prob_comp = lambda n: 1-(fattoriale(gg)/(fattoriale(gg-n)*gg**n))
if __name__ == '__main__':
x = list(range(1, 100))
y = list(map(prob_comp, x))
@aciceri
aciceri / dungeon_generator.c
Last active August 29, 2015 13:56
Experimental dungeon generator written in C
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define height_max 1000
#define width_max 1000
typedef enum {false, true} bool;
"filetype off
call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on
syntax on
set smartindent
set shiftwidth=4
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt HIST_IGNORE_DUPS
bindkey -v
export BROWSER='chromium'
export EDITOR='vim'
export PAGER='vimpager'
export PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/opt/sdk/tools:/opt/sdk/platform-tools'
from PIL import Image
from colorsys import hsv_to_rgb
hue2rgb = lambda hue: tuple([int(color * 255) for color in hsv_to_rgb(hue, 1, 1)])
width, height = 500, 500
image = Image.new(mode="RGB", size=(width, height), color=(0, 0, 0))
xa, xb = -2.0, 1.0
ya, yb = -1.5, 1.5
from PIL import Image
from colorsys import hsv_to_rgb
hue2rgb = lambda hue: tuple([int(color * 255) for color in hsv_to_rgb(hue, 1, 1)])
width, height = 300, 300
image = Image.new(mode="RGB", size=(width, height), color=(0, 0, 0))
xa, xb = -1.5, 1.5
ya, yb = -1.5, 1.5
#include <stdio.h>
#include <stdlib.h>
struct lista_nodo {
char valore;
struct lista_nodo * prossimo;
};
typedef struct lista_nodo elemento;
#include <stdio.h>
#include <stdlib.h>
struct pila_nodo {
char valore;
struct pila_nodo * prossimo;
};
typedef struct pila_nodo elemento;
const T = (x) => ((y) => x)
const F = (x) => ((y) => y)
const ifThenElse = (cond) => ((a) => ((b) => cond(a)(b)))
const cons = (a) => ((b) => ((c) => c(a)(b)))
const car = (l) => l(T)
const cdr = (l) => l(F)
const nil = cons(T)(T)
const isNil = car
const node = (x) => cons(F)(x)
@aciceri
aciceri / config
Last active March 31, 2019 17:06
i3-gaps configuration
# Use Start key as $mod
set $mod Mod4
# Font for window titles.
font pango:DejaVu Sans Mono 8
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# Set colors palette