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
row_gen = ( [td.text(), td.next().text()] # left, right element | |
for table in d('.borderless').items() | |
for td in table('td:nth-child(1)').items() # left column | |
if table('th:first').text() == 'NUANS Reports & Preliminary Searches' and | |
td.next().text() in ('Active', 'Inactive') ) | |
10 loops, best of 3: 172 ms per loop |
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 csv | |
with open('companies.csv', 'wb') as csvfile: | |
csv.writer(csvfile, delimiter=',').writerows(row_gen) |
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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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
{'INTEGER': 12, 'HTMLTAG': 10, 'int': 4, 'formattedsize': 4, 'sizeindex': 4, 'string': 3, | |
'sizes': 3, 'decimals': 3, 'size': 2, 'code': 2, 'blockquote': 2, 'permitted': 2, 'specifiers': 2, | |
'default': 2, 'parameter': 2, 'FUNCTIONCALL': 2, 'CODE': 1, 'private': 1, 'eb': 1, 'gt': 1, | |
'gb': 1, 'error': 1, 'application': 1, 'format': 1, 'desktop': 1, 'pb': 1, 'formatsizebinary': 1, | |
'lt': 1, 'tb': 1, 'math': 1, 'return': 1, 'kb': 1, 'yb': 1, 'tostring': 1, 'zb': 1, 'amp': 1, | |
'mb': 1, 'bytes': 1, 'length': 1, 'double': 1} | |
['default', | |
'parameter', |
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 time | |
def timeit(f): | |
def timed(*args, **kwargs): | |
start = time.clock() | |
for _ in range(100): | |
f(*args, **kwargs) | |
end = time.clock() | |
return end - start |
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
brew cask install copy spectacle keka google-chrome sublime-text3 flash skype xscope silverlight transmission mailbox tunnelblick vagrant virtualbox forklift |
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
2014-01-19T19:31:15.749945+00:00 heroku[router]: at=info method=GET path=/ host=cubaofertas.herokuapp.com request_id=d2d7be18-94f6-49ef-af70-936643243397 fwd="98.248.237.110" dyno=web.1 connect=20ms service=16ms status=200 bytes=17 | |
2014-01-19T19:34:39.907278+00:00 heroku[router]: at=info method=GET path=/ host=cubaofertas.herokuapp.com request_id=7c79e16d-ae62-4368-95e0-dbdf48646239 fwd="98.248.237.110" dyno=web.1 connect=8ms service=17ms status=200 bytes=17 | |
2014-01-19T19:37:58.567302+00:00 app[web.1]: Received request: <Request 'http://cubaofertas.herokuapp.com/incoming_call' [POST]> | |
2014-01-19T19:37:58.567795+00:00 app[web.1]: Received call from: 185215890000 | |
2014-01-19T19:37:58.698903+00:00 app[web.1]: Sending message *Comen 2 y paga 1*,Le Chansonnier,J # 257 e/ 13 y 15 Vedado | *70% descuento*,Rio Mar,3ra y Final # 11 La Puntilla Playa to: 185215890000 | |
2014-01-19T19:37:58.750858+00:00 app[web.1]: Message response: {u'messages': [{u'error-text': u'Illegal Sender Address - rejected', u'network': u'US-FIXED' |
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
2014-01-19T20:30:21.647337+00:00 app[web.1]: Received request: <Request 'http://cubaofertas.herokuapp.com/incoming_call' [POST]> | |
2014-01-19T20:30:21.647911+00:00 app[web.1]: Received call from: 5352844172 | |
2014-01-19T20:30:21.755428+00:00 app[web.1]: Sending message *Comen 2 y paga 1*,Le Chansonnier,J # 257 e/ 13 y 15 Vedado | *70% descuento*,Rio Mar,3ra y Final # 11 La Puntilla Playa to: 5352844172 | |
2014-01-19T20:30:21.795734+00:00 app[web.1]: Message response: {u'messages': [{u'status': u'0', u'remaining-balance': u'17.89800000', u'message-price': u'0.03400000', u'message-id': u'030000003087C099', u'network': u'36801', u'to': u'5352844172'}], u'message-count': u'1'} | |
2014-01-19T20:30:21.982893+00:00 heroku[router]: at=info method=POST path=/incoming_call host=cubaofertas.herokuapp.com request_id=0c0a2ef2-a5f9-49e8-a887-946cbdb520ff fwd="54.219.106.107" dyno=web.1 connect=3ms service=332ms status=200 bytes=52 | |
2014-01-19T20:30:36.081406+00:00 app[web.1]: SMS Delivery Receipt: <Request 'http://cubaofertas.herokua |
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
hangup_static_xml = """ | |
<Response> | |
<Hangup reason="rejected"/> | |
</Response> | |
""" | |
@app.route('/incoming_call', methods=['POST']) | |
def handle_call(): | |
app.logger.info("Received request: {}".format(request)) |
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
2014-01-22T19:14:49.158429+00:00 heroku[web.1]: State changed from down to starting | |
2014-01-22T19:14:49.158064+00:00 heroku[web.1]: Unidling | |
2014-01-22T19:14:54.256439+00:00 heroku[web.1]: Starting process with command `gunicorn app:app` | |
2014-01-22T19:14:57.002691+00:00 app[web.1]: 2014-01-22 19:14:57 [2] [INFO] Starting gunicorn 18.0 | |
2014-01-22T19:14:57.012043+00:00 app[web.1]: 2014-01-22 19:14:57 [2] [INFO] Listening at: http://0.0.0.0:28673 (2) | |
2014-01-22T19:14:57.017659+00:00 app[web.1]: 2014-01-22 19:14:57 [2] [INFO] Using worker: sync | |
2014-01-22T19:14:57.030090+00:00 app[web.1]: 2014-01-22 19:14:57 [7] [INFO] Booting worker with pid: 7 | |
2014-01-22T19:14:57.421472+00:00 heroku[web.1]: State changed from starting to up | |
2014-01-22T19:14:58.176808+00:00 app[web.1]: Cubaofertas started | |
2014-01-22T19:14:58.503286+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=cubaofertas.herokuapp.com request_id=ab0523ee-2bff-4ec4-af95-01bf3332715c fwd="62.89.170.19" dyno=web.1 connect=2ms service=38ms status= |