Skip to content

Instantly share code, notes, and snippets.

@s3u
s3u / gist:2783030
Created May 24, 2012 17:45
Example
Channel = [
{
"creationDate": "Tue May 22 2012 17:23:11 GMT+0530 (IST)",
"id": "2642",
"lcn": "17",
"logo": "627",
"name": "ETV Marathi",
"valid": "1"
},
{
yum groupinstall "Development Tools"
yum install expat-devel
yum install openssl openssl-devel
yum install expat expat-devel
# Download node
cd <node dir>
configure
make
sudo make install
var http = require('http');
var assert = require('assert');
var options = {
method: 'GET',
port: 3000,
host: '127.0.0.1',
path: '/'
};
var http = require('http'),
EventEmitter = require('events').EventEmitter;
var emitter = new EventEmitter();
var server = http.createServer(function (req, res, proxy) {
emitter.on('done', function (e) {
if(e) {
res.writeHead(502);
res.end();

A table in the tables dir

create table parse.response
    on select get from 'http://maps.googleapis.com/maps/api/geocode/json?sensor=true&address={^address}'
        using patch 'parse-response.js'

Patch in the same dir

// args.body would be an array of buffers

exports['parse response'] = function(args) {

create table foo 
    on insert post to 'uri'
          using bodyTemplate... type ...
          with part ... 

insert into foo (...) values (...)
   with part "{req.part[0]}";
update bar ...
   with part "{req.part[0]}";

insert into foo values "{req.body}";

@s3u
s3u / udfs.md
Created April 8, 2012 02:39
ql.io - User Defined Functions

User Defined Functions

A user-defined function is a Javascript function that can be used in where clauses and columns clauses.

UDFs in the Where Clause

When specified in the where clause, a UDF can apply custom logic to filter out or re-shape a row from a data set.

@s3u
s3u / gist:2227815
Created March 28, 2012 16:08
UDF and JSONPath
a1 = [{
"name": "Brand-A",
"ns": "df",
"aspectValue" : [{ "name": "Gap"},
{"name": "Addidas"},
{"name": "Gravati"}]
},
{
"name": "Brand-B",
"ns": "df",
@s3u
s3u / gist:2172946
Created March 23, 2012 17:21
IPC Test
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
var numReqs = 0;
if(cluster.isMaster) {
// Fork workers.
for(var i = 0; i < numCPUs; i++) {
var worker = cluster.fork();
worker.on('message', function (msg) {
@s3u
s3u / gist:2172768
Created March 23, 2012 16:58
IPC - 1 message per req
~> siege -c 100 -t 2m http://localhost:3030
** SIEGE 2.70
** Preparing 100 concurrent users for battle.
The server is now under siege...
Lifting the server siege... done.
Transactions: 4366377 hits
Availability: 100.00 %
Elapsed time: 119.26 secs
Data transferred: 49.97 MB
Response time: 0.00 secs