Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"hash/crc32"
"runtime"
"time"
)
var buf []byte
@dynamix
dynamix / mega.pig
Created March 11, 2013 15:52
megapig
register '/home/martin/elephant-bird/pig/target/elephant-bird-pig-3.0.7-SNAPSHOT.jar';
register '/home/martin/json_simple-1.1.jar';
data = load '/events/2013/02/27/00h05' using com.twitter.elephantbird.pig.load.JsonLoader() as (json: map[]);
cleaned = foreach data generate json#'date' as date, (long)json#'clicks' as clicks, (long)json#'ais' as ais, (long)json#'pis' as pis, (long)json#'requests' as requests, (long)json#'bids' as bids,(long)json#'bid_requests' as bid_requests;
grouped = group cleaned by date;
result = foreach grouped generate group as date, SUM(cleaned.clicks), SUM(cleaned.ais), SUM(cleaned.pis), SUM(cleaned.requests), SUM(cleaned.bids), SUM(cleaned.bid_requests);
STORE result INTO '/tmp/martin/stats';
// variante 1
Class('AdsController', {
isa: Controller,
events : function() { return {
click : {
'#ads_overview a[metadata]' : this.update_meta.only('index'),
'.cancel' : this.redirect.only('new','edit'),
},
change : {
'select' : this.blubi.only('index'),
$.query_string = function(obj) {
var i = 0, queryString = [], chunks = [];
var is = function(o, t) {
return o != undefined && o !== null && (!!t ? o.constructor == t : true);
};
var addFields = function(arr, key, value) {
if (!is(value) || value === false) return;
var o = [key];
if (value !== true) {
o.push("=");
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then