Skip to content

Instantly share code, notes, and snippets.

View joxn's full-sized avatar

John S Costello joxn

View GitHub Profile
@joxn
joxn / gb_piano.py
Last active September 7, 2018 14:35
Convert GB note numbers to piano notes
import math, itertools
def keyno(f):
return 12 * math.log2(f/440) + 49
def gbfreq(n):
return 131072/(2048-n)
def keyfreq(k):
return math.pow(2, (k - 49)/12) * 440
@joxn
joxn / hue_solve_optimal.py
Last active July 25, 2017 15:49
Generate the optimal solution for I 🖤 Hue, given the board current state and solved state.
class Board:
# details omitted
def solve_optimal(self):
# self.cur_color: Dict[Tile, Color]
# the current board state, what color is on each tile
# self.cur_placement: Dict[Color, Tile]
# the current board state, where each color is sitting now

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@joxn
joxn / Roman.hs
Created June 10, 2016 04:45
Given a positive Integer less than 4999, produce the Roman numeral representation.
{-# OPTIONS_GHC -Wall -Werror #-}
module Roman( numerals ) where
import Data.List( unfoldr )
numerals :: Integer -> String
numerals = concat . unfoldr getNextRoman
where
getNextRoman n | n >= 1000 = Just ("M", n - 1000)
| n >= 900 = Just ("CM", n - 900)
| n >= 500 = Just ("D", n - 500)
@joxn
joxn / _.md
Last active August 29, 2015 14:19
Tributary inlet