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 | |
### Bash script that can generate a JWT token suitable for authorizing a Service Account for Google APIS. | |
### As described at: | |
### | |
### https://developers.google.com/identity/protocols/oauth2/service-account#jwt-auth | |
### | |
### Script requires only basic *nix tools like cat, grep and openssl. Example usage on Linux | |
### with curl to call Admin SDK Directory API users.list() | |
### | |
### JWT=$(bash ~/gen-jwt.sh --credentials-file ./oauth2service.json --audience https://admin.googleapis.com/) |
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 requests. Install it by running: | |
### | |
### pip3 install requests | |
### | |
### Example usage (where 86.0.4240.75 is a Chrome version): | |
### | |
### python3 get-policy-csv.py 86.0.4240.75 |
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
#!/bin/bash | |
# | |
# This script should be run from Linux and uses basic tools like grep, awk, date and openssl. | |
# You need to populate the client_id and client_secret variables below | |
# with your own GCP project values. Sample command lines: | |
# | |
# Use 3-legged IMAP OAuth (default): | |
# bash popimap.sh --email myaccount@example.com --protocol imap | |
# | |
# Use a service account and domain-wide delegation: |
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: python37 | |
handlers: | |
- url: /patch | |
secure: always | |
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
#!/usr/bin/env python3 | |
''' | |
Pull alerts via pubsub | |
Setup: | |
1. Create a GCP project for the script. | |
2. Enable PubSub and Alert Center APIs. | |
3. Create a service account in the project and give it "Pub/Sub Admin" role | |
on the project. | |
4. Create a JSON private key for the service account and save it to the same |
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 CircuitPython script for the Raspberry Pi Pico that reads the CPU's | |
# temperature and displays it in morse code https://en.wikipedia.org/wiki/Morse_code | |
import board | |
import digitalio | |
import microcontroller | |
import time | |
convert_to_fahrenheit = True | |
dot = 0.5 # time length of a dot in morse |
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 | |
### | |
### PoC to apply Context Aware Access rules (generally IP ranges or geographical regions) to Google API calls. | |
### | |
### This script will ultimately generate an access token that can be used to call Workspace APIs as a user. | |
### | |
### Example run: | |
### | |
### export access_token=$(./dwd-with-caa.sh \ | |
### --credentials-file oauth2service.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
export cpucount=$(nproc --all) | |
cd ~ | |
mkdir src | |
cd src | |
export LD_LIBRARY_PATH="${HOME}/ssl/lib:${HOME}/python/lib" | |
git clone https://github.com/openssl/openssl.git | |
cd openssl |
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
powerd_status=$(initctl status powerd) | |
if [ ! "$powerd_status" = "powerd stop/waiting" ]; then | |
echo -e "Stopping powerd to keep display from timing out..." | |
initctl stop powerd | |
fi | |
setterm -blank 0 | |
if [ "$3" != "" ]; then | |
target_disk=$3 |
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 Google service account and optionally | |
### domain-wide delegation (DwD). | |
### | |
### This script will ultimately output an access token that can be used to | |
### call Google APIs as the service account or the Workspace user in DwD. | |
### | |
### Example to show a Workspace user's IMAP settings: | |
### |