Skip to content

Instantly share code, notes, and snippets.

View GrahamLea's full-sized avatar

Graham Lea GrahamLea

View GitHub Profile
@GrahamLea
GrahamLea / BubbleChart.scala
Created February 26, 2013 07:06
A Scala script that takes in a CSV from stdin and write a bubble chart as a PNG to stdout.
import io.Source
import java.awt.font.GlyphVector
import java.awt.{Font, Graphics2D, Color}
import java.awt.RenderingHints._
import java.awt.geom.{Rectangle2D, Ellipse2D}
import java.awt.image.BufferedImage
import java.io.{File, ByteArrayInputStream}
import javax.imageio.ImageIO
// Change anything in this block to change how the input is interpreted
@GrahamLea
GrahamLea / CSVPivot.scala
Last active December 14, 2015 05:39
A Scala script that takes a CSV as input on stdin, produces a pivot table on two columns using a count() function and outputs the pivot table to stdout.
import collection.mutable
import io.Source
import java.io.FileInputStream
def toIntOption(s: String): Option[Int] = try { Some(s.toInt) } catch { case e: NumberFormatException => None }
val intArgs = args.map(toIntOption).flatten
if (args.length != 2 && intArgs.length != 2) {
System.err.println("usage: <x_column_number> <y_column_number>")
@GrahamLea
GrahamLea / pom.xml
Created June 19, 2012 11:58
A template Maven POM for building Scoobi Hadoop Applications
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>your-scoobi-app-name</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>