Skip to content

Instantly share code, notes, and snippets.

@mumrah
mumrah / OpenCVFPSTest.java
Created July 16, 2011 02:49
JavaCV: read FPS from a file
import static com.googlecode.javacv.cpp.opencv_highgui.*;
public class OpenCVFPSTest {
public static void main(String args[]) {
CvCapture capture = cvCreateFileCapture("big_buck_bunny_480p_surround-fix.avi");
double fps = cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
System.out.println("FPS: " + fps);
}
}
# Make the SVN repo:
svn mkdir protocol://path/to/repo
# Tell Git to track it (by default the SVN repo becomes the remote branch "git-svn"):
git svn init protocol://path/to/repo
git svn fetch
# Checkout the empty "git-svn" branch to a local integration branch:
git checkout -b svn-integration --track git-svn
# Merge the Git branch (non-fast-forwarded!) into the integration branch:
git merge --no-ff --no-commit feature
# Commit!
@mumrah
mumrah / index.html
Created September 15, 2011 17:12 — forked from enjalot/index.html
[d3cast] Simple Bar Chart example with d3.js
<!-- Annotated javascript available at http://enja.org/code/tuts/d3/bar -->
<!-- Code walkthrough screencast available at -->
<html>
<head>
<title>Enjalot's Bar</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
.bar rect {
@mumrah
mumrah / aggregate.awk
Created September 28, 2011 15:51
Use associative arrays to aggregate data with Awk
BEGIN {
FS=",";
OFS=",";
}
{
COUNTS[$1] += 1;
TOTALS[$1] += $2;
}
@mumrah
mumrah / http.awk
Created September 30, 2011 20:33
Incomplete HTTP server in Awk
BEGIN {
RS = ORS = "\r\n"
HttpService = "/inet/tcp/8000/0/0"
while(1) {
_NR = 0
while((HttpService |& getline) > 0) {
_NR += 1
handle_header($0)
}
close(HttpService)
File propFile = new File("oozie.action.output.properties");
Properties props = new Properties();
props.put("foo", "bar");
OutputStream os = new FileOutputStream(propFile);
props.store(os, "");
os.close();
#!/bin/bash
(base64 -d | bash) <<EOF
IyEvYmluL2Jhc2gKCmVjaG8gImhlbGxvLCB3b3JsZCIK
EOF
@mumrah
mumrah / gist:2304405
Created April 4, 2012 18:17
Code as data
echo "IyEvYmluL2Jhc2gKKGJhc2U2NCAtZCB8IHB5dGhvbikgPDxFT0YKY0hKcGJuUW9JbXRwYkd3Z2JXVWlLUW89CkVPRgo=" | base64 -d | bash
@mumrah
mumrah / gist:2788429
Created May 25, 2012 14:28
kmeans cli docs
$ /opt/mahout-distribution-0.6/bin/mahout kmeans -h
MAHOUT_LOCAL is not set; adding HADOOP_CONF_DIR to classpath.
no HADOOP_HOME set, running locally
Class: org.apache.mahout.driver.MahoutDriver
Args: kmeans -h
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/mahout-distribution-0.6/mahout-examples-0.6-job.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/mahout-distribution-0.6/lib/slf4j-jcl-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/mahout-distribution-0.6/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
@mumrah
mumrah / kafka-rest.md
Created August 3, 2012 14:35
Kafka REST proposal

REST interface for Kafka

Taking inspiration from the projects page...

I think it would really useful and pretty simple to add a REST interface to Kafka. I could see two possible routes (not mutually exclusive): using HTTP as a dumb transport layer, and using it with different media types for application-friendly consumption of messages (JSON, XML, etc). The dumb transport would be useful for languages without first-class clients, and the content-type extension would be useful for writing web apps that are Kafka-enabled.

HTTP as a transport

Consuming data