This file contains 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
module DR where | |
import Control.Applicative | |
import Data.Graph.Inductive.Graph | |
import Data.Graph.Inductive.PatriciaTree | |
import Data.Graph.Inductive.Query | |
import qualified Data.Map as M | |
newtype Task = Task Int deriving (Eq, Ord, Show) |
This file contains 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
module DR where | |
import Control.Applicative | |
import Data.Graph.Inductive.Graph | |
import Data.Graph.Inductive.PatriciaTree | |
import Data.Graph.Inductive.Query | |
import qualified Data.Map as M | |
newtype Task = Task Int deriving (Eq, Ord, Show) |
This file contains 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
module SDP where | |
import Control.Applicative | |
import Data.Function | |
import Data.List | |
import Test.QuickCheck | |
newtype Index = Index Int deriving (Eq, Ord, Show) | |
newtype Value a = Value a deriving (Eq, Ord, Show) | |
newtype SV a = SV [(Index, Value a)] deriving (Show) |
This file contains 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
module MyHaskell where | |
import Control.Applicative | |
import Data.Function | |
import Data.List | |
import Test.QuickCheck | |
newtype Index = Index Int deriving (Eq, Ord, Show) | |
newtype Value a = Value a deriving (Eq, Ord, Show) | |
newtype SV a = SV [(Index, Value a)] deriving (Show) |
This file contains 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 Control.Monad | |
import Text.ParserCombinators.Parsec | |
-- TODO const/pointer | |
data Ty = Ty String deriving (Show) | |
data FnTy = FnTy String [(Ty, String)] Ty deriving (Show) | |
data StructTy = StructTy String [(Ty, String)] deriving (Show) | |
data Stmt = Fn FnTy | Struct StructTy deriving (Show) |
This file contains 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
{-# LANGUAGE NamedFieldPuns #-} | |
module GoogLeNet where | |
import Data.Graph.Inductive.Graph | |
import Graph hiding (input) | |
import Layers | |
inception :: GS (Node, Node) | |
inception = do | |
splitId <- layer (Split 4) |
This file contains 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
/Users/tulloch/src/rust/src/librustdoc/html/render.rs:1205:43: 1217:14 error: cannot infer an appropriate lifetime due to conflicting requirements | |
/Users/tulloch/src/rust/src/librustdoc/html/render.rs:1205 impl_.items.iter().filter_map(|it| match it.inner { | |
/Users/tulloch/src/rust/src/librustdoc/html/render.rs:1206 clean::MethodItem(ref meth) => { | |
/Users/tulloch/src/rust/src/librustdoc/html/render.rs:1207 match method_htype(for_, meth) { | |
/Users/tulloch/src/rust/src/librustdoc/html/render.rs:1208 None => None, | |
/Users/tulloch/src/rust/src/librustdoc/html/render.rs:1209 Some(htype) => Some(HoogleItem { | |
/Users/tulloch/src/rust/src/librustdoc/html/render.rs:1210 // TODO: prefix with type name? | |
... | |
/Users/tulloch/src/rust/src/librustdoc/html/render.rs:1205:43: 1217:14 note: first, the lifetime cannot outlive the expression at 1205:42.. |
This file contains 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 builder(cls, allow_default=True): | |
class Builder(object): | |
def __init__(self): | |
self._state = cls(**{name: None for name in cls._fields}) | |
self._fields_set = set() | |
def set(self, **kwargs): | |
self._fields_set.update(set(dict(**kwargs).keys())) | |
self._state = self._state._replace(**kwargs) | |
return self |
This file contains 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 PIL import Image | |
import pyocr | |
import pyocr.builders | |
import re | |
def captcha(image, question): | |
tool = pyocr.get_available_tools()[0] | |
lang = tool.get_available_languages()[0] | |
img = Image.open(image).quantize(colors=6) | |
txt = tool.image_to_string(img, lang=lang, builder=pyocr.builders.TextBuilder()) |
This file contains 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
#! /bin/bash | |
# A hacky script that converts org-mode documents to an old-style | |
# Remarkup dialect, used by Phabricator and other tools. | |
set -x | |
set -e | |
pandoc --read=org --write=markdown --atx-headers $1 \ | |
| sed -E "s/\{\.(.*)\}/lang=\1/g" \ | |
| sed -E "s/\[(.*)\]\((.*)\)/[[\2 | \1]]/g" \ |