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
colors = require 'colors' | |
targets = (randomWalkFunction('test.' + i) for i in [1..9]) | |
graph targets, maxDataPoints: 200, d3_colors: colors.brewer.Set3[11], lineWidth: 1.5, width: 1280, height: 720 |
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
user=> (try | |
#_=> (/ 1 0) | |
#_=> (catch Throwable t (throw (RuntimeException. t)))) | |
ArithmeticException Divide by zero clojure.lang.Numbers.divide (Numbers.java:156) | |
user=> (try | |
#_=> (/ 1 0) | |
#_=> (catch Throwable t (throw (RuntimeException.)))) | |
RuntimeException user/eval4065 (NO_SOURCE_FILE:2) |
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
fs = require 'fs' | |
class FileSampleSource | |
constructor: (filename) -> | |
@fd = fs.openSync filename, 'r' | |
# FIXME | |
@bytesPerSample = 1 | |
@channels = 2 | |
@offset = 44 |
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
require 'socket' | |
s = TCPSocket.new ARGV[0], 60128 | |
def hexify_command(cmd) | |
cmd = '!1' + cmd unless cmd.start_with? '!1' | |
"ISCP\x00\x00\x00\x10\x00\x00\x00#{(cmd.length + 1).chr}\x01\x00\x00\x00#{cmd}\x0D" | |
end | |
s.write hexify_command(ARGV[1]) |
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
// fix a tsv with unescaped newlines | |
val lines = io.Source.fromFile(argv(0)).getLines | |
val header = lines.next() | |
val tabCount = header.count(_ == '\t') | |
println(header) | |
while (lines.hasNext) { |
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
var host = "localhost:9999" | |
var page = 1 | |
var ws = new WebSocket("ws://" + host + "/devtools/page/" + page) | |
ws.onmessage = function(m) {console.log(m.data)} | |
var counter = 0 | |
var send = function (method, params) { | |
ws.send(JSON.stringify({id: counter++, 'method': method, 'params': params})) | |
} |
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 -cp /Users/ryan/Downloads/commons-jxpath-1.3/commons-jxpath-1.3.jar:/Users/ryan/Downloads/miglayout-4.0.jar:/Users/ryan/Downloads/geotools-8.0-M4/\*:/Users/ryan/Downloads/jscience-4.3/jscience.jar:/Users/ryan/work/vendor/jts-1.12/lib/jts-1.12.jar show_shapefile.scala ~/Downloads/tl_2009_us_county/tl_2009_us_county.shp | |
import scala.collection.JavaConversions._ | |
import java.awt.image.BufferedImage | |
import java.awt.Color | |
import java.awt.Rectangle | |
import java.awt.RenderingHints | |
import java.io.File | |
import java.util.HashMap |
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
// TileMill provider for Unfolding (or modestmaps-processing?) | |
// requires Unfolding (http://unfoldingmaps.org/) and GLGraphics (http://glgraphics.sourceforge.net/) | |
// this is important. weird. | |
import processing.opengl.*; | |
import codeanticode.glgraphics.*; | |
import de.fhpotsdam.unfolding.core.*; | |
import de.fhpotsdam.unfolding.geo.*; | |
import de.fhpotsdam.unfolding.utils.*; |
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
object ❄ | |
object ❅ { | |
def apply(o:Any) = println(o) | |
} | |
object ☃ { | |
def ❄(s:Any) = '❄' | |
def ❅❅(s:Any) = "❅❅" | |
def ☃(x:Any) = {this} | |
} |
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
val job = new Job(getConf()) | |
job.getConfiguration().setInt("mapred.map.tasks", 1) | |
job.setJarByClass(classOf[LogStats]) | |
job.setJobName("logstats") | |
job.setMapperClass(classOf[LocMap]) | |
job.setReducerClass(classOf[CountReduce]) | |
job.setMapOutputKeyClass(classOf[TextTriple]) | |
job.setMapOutputValueClass(classOf[LongWritable]) |