Skip to content

Instantly share code, notes, and snippets.

View tarzanjw's full-sized avatar
💭
I may be slow to respond.

Học Đỗ tarzanjw

💭
I may be slow to respond.
  • VinID
  • Ha Noi, Viet Nam
View GitHub Profile
@tarzanjw
tarzanjw / install_cloudsql_proxy_as_servie.sh
Last active June 21, 2017 11:20
Install CloudSQL Proxy as service
# This script will create a service, named cloudsql to make cloudsql_proxy running
# It will create a directory to store the socket file
# It need to be run in sudo mode
export INSTANCE_ID=your-instance-id
export SOCKET_DIR=/cloudsql
git clone https://github.com/openach/cloudsql-service
cd cloudsql-service
./setup.sh
@tarzanjw
tarzanjw / main.py
Last active August 17, 2016 17:14
Lời giải cho việc chuyển vợ chồng cho Đạt : ))
# coding=utf-8
import copy
import collections
import logging
import itertools
__author__ = 'Tarzan'
_logger = logging.getLogger(__name__)
@tarzanjw
tarzanjw / lookup_object.py
Last active August 29, 2015 14:07
Python Recipes
def _lookup_object(spec):
"""
Looks up a module or object from a some.module:func_name specification.
For backward compatibility, if the spec does not contain ':' character, the
last '.' will be replaced as ':'
:param string spec: the specification to be looked up
"""
if ':' not in spec:
parts, target = spec.rsplit('.', 1)
else:
@tarzanjw
tarzanjw / README.md
Created August 28, 2014 10:19
pyramid view __doc__

To show the doc, just append __doc__ to your request path info

Example: /api/get/item/info/__doc__

  1. Download api_doc.py and put it into your project.
  2. config.include('path to api_doc.py file')
  3. (Optional): doc response will be prettier if you have docutils installed
@tarzanjw
tarzanjw / cqlengine.log
Created July 1, 2014 02:55
py.test cqlengine on python3.4
============================= test session starts ==============================
platform linux -- Python 3.4.0 -- py-1.4.20 -- pytest-2.5.2
collected 0 items / 37 errors
==================================== ERRORS ====================================
__________________ ERROR collecting tests/test_batch_query.py __________________
../_pytest/python.py:451: in _importtestmodule
> mod = self.fspath.pyimport(ensuresyspath=True)
../py/_path/local.py:608: in pyimport
> __import__(pkgpath.basename)
@tarzanjw
tarzanjw / waitress_cassandra_error.log
Created June 26, 2014 04:52
Error with waitress and cassandra
2014-06-26 11:39:58,681 DEBUG [cassandra.cluster][MainThread] [control connection] Opening new connection to 10.0.0.131
2014-06-26 11:39:58,693 DEBUG [cassandra.cluster][MainThread] [control connection] Established new connection <AsyncoreConnection(26400848) 10.0.0.131:9042>, registering watchers and refreshing schema and topology
2014-06-26 11:39:58,815 DEBUG [cassandra.cluster][MainThread] [control connection] Refreshing node list and token map using preloaded results
2014-06-26 11:39:58,815 DEBUG [cassandra.cluster][MainThread] [control connection] Finished fetching ring info
2014-06-26 11:39:58,815 DEBUG [cassandra.cluster][MainThread] [control connection] Rebuilding token map due to topology changes
2014-06-26 11:39:58,817 DEBUG [cassandra.cluster][MainThread] [control connection] Attempting to use preloaded results for schema agreement
2014-06-26 11:39:58,817 DEBUG [cassandra.cluster][MainThread] [control connection] Schemas match
2014-06-26 11:39:59,191 DEBUG [cassandra.cluster][MainThread] [control c