This file contains 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 commands | |
import time | |
import sys | |
from socket import socket | |
import argparse | |
import os | |
import pymongo | |
from pymongo import Connection | |
import yaml |
This file contains 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
sed -i "s/{{hostname}}/`hostname`/g" /etc/supervisor/conf.d/celeryd.conf |
This file contains 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
package main | |
import ( | |
"flag" | |
"fmt" | |
) | |
var hostName = flag.String("host", "localhost", "Hostname or IP you want to run this service on") | |
var portNumber = flag.Int("port", 8080, "Port you want this service to listen on (default 8080)") |
This file contains 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
# Elastic configs | |
es_read_conf = { | |
"es.nodes" : "localhost", | |
"es.port" : "9200", | |
"es.resource" : "twitter/tweet" | |
} | |
es_write_conf = { | |
"es.nodes" : "localhost", | |
"es.port" : "9200", |
This file contains 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
# Elastic configs | |
es_read_conf = { | |
"es.nodes" : "localhost", | |
"es.port" : "9200", | |
"es.resource" : "twitter/tweet" | |
} | |
es_write_conf = { | |
"es.nodes" : "localhost", | |
"es.port" : "9200", |
This file contains 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 pandas as pd | |
from pymongo import MongoClient | |
# set connection with mongodb | |
def _connect_mongo(host, port, username, password, db): | |
""" A util for making a connection to mongo """ | |
if username and password: | |
mongo_uri = 'mongodb://%s:%s@%s:%s/%s' % (username, password, host, port, db) | |
conn = MongoClient(mongo_uri) |
This file contains 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 pandas.core.api import DataFrame | |
from pandas.tseries.tools import to_datetime | |
#save me at site-packages\pandas\io\cypher.py | |
def read_cypher(cypher, con, index_col=None, params = {},parse_dates = None, columns= None): | |
''' | |
Run a Cypher query against the graph at con, put the results into a df | |
Parameters |
This file contains 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 StringIO | |
from flask import Flask, Response | |
@app.route('/some_dataframe.csv') | |
def output_dataframe_csv(): | |
output = StringIO.StringIO() | |
some_dataframe.to_csv(output) |
This file contains 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 py2neo | |
import datetime | |
#where we write it | |
f_name = 'DBREPORT_%s.txt' % datetime.datetime.today().strftime('%Y-%m-%d') | |
#overwrite anything previous | |
with open(f_name,'wb') as f: | |
f.write('REPORT COMPILATION STARTED AT %s' % datetime.datetime.now()) |
This file contains 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
#!/usr/bin/env python | |
import sys | |
import pandas as pd | |
import pymongo | |
import json | |
def import_content(filepath): | |
mng_client = pymongo.MongoClient('localhost', 27017) |
OlderNewer