Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Blinkinsop blinks

View GitHub Profile
@blinks
blinks / forex.py
Created Sep 19, 2019
A simple currency board tracker for For-Ex.
View forex.py
#!/usr/bin/env python3
# A simple currency board tracker for For-Ex.
# Needs `pip3 install colorama` and normal Python3.
from collections import defaultdict
from colorama import Fore, Style
import os
currency = {
'GBP': Fore.RED,
'EUR': Fore.BLUE,
View keybase.md

Keybase proof

I hereby claim:

  • I am blinks on github.
  • I am blinks (https://keybase.io/blinks) on keybase.
  • I have a public key ASAvUWquxqT-GPdAtf3e40GJRMZ1FaTZ_0s4TJlPPuz8rQo

To claim this, I am signing this object:

@blinks
blinks / harperpool.py
Created Jul 9, 2019
A monte carlo simulation of a very particular kind of dice pool.
View harperpool.py
#!/usr/bin/env python
# A simple monte carlo simulation for a specific kind of die pool.
#
# Usage: ./pool.py --trials=1000 4d6+3d8
import collections
import random
def main(args):
result = collections.defaultdict(lambda: 0)
@blinks
blinks / napoleon.markdown
Created Sep 6, 2018
A card-driven strategy game about the Napoleonic Wars.
View napoleon.markdown

A strategic card game about the Napoleonic Wars (c. 1797 to 1815), based on mechanisms from Glory to Rome.

Components

  • Decks of event cards, each with action, reaction, unit, and 2d6 roll.
  • A bunch of morale cubes.
  • A map of Europe and surrounding areas.
  • Standees for the various leaders involved.

Play

View gather.py
#!/usr/bin/env python
# Gather cards from wizards.com into local Elasticsearch.
# Adam Blinkinsop <http://plus.google.com/+AdamBlinkinsop>
from elasticsearch import Elasticsearch
import bs4
import re
import urllib
def main(args):
sets = args.sets
@blinks
blinks / core.clj
Created Jul 11, 2013
Four-part chorale algorithmic composer. Caveat emptor; this needs some major work, which is coming.
View core.clj
(ns bgm.core
(:use [overtone.inst sampled-piano])
(:require [clojure.set]
[overtone.core :as overtone])
(:gen-class))
(def golden-ratio 1.61803398875)
(def golden-ratio-conjugate (/ 1.61803398875))
;;; COMPOSITION
@blinks
blinks / otomata.ck
Created Oct 28, 2011
ChucK script to simulate Otomata
View otomata.ck
/**
* MIDI Helper Methods
*/
class MIDIConnection {
MidiOut mout;
fun void connect(int port) {
if (!mout.open(0)) { me.exit(); }
}
@blinks
blinks / randgame.py
Created Feb 10, 2010
Choose a random game from your BGG collection.
View randgame.py
#!/usr/bin/env python2.6
"""
Choose a random game from your BGG collection. For example:
$ ./randgame.py blinks
Downloading collection for blinks...
Filtering collection of 66 for 2 players...
Filtering remaining 53 for 90 minutes...
Filtering remaining 39 for rating 6.0...
Choosing from 29 games... -> Fluxx <-
@blinks
blinks / gist:47991
Created Jan 16, 2009
A Mastermind Solver in Haskell.
View gist:47991
-- Master: Mastermind Solver
-- Adam Blinkinsop <blinks@google.com>
import Data.Ord
import Data.List
-- Types for pegs and codes, mainly for display.
data Peg = Red | Green | Blue | White | Yellow | Orange
deriving (Eq, Ord, Show)
data Code = Code [Peg] deriving Show
data Response = Respond (Int, Int) deriving Eq
@blinks
blinks / roll.py
Created Jan 16, 2009
A dice roller.
View roll.py
#!/usr/bin/env python
import logging
import random
import re
import sys
ROLL = re.compile(r'(\d*)d(\d+)')
def roll(dice):
"""Randomly generate the result of a dice roll.