Skip to content

Instantly share code, notes, and snippets.

View mikispag's full-sized avatar

Michele Spagnuolo mikispag

View GitHub Profile
@mikispag
mikispag / tailseffect.py
Last active December 24, 2018 10:52
Having two normal distributions with close means (i.e. -0.1, +0.1), points far in the tails over-represent the "closer" bell by a surprising factor. Psychometric tests show that there is 60% chance that a random male is more aggressive than a random female [1], but the top 0.00001% of the population in aggressiveness is all male.
#!/usr/bin/env python3
from multiprocessing import Pool
import scipy.stats
N = int(1e10)
STDDEV = 1
norm_f = scipy.stats.norm(-0.1, STDDEV)
norm_m = scipy.stats.norm(0.1, STDDEV)
@mikispag
mikispag / keybase.md
Created December 28, 2017 09:45
Keybase proof

Keybase proof

I hereby claim:

  • I am mikispag on github.
  • I am mikispag (https://keybase.io/mikispag) on keybase.
  • I have a public key ASCSbBeAmEP2l_APEgKvHCZ6mbKepOtDPQUdkDcyf0GQpwo

To claim this, I am signing this object:

@mikispag
mikispag / BitFinex_COIN.go
Created March 9, 2017 02:00
Dirty script to trade the SEC's $COIN ETF decision on BitFinex
package main
import (
"bytes"
"github.com/beevik/etree"
"github.com/bitfinexcom/bitfinex-api-go"
"github.com/levigross/grequests"
"golang.org/x/net/html"
"log"
"os"
@mikispag
mikispag / self_describing_numbers.py
Created January 10, 2016 11:22
Space-exhausting solutions using weak compositions with n=k=N without leading zero
#!/usr/bin/env python3
from collections import defaultdict
from sys import argv
MAX_MEMOIZATION_LENGTH = 14
def memoized(f):
cache = {}
def ret(*args):
if args[1] > MAX_MEMOIZATION_LENGTH:
@mikispag
mikispag / population_simulation.py
Last active December 19, 2015 22:38
A simple simulation of a population. In a country where people only want boys, every couple continues to have children until they have a boy. If they have a girl, they have another child. If they have a boy, they stop. Breakups, accidents and new relationships are generated stochastically.
#!/usr/bin/env python2
import random
from collections import Counter
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
rcParams.update({'figure.autolayout': True})
MAX_T = 300
MIN_AGE_RELATIONSHIP = 14