Skip to content

Instantly share code, notes, and snippets.

View glmvrml's full-sized avatar
🎯
Focusing

Ramiel glmvrml

🎯
Focusing
  • Austin, TX
View GitHub Profile
@jdiaz5513
jdiaz5513 / gae_remote_api_helper.py
Last active December 2, 2016 12:36
A script for Google App Engine remote_api shell that automatically creates a connection and drops you to the shell. I created this script for people who use the remote_api shell a lot; it saves me a lot of time. The best part is, it works with alternative Python shells like iPython!
#!/usr/bin/python2
"""
This script automates the task of connecting to a running App Engine server,
whether it's a local dev_appserver or a live app.
If PyQt4 is installed, it will ask for credentials inside a dialog box
instead of prompting in the terminal. This is good for shells that do
not support getpass (iPython).
It will automatically add an import path for a local virtualenv in the app
@mcummins
mcummins / faster_get_multi.py
Last active February 5, 2021 00:06
Fetch a set of keys directly from App Engine memcache, instead of using ndb. Almost 3x faster if everything is in memcache.
# This Gist is an alternative to ndb.get_multi which is a lot faster in some circumstances.
# For example, fetching 500 small entities with 90% hit rate is 3x faster than ndb,
# based on my tests in App Engine production environment (F1).
# In general it is worthwhile when fetching a large number of small entities, with >50% memcache hit rate.
# For any keys not in memcache, it falls back on a normal ndb.get_multi
# The code is based on the original ndb.context code, but avoids the task queue overhead.
import logging
from google.appengine.api import memcache