Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time, os, json, glob | |
if not os.path.exists('records'): | |
os.makedirs('records') | |
max_page_fetched = 0 | |
for i in glob.glob('records/*.json'): | |
page = int(os.path.basename(i).split('-')[0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* dat-gui JavaScript Controller Library | |
* http://code.google.com/p/dat-gui | |
* | |
* Copyright 2011 Data Arts Team, Google Creative Lab | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomDarkColor() { | |
var lum = -0.35; | |
var hex = String('#' + Math.random().toString(16).slice(2, 8).toUpperCase()).replace(/[^0-9a-f]/gi, ''); | |
if (hex.length < 6) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; | |
var c, i, rgb = '#'; | |
for (i = 0; i < 3; i++) { | |
c = parseInt(hex.substr(i * 2, 2), 16); | |
c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); | |
rgb += ('00' + c).substr(c.length); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function currentYPosition() { | |
// Firefox, Chrome, Opera, Safari | |
if (self.pageYOffset) return self.pageYOffset; | |
// Internet Explorer 6 - standards mode | |
if (document.documentElement && document.documentElement.scrollTop) | |
return document.documentElement.scrollTop; | |
// Internet Explorer 6, 7 and 8 | |
if (document.body.scrollTop) return document.body.scrollTop; | |
return 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mongodb.conf | |
# Where to store the data. | |
# Note: if you run mongodb as a non-root user (recommended) you may | |
# need to create and set permissions for this directory manually, | |
# e.g., if the parent directory isn't mutable by the mongodb user. | |
dbpath=/var/lib/mongodb | |
#where to log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
height: 450 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, socket, redis, json | |
# config | |
stream = {'host': '127.0.0.1', 'port': 6000} # streaming data host / port | |
r = redis.Redis(host='127.0.0.1', port=6379) # redis instance host / port | |
# consume data from stdin and publish to redis on localhost | |
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
client.connect((socket.gethostbyname(stream['host']), stream['port'])) # host, port |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# class to gracefully handle sigint / sigterm (SO 18499497) | |
class SignalListener: | |
kill_now = False | |
def __init__(self): | |
signal.signal(signal.SIGINT, self.exit_gracefully) | |
signal.signal(signal.SIGTERM, self.exit_gracefully) | |
def exit_gracefully(self,signum, frame): | |
self.kill_now = True |