Skip to content

Instantly share code, notes, and snippets.

Avatar

Avi Flax aviflax

View GitHub Profile
View profiling nb2.js with node 0.1.21
Statistical profiling result from v8.log, (3315 ticks, 25 unaccounted, 0 excluded).
[Unknown]:
ticks total nonlib name
25 0.8%
[Shared libraries]:
ticks total nonlib name
2512 75.8% 0.0% /usr/lib/libSystem.B.dylib
668 20.2% 0.0% /usr/local/bin/node
View XmlSanity Performance.story
import com.arc90.xmlsanity.validation.*
/* These scenarios were set up for an aluminum 13" Apple MacBook,
2.4 GHz Intel Core 2 Duo, 4 GB RAM, and an SSD; running OS X 10.6.2, Java 1.6.0_17 64-bit, and easyb 0.9.6 */
scenario "Single-Threaded XSD validation should be fast", {
given "an XSD file", {
xsdFile = new File("resources/schemata/wadl.xsd")
}
View node_listen.js
// Listens on a port and just prints whatever it receives.
// Very useful for debugging
var net = require('net'),
sys = require('sys');
var server = net.createServer(function (stream) {
stream.setEncoding('utf8');
stream.addListener('connect', function () {
View pretty-print-xml-string-with-jdom.cfml
<cffunction name="prettyXml">
<cfargument name="xml" required="yes" type="string" />
<!--- initialize sax builder --->
<cfset builder = createObject("java", "org.jdom.input.SAXBuilder").init()>
<!--- initialize the formatter --->
<cfset format = createObject("java", "org.jdom.output.Format").getPrettyFormat()>
<!--- initialize the outputer --->
<cfset out = createObject("java", "org.jdom.output.XMLOutputter").init(format)>
@aviflax
aviflax / client.groovy
Created Jan 20, 2011
A server and client for very simple benchmarking of Restlet 1.1 and 2.0. The focus is on a fixed server using Restlet 2.0.4 with Jetty, being used by various client scenarios — Restlet 1.1 and 2.0, Apache HttpClient 3.1 and 4.0, the Restlet Net connector.
View client.groovy
/*** SETTINGS ***/
requestsToSend = args.length >= 1 ? args[0] as Integer : 1000
concurrency = args.length >= 2 ? args[1] as Integer : 10
port = args.length >= 3 ? args[2] as Integer : 3000
/*** /SETTINGS ***/
@aviflax
aviflax / apache_client_3.groovy
Created Jan 20, 2011
Benchmarking HTTP client performance using Apache HttpClient 3.1 and 4.0 with and without Restlet 1.1 and 2.0. The server is a constant value (always warmed up) and I tried to make the scripts as identical as possible.
View apache_client_3.groovy
#!/usr/bin/env groovy -cp restlet-1.1.10/httpclient/*
/*** SETTINGS ***/
requestsToSend = args.length >= 1 ? args[0] as Integer : 10000
concurrency = args.length >= 2 ? args[1] as Integer : 10
port = args.length >= 3 ? args[2] as Integer : 3000
@aviflax
aviflax / share_screen.py
Created Feb 10, 2011
über-simple screen sharing for anyone running OS X. By Rui Carmo: http://the.taoofmac.com/space/blog/2006/03/12 with a few tweaks by Avi Flax <avif@arc90.com>
View share_screen.py
#!/usr/bin/env python
## uber-simple screen sharing for OS X
## by Rui Carmo - http://the.taoofmac.com/space/blog/2006/03/12
## with a few tweaks by Avi Flax <avif@arc90.com>
import os, socket, datetime, SimpleHTTPServer, SocketServer, StringIO, sys
if len(sys.argv) >= 2:
PORT = int(sys.argv[1])
@aviflax
aviflax / annotation test.html
Created Feb 13, 2011
Illustrates a problem I'm having with dygraph annotations
View annotation test.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Annotation Test</title>
<meta name="author" content="Avi Flax">
<script src="dygraph-combined.js"></script>
<script>
@aviflax
aviflax / map.js
Created Apr 6, 2011
CouchDB map/reduce view for getting max integer ID
View map.js
function(doc) {
emit(null, doc._id);
}
@aviflax
aviflax / clipboardserver.groovy
Created May 9, 2011
Simple little web app for clipboard exchange -- handles text and files
View clipboardserver.groovy
#!/usr/bin/env groovy
@GrabResolver(name='restlet', root='http://maven.restlet.org/')
@Grab(group='org.restlet.jse', module='org.restlet', version='[2.0,2.1[')
@Grab('commons-lang:commons-lang:2.4')
import java.awt.*
import java.awt.datatransfer.*
import java.io.*
import java.util.logging.*