Skip to content

Instantly share code, notes, and snippets.

Avatar

Takuya UESHIN ueshin

  • Databricks
  • San Francisco
View GitHub Profile
@ueshin
ueshin / WordCount.scala
Created Dec 14, 2010
MapReduce in Scala
View WordCount.scala
object WordCount {
def main(args: Array[String]) {
import mapreduce._
import _root_.scala.io.Source
def textInputFormat(lines: Iterator[String], offset: Long = 0): Stream[(Long, String)] = {
if(lines.hasNext) {
val line = lines.next
View J.java
public class J {
public static void setClass(Class<? extends java.util.List> clazz) {
System.out.println(clazz.getName());
}
}
@ueshin
ueshin / gist:3331431
Created Aug 12, 2012
FizzBuzzRegionObserver
View gist:3331431
> create 'fizzbuzz',
{ NAME => 'num', VERSIONS => JInteger::MAX_VALUE },
{ NAME => 'fizz', VERSIONS => JInteger::MAX_VALUE },
{ NAME => 'buzz', VERSIONS => JInteger::MAX_VALUE },
{ NAME => 'fizzbuzz', VERSIONS => JInteger::MAX_VALUE }
> create 'fb', 'family'
> disable 'fb'
> alter 'fb', METHOD => 'table_att','coprocessor' => 'maprfs:////user/ueshin/hbase-coprocessors-0.0.2-SNAPSHOT.jar|st.happy_camper.hbase.coprocessors.fizzbuzz.FizzBuzzRegionObserver|1000|targets=family'
> enable 'fb'
@ueshin
ueshin / example-package.scala
Created Oct 1, 2012
ValueClassesのバグ?
View example-package.scala
package object example {
implicit class Foo(val foo: String) extends AnyVal {
def hello = println("hello")
}
}
View ClosableLoan.scala
implicit def ClosableLoan[C <: { def close(): Unit }] = new Loan[C] {
override def using[A](closable: C)(block: C => A) = try {
block(closable)
} finally { closable.close }
}
@ueshin
ueshin / 20140715_prestoscr4.md
Created Jul 15, 2014
20140715 Presto Source Code Reading #4
View 20140715_prestoscr4.md
View dockeronmacosx.md

Docker on MacOSX

brew tap caskroom/cask
brew install brew-cask

brew cask install virtualbox

brew cask install boot2docker
@ueshin
ueshin / scalamatsuri2014.md
Created Sep 6, 2014
SparkSQL samples for ScalaMatsuri2014
View scalamatsuri2014.md
View gettingstartedwithspark.md

Getting Started with Spark by Aaron

RDD

val numbers = 0 until 24
numbers.filter(_ > 10)
val rdd = sc.makeRDD(numbers)

rdd.first()
@ueshin
ueshin / sparkmeetup.md
Created Sep 8, 2014
Spark SQL samples for Spark Meetup
View sparkmeetup.md