Skip to content

Instantly share code, notes, and snippets.

View anorth848's full-sized avatar

Adam North anorth848

View GitHub Profile
@aamir814
aamir814 / alloyDB-cpbr.sh
Created February 9, 2024 18:27
AlloyDB corss-project backup/restore
#!/usr/bin/env bash
#####################################################################
# Purpose: Following is an example on how to restore AlloyDB Cluster
# cross project
# For CLOUD SQL backup/restore cross project, please see:
# https://gist.github.com/anorth848/724808332e4d3e699eb9a05411e59e5e
#
# Assumption:
# Source and target Google Projects exist
@anorth848
anorth848 / AWS_Backup.yaml
Last active August 13, 2021 19:55
Example AWS Backup cloudformation template including IAM and SNS resources
AWSTemplateFormatVersion: "2010-09-09"
Description: Example AWS Backup resources including IAM and SNS
Parameters:
NotificationEmail:
Type: String
AllowedPattern: '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)'
Description: "Email address for notification on job completions"
ResourceArns:
Type: CommaDelimitedList
Description: "Comma delimited string of resource ARNs to backup"
@niranjv
niranjv / change_lambda_logger_format.py
Last active January 17, 2025 17:32
Change Python logger format in AWS Lambda
# Python logger in AWS Lambda has a preset format. To change the format of the logging statement,
# remove the logging handler & add a new handler with the required format
import logging
import sys
def setup_logging():
logger = logging.getLogger()
for h in logger.handlers:
logger.removeHandler(h)
SELECT
sum(heap_blks_read) as heap_read,
sum(heap_blks_hit) as heap_hit,
sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) as ratio
FROM
pg_statio_user_tables;