I hereby claim:
- I am dmpeters on github.
- I am dmpeters63 (https://keybase.io/dmpeters63) on keybase.
- I have a public key ASAnsztVeuUCPoBehuG5qth7wvALLo79Gp5S8zgZI9Y7kQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
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 |
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
{ | |
"builders": [{ | |
"type": "amazon-ebs", | |
"source_ami": "ami-de0d9eb7", | |
"region": "us-east-1", | |
}], | |
"provisioners": [{ | |
"type": "puppet-masterless", | |
"manifest_file": "site.pp" | |
}], |
{ | |
"builders": [{ | |
"type": "virtualbox", | |
"iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.3-server-amd64.iso", | |
"iso_checksum": "2cbe868812a871242cdcdd8f2fd6feb9" | |
}], | |
"builders": [{ | |
"type": "amazon-ebs", | |
"source_ami": "ami-de0d9eb7", | |
"region": "us-east-1", |
# Debian 7 x64, Ubuntu 14.04 x64, Ubuntu 12.04.4 x64 | |
*NOTE (tested on Digital Ocean VM's w/ > 512MB of RAM - gcc runs out of memory on VM's <= 512 MB) | |
apt-get update | |
aptitude safe-upgrade | |
apt-get install build-essential libboost-all-dev libcurl4-gnutls-dev autoconf antlr swig python-dev | |
*NOTE (for python 3 support add 'python3-dev' to the end of line 5) | |
cd /tmp | |
wget https://github.com/NationalAssociationOfRealtors/libRETS/archive/1.6.1.tar.gz |
var mt_referrer = document.cookie.match(new RegExp("mt_referrer" + '=([^;]+)')); | |
if(mt_referrer==null){ | |
console.log('FUCK') | |
}else{ | |
console.log(document.referrer) | |
} |
def formater_a(city): | |
pos1 = city.find('(') - 1 # finds the position of the first parenthese and substracts 1 | |
pos2 = city.find(')') - 2 # finds the position of the second parenthese and substracts 2 (assumes the the final 3 characters are a state abbreviation with a closing parenthese) | |
return '{0}, {1}'.format(city[:pos1], city[pos2:-1]) # returns a formated string of the city by slicing | |
def formater_b(city): | |
return city.replace(',', '').replace(' ', '-').lower() # returns a formated string of the city by removing any commas and replacing any empty spaces with dashes | |
z = ['Del Mar (San Diego, CA)', 'Alamo, CA'] |
import requests | |
url_list = ['url1', 'url2', 'etc'] | |
bad_urls = [] | |
good_urls = [] | |
for url in url_list: | |
r = requests.get(url) | |
if r.status_code == 404: | |
bad_urls.append(url) |