Skip to content

Instantly share code, notes, and snippets.

@zcox
zcox / RexsterGraphTest.scala
Last active December 21, 2015 11:09
Multiple threads all using the same RexsterGraph instance, each one creates a new vertex then sets many properties on it. Runs against Titan Server (Cassandra) 0.3.2. Exceptions ensue.
package com.pongr
import grizzled.slf4j.Logging
import com.tinkerpop.blueprints.Graph
import com.tinkerpop.blueprints.impls.rexster.RexsterGraph
import java.util.concurrent.CountDownLatch
class CreateVertexAndSetProperties(g: Graph, latch: CountDownLatch, id: String, propetyCount: Int) extends Runnable with Logging {
override def run() {
debug("Starting vertex %s using graph %s..." format (id, g))
@zcox
zcox / gist:6193780
Last active December 20, 2015 20:59
Titan Server 0.3.1 Upstart script for Ubuntu 12.04. Place the content below into /etc/init/titan.conf. Use `sudo start titan` to start the Titan server, and `sudo stop titan` to stop it. Titan will also auto-start if server is rebooted.
#http://upstart.ubuntu.com/cookbook/#introduction
author "Zach Cox <[email protected]>"
description "Titan+Cassandra+Rexster"
version "0.3.1"
#2=regular running mode, 3,4,5 are aliases for 2
start on runlevel [2345]
#0=shutdown, 1=single-user mode, 6=reboot
@zcox
zcox / gist:4399573
Created December 28, 2012 16:47
Successful request/response using server directly
2012-12-28 16:45:44,289 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - New connection accepted on /0.0.0.0:5555
2012-12-28 16:45:44,290 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Executing command Register(spray.io.ConnectionActors$$anon$1@160851e0)
2012-12-28 16:45:44,291 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Reading from connection
2012-12-28 16:45:44,291 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Read 175 bytes
2012-12-28 16:45:44,294 DEBUG c.p.api.PongrAPI$$anonfun$1$$anon$1 - GET /ping => 200 OK 'pongr' took 1 msec
2012-12-28 16:45:44,295 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Executing command Send(spray.io.ConnectionActors$$anon$1@160851e0,List(java.nio.HeapByteBuffer[pos=0 lim=152 cap=160]),None)
2012-12-28 16:45:44,295 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Writing to connection
2012-12-28 16:45:44,295 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Wrote 152 bytes
2012-12-28 16:45:44,355 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - R
@zcox
zcox / gist:4399432
Created December 28, 2012 16:35
App at rest. Shows connections being opened & closed. One HTTP request by ELB to /healthcheck.
2012-12-28 16:29:52,380 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - New connection accepted on /0.0.0.0:5555
2012-12-28 16:29:52,381 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Executing command Register(spray.io.ConnectionActors$$anon$1@6adb93a2)
2012-12-28 16:29:52,381 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Reading from connection
2012-12-28 16:29:52,381 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Closing connection due to PeerClosed
2012-12-28 16:29:52,382 DEBUG spray.can.server.HttpServer com-pongr-api-PongrAPI-akka.actor.default-dispatcher-4 - Stopping connection actor, connection was closed due to PeerClosed
2012-12-28 16:30:06,693 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Reading from connection
2012-12-28 16:30:06,694 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Closing connection due to PeerClosed
2012-12-28 16:30:06,694 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - New connection accepted on /0.0.0.0:5555
2012-12-28 16:30:06,694 DEBUG spray.can.s
@zcox
zcox / gist:4399338
Last active December 10, 2015 07:09
Successful request/response through ELB
2012-12-28 16:18:37,080 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Reading from connection
2012-12-28 16:18:37,083 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Read 274 bytes
2012-12-28 16:18:37,083 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - New connection accepted on /0.0.0.0:5555
2012-12-28 16:18:37,083 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - New connection accepted on /0.0.0.0:5555
2012-12-28 16:18:37,084 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Executing command Register(spray.io.ConnectionActors$$anon$1@58e90d6d)
2012-12-28 16:18:37,084 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Executing command Register(spray.io.ConnectionActors$$anon$1@2c709cb5)
2012-12-28 16:18:37,082 DEBUG c.p.api.PongrAPI$$anonfun$1$$anon$1 - GET /ping => 200 OK 'pongr' took 0 msec
2012-12-28 16:18:37,085 DEBUG spray.io.IOBridge com-pongr-api-PongrAPI-1 - Executing command Send(spray.io.ConnectionActors$$anon$1@5e9f01e6,List(java.nio.HeapByteBuffer[pos=0 lim=152 cap=160]),None)
20
@zcox
zcox / gist:3287436
Created August 7, 2012 17:18
Java8 default methods syntax proposal
public interface Foo {
public String bar() {
return "bar";
}
public String baz();
}
@zcox
zcox / gist:1933265
Created February 28, 2012 15:48
Sanyo SCP-3810 User-Agent
Mozilla/4.0 (BREW 3.1.5; U; en-us; Sanyo; NetFront/3.5.1/AMB) Boost SCP3810
@zcox
zcox / gist:1313183
Created October 25, 2011 15:41
blueprints-neo4j perf test
package write
import com.tinkerpop.blueprints.pgm.{ Index, Vertex, Edge, IndexableGraph, TransactionalGraph }
import com.tinkerpop.blueprints.pgm.impls.orientdb.OrientGraph
import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph
import com.tinkerpop.blueprints.pgm.TransactionalGraph.Conclusion._
import scala.collection.JavaConversions._
import java.util.Date
object PerfTest {
@zcox
zcox / gist:1296389
Created October 18, 2011 19:14
Java forgetting parameterized return type
public class Base<T extends Base> {
public T f1() {
return (T) this; //Warning => Type safety: Unchecked cast from Forgetful.Base<T> to T
}
public T f2() {
return (T) this; //Warning => Type safety: Unchecked cast from Forgetful.Base<T> to T
}
}
@zcox
zcox / gist:1295890
Created October 18, 2011 16:36
Typesafe fluent interface hierarchy using type constructors
trait PipeFunction[A, B]
class NullPipeFunction[A, B] extends PipeFunction[A, B]
trait Pipe[S, E]
class Pipeline[S, E, T[S, E]] extends Pipe[S, E] {
def add[F](pipe: Pipe[E, F]): T[S, F] =
throw new UnsupportedOperationException()
}