Skip to content

Instantly share code, notes, and snippets.

@mkscrg
mkscrg / gist:725879
Created December 2, 2010 19:18
A test Gist! (Some Python functions playing with deterministic finite automata.)
"""
Arguments are the parameters of a deterministic finite automaton:
q -- states (list of strings)
si -- input alphabet (list of characters)
de -- transition function ((index of q),(index of si) --> (index of q))
s -- start state (index of q)
f -- accept states (list of (index of q))
Returns a generator function which takes a string and generates successive
states (indices of q) as the DFA runs on the string.
"""
[
{
"tags": [
"Others",
"Tech startups",
"Homes",
"Offices",
"Corporate office",
"Work",
"Services",
[
{
"tags": [
"Japanese restaurants",
"Restaurant",
"Sushi",
"Bar",
"Food",
"Food & drink",
"Japanese restaurant"
{
"tags": [
"Japanese restaurants",
"Restaurant",
"Sushi",
"Bar",
"Food",
"Food & drink",
"Japanese restaurant"
],
[
{
"type": "event",
"status": "active",
"image_url": null,
"expiration_date": "2011-10-01T13:00:00-07:00",
"place": {
"name": "Nelson Blue",
"lon": -74.001573,
"city": "New York",
{
"type": "event",
"status": "active",
"image_url": "http://s3.amazonaws.com/prestigedevelopment/beta/offer_photos/4e5f502fceb01f000100139f.jpg?1314869295",
"place": {
"name": "Chelsea Piers - Pier 62",
"lon": -74.005973,
"city": "New York",
"address": ", ",
"postal_code": "",
@mkscrg
mkscrg / conctest.hs
Created December 1, 2011 23:42
Concurrency Test
import Control.Concurrent
import Control.Monad
import Data.Time.Clock.POSIX
import System.Environment
main :: IO ()
main = do
-- setup
n <- getArgs >>= return . read . head
start <- newEmptyMVar
@mkscrg
mkscrg / .gitignore
Created February 14, 2012 18:59
zeromq3-haskell-0.1.3 on GHC 7.4.1
cabal-dev/
dist/
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Control.Concurrent (forkIO)
import Control.Monad (unless)
import Data.ByteString.Char8 (pack)
import System.Environment (getArgs)
import System.Timeout (timeout)
import System.ZMQ3
@mkscrg
mkscrg / .gitignore
Created June 18, 2012 21:26
A simple multi-module Maven project with which exec-maven-plugin is unusable.
.idea/
*.iml
target/