Skip to content

Instantly share code, notes, and snippets.

setInterval(function() {
var ts = Math.round((new Date()).getTime() / 1000);
client.query('BEGIN', function(err, result) {
if (err) {
return console.error('error running query', err);
}
for (var k in big_dict) {
// use hasOwnProperty to filter out keys from the Object.prototype
if (big_dict.hasOwnProperty(k)) {
var symbol = k;
@dimitrovs
dimitrovs / to_heatmap.py
Last active August 29, 2015 14:26
Convert CSV to heatmap
import numpy as np
import codecs
import matplotlib.pyplot as plt
import sys
import csv
reload(sys)
sys.setdefaultencoding("ISO-8859-1")
in_file = sys.argv[1]
out_file = sys.argv[2]
@dimitrovs
dimitrovs / gist:27556c0c1598e229cda2
Last active August 29, 2015 14:23
Greedy matching of complex names in CoreNLP XML
# This script matches names like "Mr. Bennet" (and not just "Bennet")
# in the XML output of CoreNLP, which has one word per token
import xml.etree.ElementTree as ET
e = ET.parse('test.xml').getroot()
word_list = []
character_dict = dict()