Quantcast
Channel: python – I Failed the Turing Test
Browsing all 11 articles
Browse latest View live

MongoDB cookbook: Queries and Aggregations

Frequently accessed items are cached in memory, so that MongoDB can provide optimal response time. MongoDB Shell in JavaScript Administration db.currentOp(); // slow queries db.currentOp({ "active":...

View Article



MongoDB cookbook: Indexes

Indexes are crucial for the efficient execution of queries and aggregations in MongoDB. Without indexes, MongoDB must perform a collection scan, i.e., scan every document in a collection. If a write...

View Article

Remotely debug a Python app inside a Docker container in Visual Studio Code

Visual Studio Code with Python extension has "Remote Debugging" feature which means you could attach to a real remote host as well as a container on localhost. NOTE: While you trace Python code, the...

View Article

Dot notation (obj.x.y.z) for nested objects and dictionaries in Python

Simple implementations of nested_getattr(obj, attr, default), nested_setattr(obj, attr, val) and nested_dict_get(dictionary, dotted_key). Nested Object import functools raise_attribute_error = object()...

View Article

Find circular imports in Python

What is circular imports? http://stackabuse.com/python-circular-imports/ You could use python -vv to inspect import relations. $ python -vv manage.py shell >>> from api.models import...

View Article


Print traceback call stack in Python

Extract Traceback From An Exception try: do_shit() except Exception as exc: print('----- start -----') tb = _hx_e.__traceback__ raise RuntimeError().with_traceback(tb) print('----- end -----') reef:...

View Article

Pipenv and Pipfile: The officially recommended Python packaging tool

You no longer need to use pip and virtualenv separately. Use pipenv instead. ref: https://github.com/pypa/pipenv https://pipenv.kennethreitz.org/en/latest/ Install $ pip install pipenv ref:...

View Article

Integrate with Google Cloud API in Python

google-cloud, Python idiomatic clients for Google Cloud Platform services. There is an older Python library also officially supported by Google, google-api-python-client, which is in maintenance mode....

View Article


碼天狗週刊 第 135 期 @vinta - Kubernetes, Python, MongoDB

本文同步發表於 CodeTengu Weekly - Issue 135。 The incomplete guide to Google Kubernetes Engine 根據前陣子搗鼓 Kubernetes 的心得寫了一篇文章,跟大家分享一下,希望有幫助。內容包含概念介紹、建立 cluster、新增 node pools、部署 ConfigMap、Deployment with...

View Article


mitmproxy: proxy any network traffic through your local machine

mitmproxy is your swiss-army knife for interactive HTTP/HTTPS proxy. In fact, it can be used to intercept, inspect, modify and replay web traffic such as HTTP/1, HTTP/2, WebSockets, or any other...

View Article

Run a Celery task at a specific time

Schedule Tasks You are able to run any Celery task at a specific time through eta (means "Estimated Time of Arrival") parameter. import datetime import celery @celery.shared_task(bind=True) def...

View Article
Browsing all 11 articles
Browse latest View live




Latest Images