Skip to content

Instantly share code, notes, and snippets.

View arjones's full-sized avatar

Gustavo Arjones arjones

View GitHub Profile
@arjones
arjones / index.html
Created July 23, 2013 18:43
Sample using Google Visualization GeoCharts
<html>
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages': ['geochart']});
google.setOnLoadCallback(drawMarkersMap);
function drawMarkersMap() {
var data = google.visualization.arrayToDataTable([
['Ciudad', 'Tweets'],
package com.bizo.hive.udtf;
import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
# based on http://uberblo.gs/2011/06/high-performance-url-shortening-with-redis-backed-nginx
# using code from http://stackoverflow.com/questions/3554315/lua-base-converter
# "database scheme"
# database 0: id ~> url
# database 1: id ~> hits
# database 2: id ~> [{referer|user_agent}]
# database 3: id ~> hits (when id is not found)
# database 4: id ~> [{referer|user_agent}] (when id is not found)
# database 5: key "count" storing the number of shortened urls; the id is generated by (this number + 1) converted to base 62
@arjones
arjones / README.md
Created November 29, 2013 12:38 — forked from mbostock/.block

A treemap recursively subdivides area into rectangles; the area of any node in the tree corresponds to its value. This example uses color to encode different packages of the Flare visualization toolkit. Treemap design invented by Ben Shneiderman. Squarified algorithm by Bruls, Huizing and van Wijk. Data courtesy Jeff Heer.

@arjones
arjones / README.md
Last active December 29, 2015 17:39 — forked from mbostock/.block

Click on any arc to zoom in. Click on the center circle to zoom out.

A sunburst is similar to a treemap, except it uses a radial layout. The root node of the tree is at the center, with leaves on the circumference. The area (or angle, depending on implementation) of each arc corresponds to its value. Sunburst design by John Stasko. Data courtesy Jeff Heer.

@arjones
arjones / gist:8606453
Created January 24, 2014 21:07
.hiverc file
-- Load JSON Serde
add jar /home/haddop/lib/hive-serdes-1.1-SNAPSHOT.jar;
-- Print column names when stdout
set hive.cli.print.header=true;
-- Print current db at prompt hive (etl)>
set hive.cli.print.current.db=true;
-- Allow Hive to swith to Local Mode (without hadoop)
//==================================================================
// SPARK INSTRUMENTATION
//==================================================================
import com.codahale.metrics.{MetricRegistry, Meter, Gauge}
import org.apache.spark.{SparkEnv, Accumulator}
import org.apache.spark.metrics.source.Source
import org.joda.time.DateTime
import scala.collection.mutable
#!/bin/bash
######
# Reduce the precision to 1 decimal point == 11Km
# Requires BC (shell calculator)
function geo_reduce {
local PRECISION=1
local LAT=$(echo "$1" | cut -d',' -f2)
local LON=$(echo "$1" | cut -d',' -f1)
@arjones
arjones / JsonParser.scala
Last active January 20, 2016 13:01
Scala Json Parser Example
import org.json.JSONObject
case class Item(id: String, category: String, soldQuantity: Integer, price: Double, currencyId: String,
sellerId: Long, officialStoreId: String, condition: String, acceptMP: Boolean)
object JsonParser {
def parseSearch(json: String): List[Item] = {
try {
@arjones
arjones / logback.xml
Created June 15, 2016 14:02
Logback sample configuration with RollingFileAppender
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--Daily rolling file appender -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>logs/application.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>logs/application.%d{yyyy-MM-dd}.log.gz</FileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">