Skip to content

Instantly share code, notes, and snippets.

@groks
groks / mustlogin.go
Last active December 10, 2015 04:28 — forked from imjasonh/mustlogin.go
package mustlogin
import (
"appengine"
"appengine/user"
"fmt"
"net/http"
)
func init() {
@groks
groks / sequence.go
Created November 5, 2011 23:41
A Sequence object using Appengine's unimplemented AllocateIDs RPC
/* Sequence: https://gist.github.com/1342205
Example:
var defSeq *sequence.Sequence
func init() {
defSeq = sequence.Make("Default")
defSeq.BatchSize = 3 // for testing...
}
@groks
groks / getbykey.go
Created October 26, 2011 16:12
Appengine: Comparing existing GetMulti() to proposed Query.ByKey()
// Comparing existing GetMulti() to proposed Query.ByKey()
//
// https://groups.google.com/d/topic/google-appengine-go/R7jRPz0frlE/discussion
type Thingy struct {
A, B string
}
const N = 3
@groks
groks / .bashrc
Created June 9, 2011 12:10
fancy bash prompt with colors, trimmed CWD and git status
# Shows exit status in red if previous command exited with
# an error code, the CWD in blue up to 30 chars or the 3 parent
# directories, and the git branch and status in grey, if in a
# git repo.
PS1="\n[\u@\h \[\e[1;31m\]\$(_exit_status)\[\e[0m\]\[\e[0;36m\]\$(_short_dir \w)\[\e[0m\]\[\e[1;30m\]\$(_git_status)\[\e[0m\]]\\$ "
# Return the exit status with padding if exit status != success
_exit_status() {
exit_status=$?
@groks
groks / gist:729268
Created December 5, 2010 17:30
logcat: Google Reader Anddroid app fails to sync
D/AccountListActivity(23370): Synchronizing preferences for Account {[email protected], type=com.google}
E/ReaderProvider(23370): Synchronization failed for account
E/ReaderProvider(23370): java.net.UnknownHostException: Host is unresolved: www.google.com:80
E/ReaderProvider(23370): at java.net.Socket.connect(Socket.java:1038)
E/ReaderProvider(23370): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
E/ReaderProvider(23370): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
E/ReaderProvider(23370): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
E/ReaderProvider(23370): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
E/ReaderProvider(23370): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getResponseCode(
@groks
groks / appengine-1.4.0-prerelease.diff
Created November 27, 2010 13:43
changes in the google appengine 1.4.0 pre-release
Only in local/google_appengine/demos: taskqueue_examples
diff -rbBd -u -U 5 -X /home/sd/.exclude -F '^ *def ' local/google_appengine/google/appengine/api/apiproxy_stub_map.py google-appengine-1.4.0-prerelease/google/appengine/api/apiproxy_stub_map.py
--- local/google_appengine/google/appengine/api/apiproxy_stub_map.py 2010-10-14 21:40:44.027837653 +0100
+++ google-appengine-1.4.0-prerelease/google/appengine/api/apiproxy_stub_map.py 2010-11-18 21:44:32.000000000 +0000
@@ -367,10 +367,12 @@ def __init__(self, service, deadline=N
self.__rpc = CreateRPC(service, stubmap)
self.__rpc.deadline = deadline
self.__rpc.callback = self.__internal_callback
self.callback = callback
@groks
groks / rpcspy.py
Created November 25, 2010 12:06
log appengine rpc's
from google.appengine.api import (
apiproxy_stub_map,
quota
)
import logging
def _log_api_pre_call(service, call, request, response, rpc):
logging.debug('RPC(pre) %s.%s', service, call)
def _log_api_post_call(service, call, request, response, rpc, error):