http://indiewebcamp.com/Bridgy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| from itertools import permutations | |
| puzzle_input = """ | |
| Tristram to AlphaCentauri = 34 | |
| Tristram to Snowdin = 100 | |
| Tristram to Tambi = 63 | |
| Tristram to Faerun = 108 | |
| Tristram to Norrath = 111 | |
| Tristram to Straylight = 89 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import errno | |
| import logging | |
| import mmap | |
| import struct | |
| from ctypes import * | |
| logging.basicConfig() | |
| log = logging.getLogger(__name__) | |
| log.setLevel(logging.DEBUG) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def _get_terminal_size(): | |
| rows, columns = os.popen('stty size', 'r').read().split() | |
| return int(rows), int(columns) | |
| def _stdout_pipe(channel): | |
| pipe = make_pipe() | |
| channel.in_buffer.set_event(pipe) | |
| return pipe.fileno() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A circle is defined by x^2 + y^2 = r | |
| // The perimeter of a circle is 2 \pi r | |
| // Well, let's start with the easy one: four segments | |
| // 1. If we say the radius is 150, then the points are: | |
| // (0, 150) - (150, 0) - (0, -150-) - (-150, 0) - ... | |
| interface DrawWithLength { | |
| void draw_with_length(float length); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import namedtuple | |
| FloatExpression = namedtuple('FloatExpression', ['value']) | |
| FormExpression = namedtuple('FormExpression', ['call', 'datums']) | |
| IntegerExpression = namedtuple('IntegerExpression', ['value']) | |
| ListExpression = namedtuple('ListExpression', ['datums']) | |
| SymbolExpression = namedtuple('SymbolExpression', ['value']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def expect(char, letter): | |
| assert char == letter, "expected '%s', got '%s'" % (letter, char) | |
| def helloStarParser(char): | |
| expect(char, 'h') | |
| return elloHelloStarParser | |
| helloStarParser.matchesEmpty = True | |
| def elloHelloStarParser(char): | |
| expect(char, 'e') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source("runhaskell.R") | |
| plot(runhaskellJ("Gibbs.main"), type="l") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "formula" | |
| class Docker < Formula | |
| homepage "http://docker.io" | |
| url "https://github.com/dotcloud/docker.git", :tag => "v0.11.1" | |
| option "without-completions", "Disable bash/zsh completions" | |
| depends_on "go" => :build |
Compile docker using the patch described at docker/docker#5813 dynbinary and netgo. This disables the netgo package, which doesn't support mDNS name resolution. You can use my gist michaelmaltese/docker.rb:
brew install https://gist.githubusercontent.com/michaelmaltese/1756c9ce071dea6c4edf/raw/3976a993814d46febf144754f7f3bfe22cebed2f/docker.rb