Skip to content

Instantly share code, notes, and snippets.

View ueshin's full-sized avatar

Takuya UESHIN ueshin

  • Databricks
  • Mountain View
View GitHub Profile
@ueshin
ueshin / sparkmeetup.md
Created September 8, 2014 08:49
Spark SQL samples for Spark Meetup

Getting Started with Spark by Aaron

RDD

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

rdd.first()
@ueshin
ueshin / scalamatsuri2014.md
Created September 6, 2014 02:42
SparkSQL samples for ScalaMatsuri2014
@ueshin
ueshin / dockeronmacosx.md
Created August 21, 2014 03:41
Docker on MacOSX

Docker on MacOSX

brew tap caskroom/cask
brew install brew-cask

brew cask install virtualbox

brew cask install boot2docker
@ueshin
ueshin / 20140715_prestoscr4.md
Created July 15, 2014 06:53
20140715 Presto Source Code Reading #4
@ueshin
ueshin / ClosableLoan.scala
Created October 26, 2012 08:51
Loan type class
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 / example-package.scala
Created October 1, 2012 15:00
ValueClassesのバグ?
package object example {
implicit class Foo(val foo: String) extends AnyVal {
def hello = println("hello")
}
}
@ueshin
ueshin / gist:3331431
Created August 12, 2012 11:09
FizzBuzzRegionObserver
> 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'
public class J {
public static void setClass(Class<? extends java.util.List> clazz) {
System.out.println(clazz.getName());
}
}
@ueshin
ueshin / WordCount.scala
Created December 14, 2010 15:21
MapReduce in 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