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
# https://github.com/potatolondon/django-gcloud-connectors/blob/b5279492b5b4b615640efa7cc5783a2cee0c1cbe/gcloudc/forms/fields.py#L145 | |
import base64 | |
import itertools | |
_VC_KEY = "1K94KG8L" # Fixed key, don't change this!! | |
def model_path(obj): | |
return obj._meta.db_table |
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 base64 | |
import json | |
# Install google-api-python-client for Py27 | |
import googleapiclient.discovery | |
def publish(data): | |
# The PubSub topic is created beforehand. | |
topic = 'projects/my-app-engine-project/topics/my-topic' |
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
$ python3.6 -m timeit '[20, 50, 75, 100]' | |
10000000 loops, best of 3: 0.0618 usec per loop | |
$ python3.6 -m timeit '(20, 50, 75, 100)' | |
100000000 loops, best of 3: 0.0132 usec per loop | |
$ python3.6 -m timeit '{20, 50, 75, 100}' | |
10000000 loops, best of 3: 0.127 usec per loop | |
$ python2.7 -m timeit '[20, 50, 75, 100]' | |
10000000 loops, best of 3: 0.126 usec per loop | |
$ python2.7 -m timeit '(20, 50, 75, 100)' | |
100000000 loops, best of 3: 0.0134 usec 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
$ curl -i http://www.dailymail.co.uk/reader-comments/p/asset/readcomments/5774717?max=1&order=desc | |
HTTP/1.1 403 Forbidden | |
Server: AkamaiGHost | |
Mime-Version: 1.0 | |
Content-Type: text/html | |
Content-Length: 341 | |
Expires: Mon, 18 Jun 2018 18:00:23 GMT | |
Date: Mon, 18 Jun 2018 18:00:23 GMT | |
Connection: keep-alive | |
Vary: User-Agent |
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
diff -u -r 1.9.69/google_appengine/VERSION 1.9.70/google_appengine/VERSION | |
--- 1.9.69/google_appengine/VERSION 2018-05-29 11:48:16.000000000 -0700 | |
+++ 1.9.70/google_appengine/VERSION 2018-05-29 11:47:31.000000000 -0700 | |
@@ -1,5 +1,5 @@ | |
-release: "1.9.69" | |
-timestamp: 1523300407 | |
+release: "1.9.70" | |
+timestamp: 1526501368 | |
api_versions: ['1'] | |
supported_api_versions: |
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
(venv) foo-proj david$ ./manage.py --sandbox=remote --app_id=foo-proj loadconfig | |
ERROR 2018-04-18 14:52:43,440 sandbox.py:321] Unable to use oauth2 falling back to username/password | |
Traceback (most recent call last): | |
File "/Users/david/foo-proj/sitepackages/prod/djangae/sandbox.py", line 294, in _remote | |
from google.appengine.tools.appcfg import APPCFG_CLIENT_ID, APPCFG_CLIENT_NOTSOSECRET | |
File "/Users/david/foo-proj/sitepackages/dev/google_appengine/google/appengine/tools/appcfg.py", line 58, in <module> | |
from oauth2client import devshell | |
ImportError: cannot import name devshell | |
Google Account Login: [email protected] | |
Password: |
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
diff -u -r 1.9.67/google_appengine/VERSION 1.9.68/google_appengine/VERSION | |
--- 1.9.67/google_appengine/VERSION 2018-03-09 20:05:16.000000000 -0800 | |
+++ 1.9.68/google_appengine/VERSION 2018-04-03 21:35:02.000000000 -0700 | |
@@ -1,5 +1,5 @@ | |
-release: "1.9.67" | |
-timestamp: 1518475832 | |
+release: "1.9.68" | |
+timestamp: 1519259623 | |
api_versions: ['1'] | |
supported_api_versions: |
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
# If you are pip installing from a repo instead of pypi, archives are faster than git checkouts. | |
# Fast. | |
https://github.com/potatolondon/djangae/archive/6e23d264badd1c7a46a5dc64ef99ea9dc77b20ff.zip | |
# Slow. | |
# git+https://github.com/potatolondon/djangae.git@6e23d264badd1c7a46a5dc64ef99ea9dc77b20ff |
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
$ python | |
Python 2.7.14 (default, Sep 22 2017, 00:06:07) | |
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import cStringIO, StringIO, io | |
>>> class Foo(io.StringIO): pass | |
... | |
>>> class Bar(StringIO.StringIO): pass | |
... | |
>>> class Baz(cStringIO.StringIO): pass |
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 itertools | |
def chunker(iterable, n): | |
"""Collect data into chunks. | |
This is different to the grouper recipe in itertools in that the final | |
chunk may be shorter. | |
>>> chunks = chunker('abcde', 2) | |
>>> list(chunks) |