Skip to content

Instantly share code, notes, and snippets.

name := "playground"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.1.0"
libraryDependencies += "net.sf.opencsv" % "opencsv" % "2.3"
@dustinlarimer
dustinlarimer / histogram.html
Last active June 7, 2017 16:22
Make histograms with keen-js v3
<!DOCTYPE html>
<html>
<head>
<title>Keen IO &#9829; Histograms!</title>
</head>
<body>
<div id="histogram"></div>
<script src="http://d26b395fwzu5fz.cloudfront.net/latest/keen.min.js"></script>
<script>
!function(){
@ShaharHD
ShaharHD / comments.md
Last active August 29, 2015 14:03
Keen.IO comments
  1. "sqlite3.h", "sqlite3.c" & “sqlite3ext.h” filename should all have the prefix of “keen_io” as the latter are version ambiguous.
  2. “KIOEventStore.h" should import "keen_io_sqlite3.h” and not “sqlite3.h” which is ambiguous.
  3. The distribution zip (cocoa pods or not) should include the "keen_io_sqlite3.h” as it is imported by “KIOEventStore.h"
  4. The usage of NSDateFormatter is not thread-safe (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html). A better and much faster solution would be (as you have sqlite now) to simply execute something like:
sqlite3_stmt *statement = NULL;
sqlite3_prepare_v2(db, "SELECT datetime('now');", -1, &statement, NULL);    
sqlite3_bind_text(statement, 1, format, -1, SQLITE_STATIC);
sqlite3_step(statement);
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonAST._
import org.json4s.DefaultFormats
object CandyCrushSQL {
def main(args: Array[String]): Unit = {
@jotto
jotto / google_oauth2_access_token.rb
Created June 14, 2012 21:15
ruby command line script for generating google oauth2 access token
# (create oauth2 tokens from Google Console)
client_id = ""
client_secret = ""
# (paste the scope of the service you want here)
# e.g.: https://www.googleapis.com/auth/gan
scope = ""
@RiANOl
RiANOl / gist:1077760
Last active April 13, 2024 06:17
AES128 / AES256 CBC with PKCS7Padding in Ruby
require "openssl"
require "digest"
def aes128_cbc_encrypt(key, data, iv)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.iv = iv