Skip to content

Instantly share code, notes, and snippets.

View IanCal's full-sized avatar

Ian Calvert IanCal

  • Red Bird Data
  • Wirral
View GitHub Profile
@IanCal
IanCal / monty_hall_variations.py
Last active December 29, 2016 00:16
Monty hall variations in strategy
from random import randint, shuffle
from collections import Counter
DOORS = 3
EXPERIMENTS = 1000
def get_doors():
doors = [True] + [False] * (DOORS - 1)
shuffle(doors)
return doors
@IanCal
IanCal / Dockerfile
Created February 6, 2015 11:34
Elasticsearch plugins and docker
FROM dockerfile/elasticsearch
RUN mkdir /elasticsearch/plugins
ADD elasticsearch.yml /elasticsearch/config/elasticsearch.yml
RUN ["/elasticsearch/bin/plugin", "--install", "mobz/elasticsearch-head"]
@IanCal
IanCal / includethis.html
Created August 31, 2013 13:47
A simple inclusion approach
<!doctype html>
<head>
</head>
<body>
<section name="anchor1">
I am the INCLUDED THING
<section name="anchorsub">
I am a teeny tiny inclusion
</section>
</section>
@IanCal
IanCal / N-Queens.hs
Created February 18, 2012 10:16
A closed form solution for n-queens, from "Explicit Solutions to the N-Queens Problem for all N"
type Queen = (Int,Int)
solveNot6kplus2 :: Int -> [Queen]
solveNot6kplus2 n = firstHalf ++ secondHalf
where
firstHalf = [(j, 2 * j) | j <- range]
secondHalf = [(n `div` 2 + j, 2 * j - 1) | j <- range]
range = [1 .. n `div` 2]
solveNot6k :: Int -> [Queen]