Skip to content

Instantly share code, notes, and snippets.

View spmallette's full-sized avatar

stephen mallette spmallette

View GitHub Profile
@spmallette
spmallette / gist:8862517
Created February 7, 2014 13:20
liberator context
{:request
{:ssl-client-cert nil,
:remote-addr "127.0.0.1",
:scheme
:http,
:query-params {},
:cemerick.friend/auth-config {:default-landing-uri "/",
:login-uri "/login",
:credential-fn #<core$partial$fn__4190 clojure.core$partial$fn__4190@18712bc9>,
:workflows [...]},
@spmallette
spmallette / gist:9100195
Created February 19, 2014 19:51
Graph API - Custom Traversal
public <T extends Traversal> T V(final Class<? extends T> t);
public default Traversal<Vertex, Vertex> V() {
return V(DefaultTraversal.class);
}
220_0018_r_000001_0 Scheduled 1 outputs (0 slow hosts and0 dup hosts)
2014-02-26 17:51:52,055 INFO org.apache.hadoop.mapred.ReduceTask: attempt_201402242220_0018_r_000001_0 Scheduled 1 outputs (0 slow hosts and0 dup hosts)
2014-02-26 17:51:52,061 INFO org.apache.hadoop.mapred.ReduceTask: attempt_201402242220_0018_r_000001_0 Scheduled 1 outputs (0 slow hosts and0 dup hosts)
2014-02-26 17:51:53,006 INFO org.apache.hadoop.mapred.ReduceTask: GetMapEventsThread exiting
2014-02-26 17:51:53,007 INFO org.apache.hadoop.mapred.ReduceTask: getMapsEventsThread joined.
2014-02-26 17:51:53,007 INFO org.apache.hadoop.mapred.ReduceTask: Closed ram manager
2014-02-26 17:52:28,703 INFO org.apache.hadoop.mapred.ReduceTask: attempt_201402242220_0018_r_000001_0 Merge of the 461 files in-memory complete. Local file is /var/lib/hadoop/mapred/taskTracker/hduser/jobcache/job_201402242220_0018/attempt_201402242220_0018_r_000001_0/output/map_5827.out of size 218666478
2014-02-26 17:54:35,074 INFO org.apache.hadoop.mapred.ReduceTask: at
g = TitanFactory.open('conf/titan-cassandra.properties')
//v1 = g.addVertex( null )
v1 = g.getVertex(4)
bytes = new byte[ 65536 ]
Arrays.fill( bytes, (byte) 0 )
i = 0;
lastTime = System.currentTimeMillis();
toRemove = null
def map(v, args) {
def u = g.v(v.id)
def l = []
u.inE.filter({!it.outV.outE.retain([it]).hasNext()}).id.fill(l)
u.outE.filter({!it.inV.inE.retain([it]).hasNext()}).id.fill(l)
def x = l.inject(" "){acc,val->acc = acc + "\t" + val}
return x.substring(1).trim()
}
@spmallette
spmallette / gist:eee03b57e92ec85ac0f4
Last active August 29, 2015 14:00
Decoding Permanent Locking Exception
gremlin> b = [ 64, 0, 0, 0, 0, 0, 0, 202 ] as byte[]
==>[B@150858bb
gremlin> r = new com.thinkaurelius.titan.diskstorage.util.ReadArrayBuffer(b)
==>64-0-0-0-0-0-0-202
gremlin> com.thinkaurelius.titan.graphdb.database.idhandling.VariableLong.readPositive(r)
==>36028797018964042
gremlin> ks = new com.thinkaurelius.titan.graphdb.database.serialize.kryo.KryoSerializer(true)
==>com.thinkaurelius.titan.graphdb.database.serialize.kryo.KryoSerializer@2ba74026
gremlin> x = ks.getDataOutput(40, true).writeObjectNotNull("10000000038529").getStaticBuffer()
@spmallette
spmallette / gist:71adfe53c367464ce9a4
Created May 14, 2014 18:08
PartitionGraphStrategyOptimizer
public void optimize(final Traversal traversal) {
// inject a HasStep after each GraphStep, VertexStep or EdgeVertexStep
final List<Class> stepsToLookFor = Arrays.<Class>asList(GraphStep.class, VertexStep.class, EdgeVertexStep.class);
final List<Integer> positions = new ArrayList<>();
final List<?> traversalSteps = traversal.getSteps();
for (int ix = 0; ix < traversalSteps.size(); ix++) {
final int pos = ix;
if (stepsToLookFor.stream().anyMatch(c -> c.isAssignableFrom(traversalSteps.get(pos).getClass()))) positions.add(ix);
}
@spmallette
spmallette / tp3-api.groovy
Last active August 29, 2015 14:01
Latest TP3 API
gremlin> g = TinkerFactory.createClassic()
==>tinkergraph[vertices:6 edges:6]
gremlin> g.v(1).properties
==>class=class com.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex
gremlin> g.v(1).properties()
==>name=p[name->marko]
==>age=p[age->29]
gremlin> g.v(1).values
==>name=marko
==>age=29

Keybase proof

I hereby claim:

  • I am spmallette on github.
  • I am spmallette (https://keybase.io/spmallette) on keybase.
  • I have a public key whose fingerprint is B076 D269 AF15 8264 2135 88BA F7A9 2444 A376 2BC4

To claim this, I am signing this object:

@spmallette
spmallette / titan-building-notes
Last active August 29, 2015 14:02
Building TinkerPop and Aurelius Stacks
# generate documentation
mvn -pl titan-dist package