Skip to content

Instantly share code, notes, and snippets.

View dmpeters's full-sized avatar
👨‍🔧

David Peters dmpeters

👨‍🔧
View GitHub Profile
@dmpeters
dmpeters / backend.py
Last active August 29, 2015 14:22 — forked from dmitric/backend.py
class Backend(object):
def __init__(self):
engine = create_engine("mysql://{0}:{1}@{2}/{3}".format(options.mysql_user, options.mysql_pass, options.mysql_host, options.mysql_db)
, pool_size = options.mysql_poolsize
, pool_recycle = 3600
, echo=options.debug
, echo_pool=options.debug)
self._session = sessionmaker(bind=engine)
@classmethod
@dmpeters
dmpeters / foo.md
Last active August 29, 2015 14:21

The Perils of CouchDB / Postgres to the rescue

CouchDB as an application database kind of sucks. Basically the only reason to use it is because it easily supports unstructured data. Even so, its limitations have a ton of negative ripple effects on basically the entire development process.

Luckily, Postgres has an hstore column type and has recently added a json column type. json supports arbitrary JSON but is stored as text so operations are slower. hstore stores only a flat mapping of string keys and values in a fast binary format, but nesting is on tap for 9.4 (Q3 2014) and non-string types are on the roadmap. In the meantime, nesting can be simulated by storing the full path to a value as the string key, and types can be handled in the application layer including with a query building abstraction that automatically casts hstore values to their expected types in database queries.

Postgres supports a number of other features that all together make it look like a great solution for scalably storing m

sudo apt-get update
sudo apt-get install openjdk-6-jdk
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.8.deb
sudo dpkg -i elasticsearch-0.19.8.deb
# be sure you add "action.disable_delete_all_indices" : true to the config!!
# if you want to remove it:
sudo dpkg -r elasticsearch
VERSION=0.20.6
sudo apt-get update
sudo apt-get install openjdk-6-jdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$VERSION.deb
sudo dpkg -i elasticsearch-$VERSION.deb
# be sure you add "action.disable_delete_all_indices" : true to the config!!
@dmpeters
dmpeters / librets_ubuntu_recipe.txt
Last active October 15, 2018 01:11
librets ubuntu recipe
spin up vagrant precise64
sudo apt-get update && sudo apt-get install build-essential
### librets
sudo apt-get install libexpat1-dev libcurl3-dev libboost-dev libboost-filesystem-dev antlr antlr3 libantlr-dev swig libboost-program-options-dev python-dev
wget http://www.crt.realtors.org/projects/rets/librets/files/librets-1.5.3.tar.gz