- \l - databases
- \c testdb - select db
CREATE DATABASE crm_worker_log encoding='UTF8';
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import os | |
| import subprocess as sp | |
| import datetime | |
| __author__ = "Dmitry Khodakov <dmitryhd@gmail.com>" | |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import os.path | |
| import tornado.ioloop | |
| import tornado.web as web | |
| from jinja2 import Environment, FileSystemLoader | |
| from .util.user_interests import fill_slug, user_interests | |
| from .util.recommendations_connector import get_recommendations_for_user |
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
| try: | |
| from urlparse import urlparse, parse_qs # Python 2 | |
| except ImportError: | |
| from urllib.parse import urlparse, parse_qs # Python 3 | |
| def parse_utm(url): | |
| parsed = urlparse(url) | |
| return parse_qs(parsed.query, keep_blank_values=True) | |
| url = 'http://whatever.com/somepage?utm_one=3&something=4&utm_two=5&utm_blank&something_else' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| import matplotlib.pyplot as plt | |
| import matplotlib.pylab as pylab | |
| import seaborn as sns | |
| %matplotlib inline | |
| pylab.rcParams['figure.figsize'] = 12.0, 7.0 | |
| plt.rcParams['axes.labelweight'] = 'bold' | |
| plt.rcParams['axes.titleweight'] = 'bold' | |
| plt.rcParams['font.family'] = 'serif' |
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 IPython.core.display import HTML | |
| HTML(""" | |
| <style> | |
| .container {width: 1700px !important} | |
| </style> | |
| """) |
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 stopit | |
| with stopit.ThreadingTimeout(3) as to_ctx_mgr: | |
| assert to_ctx_mgr.state == to_ctx_mgr.EXECUTING | |
| # Something potentially very long but which | |
| sleep(2) | |
| print('done') | |
| print(bool(to_ctx_mgr)) |