Skip to content

Instantly share code, notes, and snippets.

View rjurney's full-sized avatar

Russell Jurney rjurney

View GitHub Profile
{"type":"date-time-series","values":[{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2008-09-01T00:00:00.000Z","value":},{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2008-10-01T00:00:00.000Z","value":},{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2008-11-01T00:00:00.000Z","value":},{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2008-12-01T00:00:00.000Z","value":},{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2009-01-01T00:00:00.000Z","value":},{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2009-02-01T00:00:00.000Z","value":},{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2009-03-01T00:00:00.000Z","value":},{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2009-04-01T00:00:00.000Z","value":},{"type":"simple-date-value","seriesName":"series Monthly","timestamp":"2009-05-01T00:00:00.000Z","value":},{"type":"simple-date-val
@rjurney
rjurney / gist:671889
Created November 11, 2010 02:37
How do I one-liner fill this hash in, so that there are no missing "start_years" ?
irb(main):168:0> records = experience_client.get('principal designer')['by_years']
=> [{"total"=>13, "start_years"=>0}, {"total"=>12, "start_years"=>1}, {"total"=>18, "start_years"=>2}, {"total"=>13, "start_years"=>3}, {"total"=>17, "start_years"=>4}, {"total"=>19, "start_years"=>5}, {"total"=>16, "start_years"=>6}, {"total"=>17, "start_years"=>7}, {"total"=>14, "start_years"=>8}, {"total"=>16, "start_years"=>9}, {"total"=>14, "start_years"=>10}, {"total"=>11, "start_years"=>11}, {"total"=>8, "start_years"=>12}, {"total"=>11, "start_years"=>13}, {"total"=>9, "start_years"=>14}, {"total"=>11, "start_years"=>15}, {"total"=>9, "start_years"=>16}, {"total"=>8, "start_years"=>17}, {"total"=>8, "start_years"=>18}, {"total"=>6, "start_years"=>19}, {"total"=>7, "start_years"=>20}, {"total"=>3, "start_years"=>21}, {"total"=>5, "start_years"=>22}, {"total"=>6, "start_years"=>23}, {"total"=>2, "start_years"=>24}, {"total"=>1, "start_years"=>27}, {"total"=>1, "start_years"=>28}, {"total"=>1, "start_years"=>29}, {"total"=
@rjurney
rjurney / pacer_rewrite_test.rb
Created May 10, 2011 20:33
Creating a new summary graph from an old one...
#
# The purpose of this script is to experiment with Pacer/Tinkerpop stack for
# graph transformation. In it we will summarize a much larger graph to produce
# a new, smaller graph that can fit into RAM via TinkerGraph for more rapid,
# real-time analysis.
#
require 'rubygems'
require 'pacer'
require 'pacer-neo4j'
@rjurney
rjurney / enron_summarize.rb
Created May 13, 2011 01:34
Summarizing the Enron Data
#!`which jruby`
#
# The purpose of this script is to experiment with Pacer/Tinkerpop stack for
# graph transformation. In it we will summarize a much larger graph to produce
# a new, smaller graph that can fit into RAM via TinkerGraph for more rapid,
# real-time analysis.
#
require 'rubygems'
@rjurney
rjurney / enron_summarize.rb
Created May 13, 2011 01:34
Summarizing the Enron Data
#!`which jruby`
#
# The purpose of this script is to experiment with Pacer/Tinkerpop stack for
# graph transformation. In it we will summarize a much larger graph to produce
# a new, smaller graph that can fit into RAM via TinkerGraph for more rapid,
# real-time analysis.
#
require 'rubygems'
@rjurney
rjurney / enron_play.rb
Created May 13, 2011 01:39
Playing with Enron Summaries
#!`which jruby`
require 'rubygems'
require 'pacer'
graph = Pacer.tg
graph.import("/tmp/enron_summary.xml")
# Focus on one email address, that of Tim Belden
sender = graph.get_vertices.filter(:address => 'tim.belden@enron.com')
@rjurney
rjurney / works.rb
Created May 13, 2011 06:23
Playing with Pacer
#!`which jruby`
require 'rubygems'
require 'pacer'
graph = Pacer.tg
graph.import("/tmp/enron_summary.xml")
# Focus on one email address, that of Tim Belden
sender = graph.v.filter(:address => 'louise.kitchen@enron.com')
@rjurney
rjurney / Reults of JRuby --profile -S test_subgraph.rb
Created June 5, 2011 08:04
Testing Pacer's subgraph with profiler
tinkergraph[vertices:317 edges:11520]
main thread profile results:
Total time: 55.92
total self children calls method
----------------------------------------------------------------
46.08 0.00 46.08 1 Pacer::Core::Graph::ElementRoute#subgraph
46.08 0.00 46.08 1 Pacer::Routes::PathsRoute#subgraph
46.08 0.00 46.08 1 Pacer::Routes::BulkOperations#bulk_job
@rjurney
rjurney / Fast-k-cores
Created June 5, 2011 09:25
Solution to slow subgraph problem :)
require 'graph_client'
require 'pacer'
client = GraphClient.new
k = 16
graph = client.get "louise.kitchen@enron.com"
#k_nodes = graph.v.filter{|v| v.out_e.count > k}.result
#subgraph = k_nodes.out_e.in_v.only(k_nodes).subgraph
@rjurney
rjurney / bash_profile
Created December 3, 2011 23:14
Adding Avro jars to CLASSPATH
pig_version=0.9.1
export CLASSPATH=$CLASSPATH:~/pig-${pig_version}/build/ivy/lib/Pig/avro-1.4.1.jar:~/pig-${pig_version}/build/ivy/lib/Pig/json-simple-1.1.jar:~/pig-${pig_version}/contrib/piggybank/java/piggybank.jar:~/pig-${pig_version}/build/ivy/lib/Pig/jackson-core-asl-1.6.0.jar:~/pig-${pig_version}/build/ivy/lib/Pig/jackson-mapper-asl-1.6.0.jar