Skip to content

Instantly share code, notes, and snippets.

View christopherhesse's full-sized avatar

Christopher Hesse christopherhesse

View GitHub Profile
<!DOCTYPE html>
<html>
<body>
<style>
html, body, div {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;

Keybase proof

I hereby claim:

  • I am christopherhesse on github.
  • I am csh (https://keybase.io/csh) on keybase.
  • I have a public key whose fingerprint is 5F7E 85CB CE3A 4E57 A25F 46C6 CB16 D055 1626 87F0

To claim this, I am signing this object:

import (
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/appengine"
)
func CloudContext(c context.Context, scopes ...string) context.Context {
client := &http.Client{
Transport: &oauth2.Transport{
import (
"code.google.com/p/goauth2/appengine/serviceaccount"
"golang.org/x/net/context"
"appengine"
)
// oauth2 module requires a context.Context so use goauth2 for now
func CloudContext(c appengine.Context, scopes ...string) context.Context {
client, _ := serviceaccount.NewClient(c, scopes...)
return cloud.WithContext(context.Background(), appengine.AppID(c), client)
diff --git a/memcache_service.pb.go b/memcache_service.pb.go2.txt
index 0b412f9..d0d1f5f 100644
--- a/memcache_service.pb.go
+++ b/memcache_service.pb.go2.txt
@@ -1,11 +1,12 @@
// Code generated by protoc-gen-go.
+// source: google.golang.org/appengine/internal/memcache/memcache_service.proto
// DO NOT EDIT!
/*
diff --git a/memcache.go b/memcache.go.txt
index ece54b4..d8eed4b 100644
--- a/memcache.go
+++ b/memcache.go.txt
@@ -26,7 +26,7 @@
// if err := memcache.Set(c, item1); err != nil {
// return err
// }
-package memcache
+package memcache // import "google.golang.org/appengine/memcache"
@christopherhesse
christopherhesse / gist:fee14d722b60121725dc
Last active August 29, 2015 14:25
appengine image API with GCS
import (
"appengine/blobstore"
aeimage "appengine/image"
)
func servingURL(c appengine.Context) error {
blobKey, err := blobstore.BlobKeyForFile(c, "/gs/bucketname/file")
if err != nil {
return err
}
key = "1sW28zp7CWv5TtGjlQpDHHG4Cbr9v36fG5o4f74LsKg=".decode("base64")
tag = "OBA7UU/Rd9j0Zn+9korAyQ==".decode("base64")
initialization_vector = "O2QAL8AYQB+qbre8".decode("base64")
encrypted_message = "7YS1aTE=".decode("base64")
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
decryptor = Cipher(
algorithms.AES(key),