Skip to content

Instantly share code, notes, and snippets.

View spmallette's full-sized avatar

stephen mallette spmallette

View GitHub Profile
@spmallette
spmallette / env.txt
Last active August 29, 2015 14:05
hadoop config
export HADOOP_PREFIX="/home/smallette/jvm/hadoop-1.2.1"
export HADOOP_HOME=$HADOOP_PREFIX
export HADOOP_CONF_DIR=$HADOOP_PREFIX/conf
export HADOOP_MAPRED_HOME=$HADOOP_PREFIX
export HADOOP_COMMON_HOME=$HADOOP_PREFIX
export HADOOP_HDFS_HOME=$HADOOP_PREFIX
export CLASSPATH=$CLASSPATH:$HADOOP_CONF_DIR
export GIRAPH_HOME=/usr/local/giraph-1.0.0
@spmallette
spmallette / raw-neo4jgraph-batched.groovy
Last active August 29, 2015 14:05
test out driver for "batch loading"
import org.apache.commons.lang.RandomStringUtils
g = Neo4jGraph.open('/tmp/neo4j-test')
vertexCount = 500
edgeCount = 5000
rand = new Random()
ids = new java.util.concurrent.CopyOnWriteArrayList()
clock(1) {
(0..<vertexCount).each{
def v = g.addVertex('name',RandomStringUtils.random(32),'age',rand.nextInt(99)+1,'description',RandomStringUtils.random(256))
if (it % 100 == 0) g.tx().commit()
<ivysettings>
<settings defaultResolver="downloadGrapes"/>
<resolvers>
<chain name="downloadGrapes">
<ibiblio name="local" root="file:${user.home}/.m2/repository/" m2compatible="true"/>
<ibiblio name="central" root="https://repo1.maven.org/maven2/" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
@spmallette
spmallette / groovy-script-from-code.groovy
Created September 30, 2014 19:41
Groovy Script From Code
public static String getClosureBody(final Closure closure) {
def node = closure.getMetaClass().getClassNode().getDeclaredMethods("doCall")[0].getCode();
def writer = new StringWriter()
node.visit(new AstNodeToGremlinScriptVisitor(writer))
return writer.toString()
}
class AstNodeToGremlinScriptVisitor extends AstNodeToScriptVisitor {
def AstNodeToGremlinScriptVisitor(Writer writer, boolean showScriptFreeForm = true, boolean showScriptClass = true) {
super(writer, showScriptFreeForm, showScriptClass)
#!upstart
description "Gremlin Server"
env GREMLIN_USER=ubuntu
env GREMLIN_GROUP=ubuntu
env GREMLIN_PID_FILE=/var/run/gremlin.pid
env GREMLIN_HOME=/usr/local/gremlin-server-3.0.0.M5
env GREMLIN_LOG=/var/log/gremlin/gremlin-server.log
# uncomment the next line if you want Gremlin Server to start automatically after system reboots
---------------------------WARMUP CYCLE---------------------------
[warmup-1] requests: 1000 | time(s): 0.6018506 | req/sec: 1662 | too slow: 0
[warmup-2] requests: 1000 | time(s): 0.291263201 | req/sec: 3433 | too slow: 0
[warmup-3] requests: 1000 | time(s): 0.286894137 | req/sec: 3486 | too slow: 0
[warmup-4] requests: 1000 | time(s): 0.221449842 | req/sec: 4516 | too slow: 0
[warmup-5] requests: 1000 | time(s): 0.238359071 | req/sec: 4195 | too slow: 0
----------------------------TEST CYCLE----------------------------
[test-1] requests: 50000 | time(s): 4.774514652 | req/sec: 10472 | too slow: 0
[test-2] requests: 50000 | time(s): 4.031655607 | req/sec: 12402 | too slow: 0
[test-3] requests: 50000 | time(s): 4.034091315 | req/sec: 12394 | too slow: 0
graph = TinkerGraph.open()
graph.createIndex("name", Vertex.class)
g = graph.traversal()
// Query 1
person1 = graph.addVertex(label, 'person', 'name', 'Michael Sherman')
person2 = graph.addVertex(label, 'person', 'name', 'Zoltan Varju')
person3 = graph.addVertex(label, 'person', 'name', 'Peter Neubauer')
person4 = graph.addVertex(label, 'person', 'name', 'Grace Andrews')
person5 = graph.addVertex(label, 'person', 'name', 'Michael Hunger')
@graben1437
graben1437 / hbase.properties
Last active October 23, 2015 12:30
Data Loader to load sample ratings movie data (movies, users, ratings) into a Titan Graph
# titan 1.0.0
storage.backend=hbase
storage.hostname=<zookeeper server ips here>
#IMPORTANT - must match zookeeper.znode.parent property
# of your hadoop cluster
storage.hbase.ext.zookeeper.znode.parent=/hbase-unsecure
cache.db-cache = true
cache.db-cache-clean-wait = 20
<?xml version="1.0" encoding="UTF-8"?>
<configuration version="1.0" name="AllocationProfiling" description="Low overhead configuration safe for continuous use in production environments, typically less than 1 % overhead." provider="Oracle">
<producer uri="http://www.oracle.com/hotspot/jvm/" label="Oracle JDK">
<control>
<selection name="gc-level" default="detailed" label="Garbage Collector">
<option label="Off" name="off">off</option>
<option label="Normal" name="detailed">normal</option>
  1. git clone https://github.com/spmallette/rouge
  2. cd rouge
  3. git checkout mm-adt
  4. Build the gem: $ gem build rouge.gemspec
  5. Locally install the gem: $ gem install --local rouge-3.4.1.pre.mmadt.gem
  6. In the terminal where you are running asciidoctor set the ROUGE_VERSION environment variable: $ export ROUGE_VERSION=3.4.1.pre.mmadt
  7. Use mmadt as the "format" as in [source,mmadt] within asciidoc files.
  8. Set the source-highlighter to "rouge".
  9. $ asciidoctor -a source-highlighter=rouge -a rouge-style=thankful_eyes *.adoc -D html/