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
words = open('/usr/share/dict/words').read().splitlines() | |
l5w = list(filter(lambda x: len(x) == 5 and x.islower() and x.isalpha(), words)) | |
def guess(y, n, g=' ', e=['','','','','']): | |
return list( | |
filter( | |
lambda x: | |
all(c in x for c in y) and | |
all(not(c in x) for c in n) and |
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 Data.List | |
data Choose a = Choose [a] | |
deriving (Eq, Show) | |
choices (Choose xs) = xs | |
instance Functor Choose where | |
fmap f (Choose xs) = Choose $ map f xs |
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 z3 import * | |
def find_path(path, f, *args, **kwargs): | |
log = [] | |
def unwrap(other): | |
try: | |
return other.v | |
except: | |
return other | |
class Sym: |
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 Main where | |
import Data.List | |
import Control.Exception | |
instance Show Expr where | |
show (e@(Plus e1 e2)) = autoparl e e1 ++ " + " ++ autoparr e e2 | |
show (e@(Minus e1 e2)) = autoparl e e1 ++ " - " ++ autoparr e e2 | |
show (e@(Times e1 e2)) = autoparl e e1 ++ " * " ++ autoparr e e2 | |
show (e@(Div e1 e2)) = autoparl e e1 ++ " / " ++ autoparr e e2 | |
show (Const x) = show x |
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
*** Date: Friday, December 7, 2012 10:25:15 AM Central European Time | |
*** Platform Details: | |
*** System properties: | |
awt.nativeDoubleBuffering=true | |
awt.toolkit=apple.awt.CToolkit | |
eclipse.application=org.eclipse.ui.ide.workbench | |
eclipse.buildId=M20120208-0800 | |
eclipse.commands=-os |
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
*** Date: Thursday, December 6, 2012 12:29:19 PM Central European Time | |
*** Platform Details: | |
*** System properties: | |
applicationXMI=org.eclipse.ui.workbench/LegacyIDE.e4xmi | |
awt.nativeDoubleBuffering=true | |
awt.toolkit=apple.awt.CToolkit | |
eclipse.application=org.eclipse.ui.ide.workbench | |
eclipse.buildId=M20120914-1800 |
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 java.awt.Container; | |
import java.awt.GridLayout; | |
import java.util.ArrayList; | |
import javax.swing.JFrame; | |
import weka.clusterers.HierarchicalClusterer; | |
import weka.core.Attribute; | |
import weka.core.DenseInstance; | |
import weka.core.EuclideanDistance; |
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 copy import deepcopy | |
from pprint import pprint | |
board = [ | |
[-1,-1, 1, 1, 1,-1,-1], | |
[-1,-1, 1, 1, 1,-1,-1], | |
[ 1, 1, 1, 1, 1, 1, 1], | |
[ 1, 1, 1, 0, 1, 1, 1], | |
[ 1, 1, 1, 1, 1, 1, 1], | |
[-1,-1, 1, 1, 1,-1,-1], |
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
%% instance | |
place(1). | |
place(2). | |
place(3). | |
place(4). | |
transition(1). | |
transition(2). | |
t_pre(1,1). | |
t_post(1,2). |
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 django.contrib import admin | |
class SlaveInline(admin.TabularInline): | |
model = Slave | |
extra = 0 | |
class MasterAdmin(admin.ModelAdmin): | |
inlines = (SlaveInline,) | |
class Media: |
NewerOlder