This file contains 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
''' | |
Simple script to determine current service account private keys and | |
try to guess if they are user-managed (downloaded or created outside Google) | |
or google-managed (maintained by Google, private to Google). | |
Usage: | |
python3 detect_sa_key_type.py <servcie account email or Client ID> | |
''' | |
import datetime |
This file contains 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 python3 | |
''' | |
Delete old Cloud Workstation Disks | |
WARNING: This script will delete disks and all data on them. It should be | |
considered "proof of concept" quality and should be customized to fit your | |
environmental needs, checked for logic errors and monitored. I am not | |
responsible for data loss by using this script. |
This file contains 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 bash | |
### | |
### Shell script to get an access token for a user | |
### using Google 3-legged OAuth. | |
### | |
### Example to show your quota usage: | |
### | |
### # first run is to authorize. | |
### bash --credentials-file drive-quota.json \ |
This file contains 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
runtime: python311 | |
handlers: | |
- url: / | |
secure: always | |
script: auto | |
redirect_http_response_code: 301 | |
- url: /debug | |
secure: always |
This file contains 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 python3 | |
### This script requires a service account private key JSON credentials file. | |
### The service account should be granted an admin role in your domain that | |
### authorizes it to create users. See: | |
### | |
### https://support.google.com/a/answer/9807615?hl=en&ref_topic=9832445&fl=1#zippy=%2Cassign-a-role-to-a-service-account | |
### | |
### This script requires PyJWT and requests. Install it by running: | |
### |
This file contains 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
runtime: python310 | |
handlers: | |
- url: /.* | |
script: auto |
This file contains 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
function myFunction() { | |
// connect to sheet | |
var ss = SpreadsheetApp.openById("1_6HeCZ_KEFyJIRD73joTYBwj6xKdJHXudaAfH-Apwto"); | |
var sheet = ss.getSheets()[0]; | |
// determine if weekly auto-reply is enabled | |
var range = sheet.getRange(11,2); | |
var weekly_autoreply_enabled = range.getValue(); | |
if (! weekly_autoreply_enabled) { | |
Logger.log("Weekly auto-reply is disabled"); |
This file contains 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 python3 | |
''' | |
Set user's Gmail vacation message | |
''' | |
import argparse | |
import http.client | |
from json import dumps | |
import time |
This file contains 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 bash | |
### | |
### Shell script to use update a user's away message for the next week. | |
### Utilizes Google domain-wide delegation (DwD). | |
### | |
### Example to turn on vacation message for a user: | |
### | |
### bash vacation.sh --credentials-file oauth2service.json \ | |
### --user jdoe@acme.com \ | |
### --autoreply 'I am out of the office this week" |
This file contains 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
function onFormSubmit(e) { | |
var response = e.response; | |
var user = response.getRespondentEmail(); | |
var manager = getManagerEmail(user); | |
// New title is our first (and only) form response | |
new_title = response.getItemResponses()[0].getResponse(); | |
emailManager(manager, user, new_title); | |
} | |
function getManagerEmail(user) { |
NewerOlder