Skip to content

Instantly share code, notes, and snippets.

View jay0lee's full-sized avatar

Jay Lee jay0lee

View GitHub Profile
@jay0lee
jay0lee / ge_license_mgr.py
Last active June 19, 2026 18:20
Demo script to manage Gemini Enterprise User Licenses
#!/usr/bin/env python3
"""
gemini_licenses.py - A CLI tool to manage Google Cloud Gemini Enterprise Licenses
This script interacts with the Google Cloud Discovery Engine API to manage user
licenses for Gemini Enterprise. It supports listing subscriptions, listing
assigned licenses, batch assigning/removing licenses, syncing state from a CSV,
and pruning stale unused licenses.
Prerequisites:
@jay0lee
jay0lee / fatfree.py
Last active July 10, 2026 10:14
fatfree.py
import argparse
import os
import sys
import json
import httpx
import google.auth
import google.auth.transport.requests
# ------------------------------------------------------------------------------
# Configuration & Constants
"""
Android ClientState Security Patch Updater
==========================================
Function:
This script syncs the Android Security Patch level from the device inventory
(Google Endpoint Management) into a custom "Client State" attribute.
It writes a single value to a custom Client State on every device:
- securityPatchLevel (String): e.g., "2023-10-05T00:00:00Z"
@jay0lee
jay0lee / idmst.py
Last active November 4, 2025 12:35
import argparse
import csv
import os
import json
import logging
import socket
import sys
import time
from itertools import batched
@jay0lee
jay0lee / manifest.json
Created August 18, 2025 17:53
Redirect to Secure Google Cloud Console
{
"name": "Secure Cloud Console Redirect",
"version": "1.0",
"declarative_net_request": {
"rule_resources": [
{
"id": "ruleset_1",
"enabled": true,
"path": "rules1.json"
}
runtime: python314
handlers:
- url: /
secure: always
script: auto
redirect_http_response_code: 301
#!/bin/bash
# Optimized Chrome Extension ID generator
in_file="$1"
if [[ ! -f "$in_file" ]]; then
echo "ERROR: File ${in_file} does not exist"
exit 1
fi
@jay0lee
jay0lee / app.yaml
Last active April 6, 2026 19:30
A simple OIDC IDP AppEngine app. Tested to work with Google Cloud Identity and Workforce Identity Federation. It is NOT fully compliant with OIDC standards. It IS NOT SECURE (you only need the magic word to log in as any user and make any claim) and may not properly guard token values. This is intended for testing/debugging purposes only.
runtime: python314
handlers:
- url: /.*
secure: always
script: auto
@jay0lee
jay0lee / yk-mtls-setup.sh
Last active August 21, 2024 21:13
Resets and fully configures the PIV app of a Yubikey for mTLS connections
#!/usr/bin/env bash
###
### Shell script to reset Yubikey PIV app and then fully generate and setup a
### non-exportable private key on the Yubikey that's ready to make mTLS
### requests.
###
### Running on Ubuntu, the following packages are needed:
###
### sudo apt update; sudo apt install opensc yubikey-manager gnutls-bin libengine-pkcs11-openssl
@jay0lee
jay0lee / three_legged.py
Last active September 26, 2024 11:59
Google 3-legged OAuth with optional mTLS support
#!/usr/bin/env python3
'''
Perform 3-legged OAuth with optional mTLS and Google Workspace API calls
'''
import argparse
import http.client
import json
import os