Skip to content

Instantly share code, notes, and snippets.

View justindavies's full-sized avatar

Justin Davies justindavies

View GitHub Profile
@justindavies
justindavies / import_transactions.rb
Created April 14, 2018 13:46
Import Ethereum transactions using Ruby
#!/usr/local/bin/ruby
# Used to export Blocks from a Web3 compatible endpoint
# I use:
# geth --rpc --rpccorsdomain http://localhost:8080 --fast
# Need to add a unique index for tx
# db.transactions.createIndex({"hash":1},{unique:1})
@justindavies
justindavies / DocIterator.py
Created June 11, 2017 14:11
Doc2Vec Iterator
from gensim.models.doc2vec import LabeledSentence
import re
class DocIterator(object):
def __init__(self, doc_list, labels_list):
self.labels_list = labels_list
self.doc_list = doc_list
def __iter__(self):
for idx, doc in enumerate(self.doc_list):
@justindavies
justindavies / doc2vec.py
Created June 11, 2017 14:11
Create doc2vec model from data
from gensim.models.doc2vec import LabeledSentence
from os import listdir
from os.path import isfile, join
import gensim
import DocIterator as DocIt
import MySQLdb
docLabels = []
data = []
import tweepy
from tweepy import Stream
from tweepy.streaming import StreamListener
import sys
from newspaper import Article
from time import mktime
auth = tweepy.OAuthHandler("XXXXXXXXXXXX")
auth.set_access_token("XXXXXXXXXXXX")