Skip to content

Instantly share code, notes, and snippets.

Avatar
🏔️

ixaxaar ixaxaar

🏔️
View GitHub Profile
View gist:8858138
# DATA FRAME OPERATIONS IN R
# Create data frame
# A dataset is ~ table (list of vectors)
id <- c(1,2,3)
name <- c("John", "Kirk", "AJ")
age <- c(21,27,18)
employees <- data.frame(ID=id, Name=name, Age=age)
employees
View object-watch.js
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
View gist:9813672
# DATA FRAME OPERATIONS IN R
# Create data frame
# A dataset is ~ table (list of vectors)
id <- c(1,2,3)
name <- c("John", "Kirk", "AJ")
age <- c(21,27,18)
employees <- data.frame(ID=id, Name=name, Age=age)
employees
@ixaxaar
ixaxaar / cql_constructor.js
Created Jul 11, 2014
CQL query generator in node.js
View cql_constructor.js
var _ = require('underscore');
var cassandra = function(client) {
var that = this;
that.__query__ = "";
that.__error__ = false;
that.__q__ = null;
return that;
};
@ixaxaar
ixaxaar / broker.py
Created Sep 27, 2014
A simple zeromq PUSH-PULL streamer device
View broker.py
#!/usr/bin/env python
import zmq
def main():
try:
context = zmq.Context(1)
# Socket facing clients
frontend = context.socket(zmq.PULL)
@ixaxaar
ixaxaar / server.py
Created Sep 27, 2014
Simple zeromq push server
View server.py
#!/usr/bin/env python
import time
import zmq
def server():
context = zmq.Context()
socket = context.socket(zmq.PUSH)
socket.setsockopt(zmq.LINGER,0)
socket.connect('tcp://127.0.0.1:8880')
@ixaxaar
ixaxaar / client.py
Created Sep 27, 2014
Simple zeromq client that keeps track of dropped messages
View client.py
#!/usr/bin/env python
import zmq
import time
def client():
context = zmq.Context()
socket = context.socket(zmq.PULL)
socket.setsockopt(zmq.LINGER, -1)
View lda_spark_expectation_maximization.scala
/*
This example uses Scala. Please see the MLlib documentation for a Java example.
Try running this code in the Spark shell. It may produce different topics each time (since LDA includes some randomization), but it should give topics similar to those listed above.
This example is paired with a blog post on LDA in Spark: http://databricks.com/blog
Spark: http://spark.apache.org/
*/
import scala.collection.mutable
View live_plot.py
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2015 Swen Wenzel <swenzel@uos.de>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ixaxaar
ixaxaar / CorsSupport.scala
Last active Sep 18, 2015 — forked from joseraya/CorsSupport.scala
CORS directive for Spray
View CorsSupport.scala
package com.agilogy.spray.cors
import spray.http.{HttpMethods, HttpMethod, HttpResponse, AllOrigins}
import spray.http.HttpHeaders._
import spray.http.HttpMethods._
import spray.routing._
// see also https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
trait CORSSupport {
this: HttpService =>