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
# define your own values for app-specific settings like debug, url_mappings, ... | |
from google.appengine.ext import webapp | |
from gaesessions import SessionMiddleware | |
app = webapp.WSGIApplication(url_mappings, debug=debug) | |
app = SessionMiddleware(app, COOKIE_KEY) | |
if USE_APP_STATS: | |
from google.appenginSessionMiddlewareort recording | |
app = recording.appstats_wsgi_middleware(app) |
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
from google.appengine.ext import db | |
class Counter(db.Model): | |
"""Persistent storage of a counter's values""" | |
# key_name is the counter's name | |
value = db.IntegerProperty(indexed=False) | |
@classmethod | |
def get(cls, name): |
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
#/usr/bin/env python | |
"""Computes optimal mix for maximum might or combat power gain.""" | |
from scipy import optimize | |
# number of places you can build in each city | |
SLOTS_PER_CITY = 31 | |
# T1, T2, T3 (combat units) | |
TIER_BASE_TRAINING_TIME = (90, 480, 1200) |
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
// ==UserScript== | |
// @name Augment GAE Dashboard | |
// @version 0.3 | |
// @namespace http://www.dound.com/ | |
// @description modifies issue style | |
// @match https://appengine.google.com/dashboard?*app_id=* | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | |
// ==/UserScript== | |
// Assumes discounted instance hour pricing. |
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
// ==UserScript== | |
// @name Augment GAE Instance List | |
// @version 0.1 | |
// @namespace http://www.dound.com/ | |
// @description augments instance page with average lifetime | |
// @match https://appengine.google.com/instances* | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | |
// ==/UserScript== | |
window.setTimeout(function () { |
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
application: some-app | |
version: sometestversion | |
runtime: python27 | |
api_version: 1 | |
threadsafe: true | |
inbound_services: | |
- warmup | |
handlers: |
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
// Quick and dirty script for fetching and parsing results from www.runraceresults.com | |
// Intended to be run from the Chrome console | |
// load jquery | |
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
// Parses a page of results from the results-container | |
var parseResultsPage = function(body) { |
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
#!/bin/bash | |
set -o errexit | |
# Author: David Underhill | |
# Script to permanently delete files/folders from your git repository. To use | |
# it, cd to your repository's root and then run the script with a list of paths | |
# you want to delete, e.g., git-delete-history path1 path2 | |
if [ $# -eq 0 ]; then | |
exit 0 |
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
from apache_beam.io.gcp.datastore.v1 import helper | |
ds = helper.get_datastore('pgdragonsong-dev') | |
from google.cloud.proto.datastore.v1 import datastore_pb2, entity_pb2, query_pb2 | |
req = datastore_pb2.RunQueryRequest() | |
partition = entity_pb2.PartitionId() | |
partition.project_id = 'pgdragonsong-dev' | |
req.partition_id.CopyFrom(partition) | |
q = query_pb2.Query() | |
q.kind.add().name = 'TmpForDeletion' |
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
// This script makes Chrome display Google Doc comments in a wider box (only for while you view the doc). | |
// 1) Open the google doc in Chrome | |
// 2) Press F12 (the developer tools should open) | |
// 3) Click the "Console" tab | |
// 4) Copy/Paste this code into the console and press "enter" to run it | |
// 5) Press "X" to close the developer tools | |
// | |
// To go back to normal size, refresh the page. | |
(() => { | |
const newCommentColumnWidth = 500; // TWEAK THIS |