Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am terrhorn on github.
  • I am terrhorn (https://keybase.io/terrhorn) on keybase.
  • I have a public key whose fingerprint is DD56 9F81 4C96 C469 082E F882 3FF5 8ABD DDFB BAC5

To claim this, I am signing this object:

@terrhorn
terrhorn / batch_events.scala
Created February 16, 2016 17:44
Batch Events in KeenClient-Scala
val collectionName = "my_event_collection" // the name of your collection
val events = ArrayBuffer.empty[String] // an array buffer to hold all of the events that we'll batch
// populate the array with 5000 fake events
for(i <- 1 to 5000) {
events.append(s"""{"foo": { "count": $i, "bar": "baz"} }""")
}
// split events into 5 batches of 1000 events, and send each batch to Keen
for(batch <- events.grouped(1000)) {
@terrhorn
terrhorn / collection_counts.rb
Created February 12, 2015 22:46
Counts the total number of events in each collections for a given Project
require 'dotenv'
require 'keen'
Dotenv.load
# allow timeframe to be specified via the command line
# usage: ruby collection_counts.rb previous_7_days
if !ARGV[0].nil?
timeframe = ARGV[0]
end