Skip to content

Instantly share code, notes, and snippets.

View mylokin's full-sized avatar

Andrey Gubarev mylokin

View GitHub Profile
@chrisfarms
chrisfarms / each.py
Created March 22, 2011 15:54
Function to map over all entities in a GAE query
from google.appengine.ext import db
def each(query, batch_size=100):
"""yields each entity in the query over the whole dataset in batches"""
entities = query.fetch(batch_size)
while entities:
for entity in entities:
yield entity
# if the query was keys only then the entity IS a key
if hasattr(entities[-1],"key"):
@bobuk
bobuk / Base File.sublime-settings.json
Created September 14, 2011 16:24
Base settings for python. Please remove .json in filename.
{
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "Cyrillic (Windows 1251)",
"font_face": "monofur",
"font_size": 18,
"highlight_line": true,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"use_tab_stops": true
@darron
darron / default_ami_setup.sh
Last active September 5, 2017 14:31
Ubuntu 14.04 AWS Instance Store HVM build - actually worked - built and booted. Much thanks to: https://github.com/Lumida/packer/wiki/Building-Ubuntu-12.04-and-14.04-HVM-Instance-Store-AMIs
#!/bin/bash
# server-jre-8u5-linux-x64.tar.gz
DEBIAN_FRONTEND=noninteractive
UCF_FORCE_CONFFNEW=true
export UCF_FORCE_CONFFNEW DEBIAN_FRONTEND
apt-get update
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" dist-upgrade