Skip to content

Instantly share code, notes, and snippets.

View davebshow's full-sized avatar

David Michael Brown davebshow

  • Vancouver Island
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import json
import pickle
import random
def write_schema(graph, filename):
s = NX2SylvaSchemaConverter(graph)
s.build_schemas(filename)
CREATE INDEX ON :Author(id);
CREATE INDEX ON :Paper(id);
USING PERIODIC COMMIT
LOAD CSV FROM "file:///home/davebshow/git/projx/data/opsahl-collaboration/out.opsahl-collaboration"
AS line FIELDTERMINATOR " "
MERGE (author:Author {id: line[0]})
MERGE (paper:Paper {id: line[1]})
MERGE (author)-[:WROTE]-(paper);
import asyncio
import json
from tornado import escape, gen
from tornado.web import RequestHandler, Application, url
from tornado.platform.asyncio import AsyncIOMainLoop
from gizmo import AsyncGremlinClient
class GremlinHandler(RequestHandler):
@csrf_exempt
def pdf_gen_view(request, graph_slug, template_slug):
def render(request, graph_slug, template_slug):
graph = get_object_or_404(Graph, slug=graph_slug)
template = get_object_or_404(ReportTemplate, slug=template_slug)
queries = template.queries.all()
queries = [{'series': query.execute(headers=True), 'name': query.name,
'id': query.id, 'results': query.query_dict['results']}
for query in queries]
host: localhost
port: 8182
threadPoolWorker: 4
gremlinPool: 16
scriptEvaluationTimeout: 30000
serializedResponseTimeout: 30000
channelizer: com.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
g: conf/titan-berkeleydb.properties}
plugins:
"""Simple benchmark based on aiohttp benchmark client.
https://github.com/KeepSafe/aiohttp/blob/master/benchmark/async.py
"""
import argparse
import asyncio
import collections
import random
import aiogremlin
import json
import time
from TwitterAPI import TwitterAPI
# This is the object that we will use to send the request to Twitter
# A request is a HTTP request, just like your browser does when it goes to a website!
api = TwitterAPI(consumer_key, consumer_secret, access_token_key,
access_token_secret)
Django==1.6.7
GraphLab-Create==0.3.0 - 1.4.1 (2.7)
Parsley==1.1 - 1.2 (3.3)
Pillow==2.4.0 - 2.9.0 (3.4)
South==0.8.4
amqp==1.4.5 - 1.4.6 (3.3)
anyjson==0.3.3 - (3.1) (REMOVE???)
argparse==1.2.1
billiard==3.3.0.17 - 3.3.0.20 (3.3)
boto==2.29.1 - 2.3.8 (3.4)
import json
with open("output3.txt", "r") as f:
for line in f:
print(json.loads(line))