Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Kamerman justinkamerman

  • Instnt Inc.
  • Saint John, NB
View GitHub Profile
View gist:4740426
for i in {1..1000}; do curl -o /dev/null -s -w "%{time_total}\n" http://mybaselineurl.com
for i in {1..100}; do curl -o /dev/null -s -w "%{time_total}\n" http://mynewurl.com
@justinkamerman
justinkamerman / retweet.html
Created Oct 12, 2012
D3 force direced graph script
View retweet.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="d3.js"></script>
<style>
.link {
stroke: #ccc;
stroke-width: 2
}
@justinkamerman
justinkamerman / trace.py
Created Oct 12, 2012
Crawler for tracing retweet path
View trace.py
#!/usr/bin/python -u
#
# Usage: ./trace.py <tweetId>
#
import sys
import tweepy
import Queue
import time
import json
View reqrate.R
#!/usr/bin/env Rscript
#
# Usage: $0 <datafile>
#
# Expected data file format: t lt ts s lb rc rm tn dt by
#
myspan = 0.1
myargs <- commandArgs(TRUE)
file <- myargs[1]
View jtl2dat.sh
# Write column headers to data file
$ echo "t lt ts s lb rc rm tn dt by" > $DATAFILE
# Extract values in quotes
$ sed -n '/^<httpSample/{s/[^"]*\("[^"]*"\)[^"]*/\1 /gp}' $JTLFILE >> $DATAFILE
# Data file looks something like this...
$ head $DATAFILE
t lt ts s lb rc rm tn dt by
@justinkamerman
justinkamerman / hitsbargraph.R
Created Sep 21, 2012
Generate hit statistics bar chart from Apache httpd access logs
View hitsbargraph.R
#!/usr/bin/env Rscript
#
# Usage: $0 <apache_access_log>
#
# Generate hit statistics bar chart from Apache httpd access logs
#
d <- read.table ("access.dat")
colnames(d) <- c("ip", "path", "agent")
@justinkamerman
justinkamerman / hadoop-setup.sh
Created Jun 18, 2012
Cloud-init scripts for configuring a Ubuntu image for Hadoop
View hadoop-setup.sh
WRITE-MIME_MULTIPART=./bin/write-mime-multipart
.PHONY: clean
cloud-config.txt: ubuntu-config.txt hadoop-setup.sh
$(WRITE-MIME_MULTIPART) --output=$@ $^
clean:
$(RM) cloud-config.txt
View AhoIndexer.java
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;