Skip to content

Instantly share code, notes, and snippets.

View patt0's full-sized avatar

Patrick Martinent patt0

  • Disrupt Digital
  • Kuala Lumpur
View GitHub Profile
@pwalsh
pwalsh / appengine-service-accounts-on-devserver.md
Last active May 17, 2022 18:07
Google App Engine Service Accounts that work in local development: A guide for the lost and weary

It is easy to get service accounts working with App Engine's app_devserver.py - once you know how.

On the way there, you might have pulled out all your hair following one documentation dead end after another, trying to piece together the right information.

Here are the steps you need to take, in exact order, to get this working. Once you follow these steps, you'll be able to use service accounts in local development, so that you can interact with Google APIs (e.g.: Spreadsheet, Calendar) in a way that is consistent with the deployment environment on App Engine.

In order to follow the instructions, you'll be better off using the latest UI for Google Cloud projects. Older interfaces (such as the dedicated App Engine dashboard) have things in different places, under different names, etc. It is a world of pain there.

Also note that I've tested this on several 1.9.x releases of App Engine; I can't confirm the behaviour of earlier releases.

@patt0
patt0 / cbl.js
Last active October 9, 2024 15:10
ContinuousBatchLibrary is a Google Apps Script library that manages large batches and works around the 5 minute limitation of GAS execution. It does this by setting time based triggers in the future as well as memorising the last processed key in the batch in order to restart from the correct position. At the end of the batch a cleanup function …
/**
* --- Continous Execution Library ---
*
* Copyright (c) 2013 Patrick Martinent
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@Ceasar
Ceasar / xml2json.py
Created July 26, 2013 22:44
Convert xml to json.
'''A module for converting xml into json.'''
import json
from lxml import etree
def xml_to_json(xml_input, json_output):
'''Converts an xml file to json.'''
dict_to_json(etree_to_dict(xml_to_etree(xml_input), True), json_output)