Skip to content

Instantly share code, notes, and snippets.

@blazs
blazs / Earley.java
Created January 13, 2018 18:10
An old Java implementation of the Earley parser from student days.
// -- Description --
// Assume 'S' is always the start symbol
// You may assume that your method will be tested in the following setting:
// - grammar will contain between 1 and 100 strings,
// - each string will represent one production (possibly with multiple right
// hand sides, separated by | (see examples)),
// - word can be empty or up to 10000 terminal symbols (characters) long.
// -- References --
// [1] Jay Earley. An Efficient Context-Free Parsing Algorithm. Communications of the ACM, 1970.
// [2] John Aycock and Nigel Horspool. Practical Earley Parsing. Computer Journal, 2002.
@chrishamant
chrishamant / s3_multipart_upload.py
Created January 3, 2012 19:29
Example of Parallelized Multipart upload using boto
#!/usr/bin/env python
"""Split large file into multiple pieces for upload to S3.
S3 only supports 5Gb files for uploading directly, so for larger CloudBioLinux
box images we need to use boto's multipart file support.
This parallelizes the task over available cores using multiprocessing.
Usage:
s3_multipart_upload.py <file_to_transfer> <bucket_name> [<s3_key_name>]