This file contains hidden or 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
[ | |
"accessapproval.googleapis.com", | |
"aiplatform.googleapis.com", | |
"alloydb.googleapis.com", | |
"analyticshub.googleapis.com", | |
"anthosedge.googleapis.com", | |
"apigateway.googleapis.com", | |
"apigee.googleapis.com", | |
"apigeeconnect.googleapis.com", | |
"apigeeregistry.googleapis.com", |
This file contains hidden or 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
# Ensure these environment variables are set before running the script: | |
# export PROJECT_ID=<your-project-id> | |
# export USER_EMAIL=<user-email> | |
# export EXPIRATION_DATE=<expiration-date> # Format: YYYY-MM-DD | |
# Creates the custom role for BigQuery Reservations Viewer | |
gcloud iam roles create bigqueryReservationsViewer \ | |
--project="$PROJECT_ID" \ | |
--title="BigQuery Reservations Viewer" \ | |
--permissions="bigquery.reservations.list,bigquery.reservationAssignments.list,bigquery.capacityCommitments.list" \ |
This file contains hidden or 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
# This is not an original work, but crafted based on: https://gist.github.com/momota/ba302f0f0720ff5b2445fb81820c5b82 | |
# I updated it to make a file closer to the size I needed consistantly. All praise goes to: @momota and @andrewFarley for | |
# The original gist. | |
import csv | |
import random | |
# 1000000 and 62 == roughly 1.3GB (will take a bit of time, go get a coffee) | |
rows = 1200000 | |
columns = 62 |
This file contains hidden or 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 | |
# Create the crontab entry | |
(crontab -l 2>/dev/null; echo "*/5 * * * * source /var/user-scripts/backup_script.sh") | crontab - |
This file contains hidden or 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 | |
# Check to see if the backup directory exists | |
# If not, create it | |
if [ ! -d "/var/mongobackup" ]; then | |
sudo mkdir /var/mongobackup | |
fi | |
sudo chmod 777 /var/mongobackup | |
mongodb_pwd=$(curl "http://metadata.google.internal/computeMetadata/v1/instance/attributes/MONGODB_PWD" -H "Metadata-Flavor: Google") |
This file contains hidden or 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
# Where and how to store data. | |
storage: | |
dbPath: /var/lib/mongodb | |
# engine: | |
# wiredTiger: | |
# where to write logging data. | |
systemLog: | |
destination: file | |
logAppend: true |
This file contains hidden or 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
from google.cloud import storage | |
import os | |
def update_soft_delete(): | |
"""Lists all buckets in a project.""" | |
storage_client = storage.Client() | |
buckets = storage_client.list_buckets() | |
for bucket in buckets: | |
print ("****************") |
This file contains hidden or 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
""" | |
Instructions | |
- Download to folder | |
- > Run "pip3 freeze > requirements.txt" | |
- > Run pip3 "install -r requirements.txt" | |
- > run python3 -m main.py | |
- Enjoy | |
""" | |
from tabula import convert_into, read_pdf |
This file contains hidden or 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
import subprocess | |
# Function to run shell commands | |
def run_command(command): | |
try: | |
output = subprocess.check_output(command, shell=True, text=True) | |
return output.strip() # Return output with whitespace stripped | |
except subprocess.CalledProcessError as e: | |
print(f"Command failed with error: {e}") | |
return None |
This file contains hidden or 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 | |
# The Organization ID (Replace with your organization's ID) | |
ORG_ID="your-organization-id" | |
# Gather all projects under the specified organization | |
PROJECT_IDS=$(gcloud projects list --organization=${ORG_ID} --format="value(projectId)") | |
# Loop through each project | |
for PROJECT_ID in ${PROJECT_IDS}; do |
NewerOlder