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
| """ | |
| An efficient scramble/Scramble solver. | |
| Author: Eugene Ma | |
| """ | |
| class Trie(object): | |
| def __init__(self): | |
| self.edges = {} | |
| self.end_state = False | |
| def load(self, path_to_dict): |
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
| # beaglenmt diagnostics web server - Vanya Sergeev <vsergeev at gmail.com> | |
| # http://dev.frozeneskimo.com/embedded_projects/beaglebone_network_multitool_server | |
| # | |
| import cherrypy | |
| import os, subprocess, time, shlex, threading, copy | |
| FORTUNE_BIN_PATH = "/home/edma2/minifortune" | |
| FORTUNE_DIR_PATH = "/home/edma2/fortunes" | |
| STATS_UPDATE_INTERVAL = 3 |
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 xml.etree.ElementTree as xml | |
| import sys | |
| import httplib | |
| def usage(): | |
| print 'usage: %s <stopId>' % sys.argv[0] | |
| exit(-1) | |
| if len(sys.argv) != 2: | |
| usage() |
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 itertools | |
| import sys | |
| from bottle import route, run, redirect | |
| ALPHANUM = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | |
| def usage(): | |
| print 'usage: %s <hostname> <port>' | |
| exit(-1) |
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
| ;; zipper.scm | |
| ;; A binary tree zipper implementation in Scheme | |
| ;; Author: Eugene Ma (edma2) | |
| (define (make-tree datum left right) | |
| (list datum left right)) | |
| (define datum car) | |
| (define left-child cadr) | |
| (define right-child caddr) | |
| (define (make-leaf datum) |
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 copy | |
| import re | |
| class Board(object): | |
| ''' | |
| tile | |
| [a-z] placed tile | |
| "_" normal empty square | |
| [2-9] multiplier empty square | |
| ''' |
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
| /* | |
| * Project Euler #13 | |
| * Eugene Ma | |
| * | |
| * Real Answer: 5537376230 | |
| */ | |
| #include <stdio.h> | |
| #include <string.h> |
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
| package main | |
| import "fmt" | |
| /* Graph representation */ | |
| type Dag struct { | |
| outgoing_edges map[int][]int | |
| incoming_edges map[int][]int | |
| } |
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
| ; tee | |
| ; Returns non-zero exit code if an error occured | |
| section .bss | |
| buf: resb 1024 | |
| buflen equ $-buf | |
| stdin equ 0 | |
| stdout equ 1 | |
| O_WRONLY equ 1q | |
| O_CREAT equ 100q |
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 sys | |
| from random import choice | |
| MAXWORDS = 10000 # Max words to output | |
| NPREF = 2 # Number of prefix words | |
| NONWORD = '\n' # Sentinel word | |
| table = {} # {(p1,p2) : [s1, s2, s3]} | |
| prefix = tuple([NONWORD for i in range(NPREF)]) | |
| wordlist = sys.stdin.read().split() |