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.io.IOException; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.fs.FileSystem; | |
import org.apache.hadoop.mapred.FileOutputFormat; | |
import org.apache.hadoop.mapred.OutputCommitter; | |
import org.apache.hadoop.mapred.JobContext; | |
import org.apache.hadoop.mapred.TaskAttemptContext; | |
import org.apache.hadoop.mapred.JobConf; | |
import org.apache.parquet.hadoop.ParquetOutputCommitter; |
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
class Flatten(T) | |
include Iterator(T) | |
def initialize(@iterator : Iterator(Iterator(T))) | |
@current = @iterator.next | |
end | |
def next_ | |
if (current = @current).is_a?(Iterator::Stop) | |
stop |
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
class Flatten(T) | |
include Iterator(T) | |
def initialize(@iterator : Iterator(Iterator(T))) | |
@current = @iterator.next | |
end | |
def next | |
if @current.is_a?(Iterator::Stop) | |
stop |
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
### Keybase proof | |
I hereby claim: | |
* I am colinmarc on github. | |
* I am colinmarc (https://keybase.io/colinmarc) on keybase. | |
* I have a public key whose fingerprint is 5130 CC66 3FE4 134A 0BF7 AF4B ED8F F019 649B E820 | |
To claim this, I am signing this object: |
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 org.apache.hadoop.conf.Configuration; | |
import com.amazonaws.AmazonClientException; | |
import com.amazonaws.auth.AWSCredentials; | |
import com.amazonaws.auth.AWSCredentialsProvider; | |
import com.amazonaws.auth.BasicAWSCredentials; | |
public class HadoopS3CredentialsProvider implements AWSCredentialsProvider { | |
private Configuration conf; |
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 com.twitter.scalding._ | |
import cascading.pipe.Pipe | |
import spray.json.JsonWriter | |
import org.apache.hadoop.io.BytesWritable | |
case class Sequins[V](p : String)(implicit writer: JsonWriter[V]) | |
extends FixedPathSource(p) | |
with WritableSequenceFileScheme | |
with TypedSink[(String, V)] { |
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.io.IOException; | |
import org.apache.hadoop.mapred.JobConf; | |
import org.apache.hadoop.mapred.OutputCollector; | |
import org.apache.hadoop.mapred.RecordReader; | |
import cascading.flow.FlowProcess; | |
import cascading.scheme.Scheme; | |
import cascading.scheme.SourceCall; | |
import cascading.scheme.SinkCall; |
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
scala> val x = 123.asInstanceOf[String] | |
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String | |
at .<init>(<console>:22) | |
at .<clinit>(<console>) | |
at .<init>(<console>:11) | |
at .<clinit>(<console>) | |
at $print(<console>) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
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
#version with gevent | |
import gevent.socket as socket | |
from gevent import spawn | |
s = socket.socket() | |
s.bind(('', 9599)) | |
s.listen(5) | |
def handle_client(client): |
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
__target__ = 'socket' | |
#TODO find a way to not require this line | |
_real = __import__(__target__) | |
__implements__ = [ | |
'socket', | |
'getaddrinfo', | |
#'gethostname', | |
#'gethostbyname', |
NewerOlder