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
SELECT | |
user_name, | |
warehouse_name, | |
warehouse_size, | |
database_name, | |
run_date, | |
ROUND(t/1000/3600*credits_per_hour, 2) credits | |
FROM ( | |
SELECT |
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 json | |
import boto3 | |
def clone_iam_role(original_role_name, | |
new_role_name): | |
iam = boto3.client("iam") |
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 json | |
import boto3 | |
original_instance_profile_name = 'original-role' | |
new_instance_profile_name = 'new-role' | |
def clone_instance_profile(original_instance_profile_name, | |
new_instance_profile_name): |
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
https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#regexp_contains | |
https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#regexp_extract | |
https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#regexp_replace |
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 copy | |
def merge_dict_deep(dest, src): | |
merged_dict = copy.deepcopy(dest) | |
for key in src: | |
if key not in dest: | |
merged_dict[key] = src[key] | |
elif isinstance(dest[key], dict) and isinstance(src[key], dict): |
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 boto3.session import Session | |
import base64 | |
from botocore.exceptions import ClientError | |
def get_secret(secret_name, region_name='us-west-2'): | |
secret_value_response = {} | |
try: | |
secret_value_response = ( |
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
function newlineDelimitedKeyValue(obj, parentKey = '') { | |
return Object.entries(obj) | |
.map(([k, v]) => { | |
if (typeof v === 'object') { | |
return newlineDelimitedKeyValue(v, `${parentKey}${k}_`); | |
} | |
const kUpper = `${parentKey}${k}`.toUpperCase(); | |
return `${kUpper}=${v}`; |
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
# https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html | |
# Validate the project is correct and all necessary information is available. | |
validate: | |
mvn validate | |
# Compile the source code of the project. | |
compile: | |
mvn compile | |
# Test the compiled source code using a suitable unit testing framework. |
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 json | |
from boto3.session import Session | |
session = Session() | |
for region_name in session.get_available_regions('secretsmanager'): | |
endpoint_url = f'https://secretsmanager.{region_name}.amazonaws.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
CREATE TEMP FUNCTION | |
sum_asm(x INT64, y INT64) | |
RETURNS INT64 | |
LANGUAGE js AS """ | |
const sourceBuffer = new Uint8Array([ | |
0, 97, 115, 109, 1, 0, 0, 0, 1, 139, 128, 128, 128, 0, 2, 96, 1, 127, 0, 96, 2, 127, 127, 1, | |
127, 2, 254, 128, 128, 128, 0, 7, 3, 101, 110, 118, 8, 83, 84, 65, 67, 75, 84, 79, 80, 3, 127, | |
0, 3, 101, 110, 118, 9, 83, 84, 65, 67, 75, 95, 77, 65, 88, 3, 127, 0, 3, 101, 110, 118, 18, | |
97, 98, 111, 114, 116, 83, 116, 97, 99, 107, 79, 118, 101, 114, 102, 108, 111, 119, 0, 0, 3, | |
101, 110, 118, 6, 109, 101, 109, 111, 114, 121, 2, 1, 128, 2, 128, 2, 3, 101, 110, 118, 5, 116, |
NewerOlder