Skip to content

Instantly share code, notes, and snippets.

View spmallette's full-sized avatar

stephen mallette spmallette

View GitHub Profile
SELECT
ROW_NUMBER() OVER(ORDER BY {0}) as RowNum,
x.provider_id,
x.provider_profile_selected,
x.provider_profile_respondent,
x.provider_profile_media,
x.provider_profile_event,
x.provider_profile_clinical_trial,
x.provider_media_role_name,
x.articleCount,
@spmallette
spmallette / gist:6561141
Created September 14, 2013 11:14
Pixy REPL
gremlin> Grape.grab([group:'com.lambdazen.pixy',module:'pixy',version:'1.0-SNAPSHOT'])
==>null
gremlin> import com.lambdazen.pixy.*
==>import com.tinkerpop.gremlin.*
==>import com.tinkerpop.gremlin.java.*
...
==>import groovy.grape.Grape
==>import com.lambdazen.pixy.*
gremlin> GremlinGroovyPipeline.class.metaClass.pixy { PixyTheory pt, String query, Object... args -> pt.makePipe(query, args).pixyStep(delegate) }
==>null
@spmallette
spmallette / output.txt
Last active December 28, 2015 22:19
TinkerGraph has() v. filter()
gremlin> g = new TinkerGraph()
==>tinkergraph[vertices:0 edges:0]
gremlin> r = new Random()
==>java.util.Random@4841a34
gremlin> (0..<500000).each{g.addVertex([i:it,r:r.nextLong().toString().padLeft(21,"0")])};null
==>null
gremlin> g.v(0).map
==>{r=001842268616820437679, i=0}
// both queries return the same stuff -- 150211 things
// note that tests have been written in the blueprints suite to enforce these internal conventions for defining features
public interface Features {
public static final String FEATURE_TRANSACTIONS = "Transactions";
public static final String FEATURE_QUERY = "Query";
public static final String FEATURE_COMPUTER = "Computer";
@FeatureDescriptor(name = FEATURE_TRANSACTIONS,
description = "The text here will be used to provide some explanation of the feature on test failure.")
public default boolean supportsTransactions() {
return true;
@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()