This gist covers
- some of the snippets of code that was used to remove the gists from generated pages.
- The tidying up of metadata and project strcuture
This gist covers
gremlin> g = TitanFactory.open("berkeleyje:/tmp/test") | |
==>titangraph[berkeleyje:/tmp/test] | |
gremlin> mgmt = g.getManagementSystem(); | |
==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@27c04377 | |
gremlin> id = mgmt.makePropertyKey("uid").dataType(Long.class).make() | |
==>uid | |
gremlin> mgmt.buildIndex('byUID',Vertex.class).addKey(id).buildCompositeIndex() | |
==>com.thinkaurelius.titan.graphdb.database.management.TitanGraphIndexWrapper@14f3c6fc | |
gremlin> mgmt.commit() | |
gremlin> for (int i=0;i<200;i++) { v = g.addVertex([uid:(int)Math.floor(i/2)])} |
import java.util.Enumeration; | |
import org.apache.commons.codec.binary.Base64; | |
import org.bouncycastle.asn1.ASN1InputStream; | |
import org.bouncycastle.asn1.ASN1Sequence; | |
import org.bouncycastle.asn1.DERBitString; | |
import org.bouncycastle.asn1.DEREncodable; | |
import org.bouncycastle.asn1.DERInteger; | |
import org.bouncycastle.asn1.DERObjectIdentifier; | |
import org.bouncycastle.asn1.DERTaggedObject; |
;;(require 'copterj.git-version) ;; Pick up DRY'd version numbers | |
(require 'clojure.contrib.io) ;; Needed to locate newrelic | |
(let [java-agent (str "-javaagent:" (clojure.contrib.io/pwd) "/lib/newrelic.jar")] | |
(defproject apij ~(copterj.git-version/git-describe) | |
:description "Hotelicopter's API" | |
:dependencies | |
[[com.hotelicopter/copterj "1.0.0-SNAPSHOT"] |
# Requirements | |
#sudo apt-get install libcurl4-gnutls-dev # for RCurl on linux | |
#install.packages('RCurl') | |
#install.packages('RJSONIO') | |
library('RCurl') | |
library('RJSONIO') | |
query <- function(querystring) { | |
h = basicTextGatherer() |
@Test | |
public void testSerliazingMapByMessagePack(){ | |
Map<String, Object> map = new HashMap<String, Object>(); | |
map.put("int", 1); | |
map.put("long", 1L); | |
map.put("date", new Date()); | |
map.put("string", "test"); | |
byte[] buffer = MessagePack.pack(map); | |
for (byte b : buffer) { |
#!/usr/bin/env python | |
def encodeZigZag32(n): return (n << 1) ^ (n >> 31) | |
def encodeZigZag64(n): return (n << 1) ^ (n >> 63) | |
def decodeZigZag32(n): return (n >> 1) ^ -(n & 1) | |
def decodeZigZag64(n): return (n >> 1) ^ -(n & 1) | |
def encodeVInt(n): | |
data = '' | |
while n >= 0x80: |
// Example using the Neo4j Fulltext Index with Gremlin-Groovy | |
// by James Thornton, http://jamesthornton.com | |
import com.tinkerpop.blueprints.pgm.impls.neo4j.util.Neo4jVertexSequence; | |
import com.tinkerpop.blueprints.pgm.impls.neo4j.util.Neo4jEdgeSequence; | |
Graph g = new Neo4jGraph('/tmp/neo4jmovies'); | |
indexManager = g.getRawGraph().index(); | |
indexConfig = ["provider":"lucene", "type":"fulltext"] |
;;; See the inspirational SO question: http://stackoverflow.com/questions/3346382 | |
;;; My old Gist with my first take on this: https://gist.github.com/492764 | |
;;; Don Jackson's Gist based on the above: https://gist.github.com/1846993 | |
;;; Licence: EPLv1, the same as Clojure | |
(in-ns 'clojure.tools.trace) | |
(defn trace-var | |
"If the specified Var holds an IFn and is not marked as a macro, its |
# Flatten a transparent image with a white background: | |
convert -flatten img1.png img1-white.png | |
# Make an image transparent | |
convert -transparent '#FFFFFF' nontransparent.gif transparent.png | |
# convert an image into tiles | |
convert -size 3200x3200 tile:single_tile.png final.png | |
# making a montage from a collection of images |