Skip to content

Instantly share code, notes, and snippets.

View gmirsky's full-sized avatar

Gregory Mirsky gmirsky

View GitHub Profile
@gmirsky
gmirsky / main.tf
Created October 18, 2024 18:22
Terraform assert to validate a multi-level mapped object
terraform {
required_providers {
assert = {
source = "hashicorp/assert"
version = ">= 0.14.0"
}
}
}
#
provider "assert" {
@gmirsky
gmirsky / icanhazip-hcl.txt
Last active September 2, 2024 21:55
terraform get my ip address
data "http" "icanhazip" {
url = "http://icanhazip.com"
}
output "my_terraform_environmnet_public_ip" {
value = "${chomp(data.http.icanhazip.body)}"
}
@gmirsky
gmirsky / snowflakeQueryCosts.sql
Created November 1, 2023 20:25
Snowflake Query Costs
use role accountadmin;
use warehouse systemadmin_wh;
use database qa_mdm_db;
--
WITH filtered_queries AS (
SELECT
query_id,
query_text AS original_query_text,
-- First, we remove comments enclosed by /* <comment text> */
REGEXP_REPLACE(query_text, '(/\*.*\*/)') AS _cleaned_query_text,
@gmirsky
gmirsky / preSignedUrl.py
Created March 20, 2023 19:46
Python generate pre-signed URL
import sys as sys
import logging as logging
import platform as platform
import boto3 as boto3
import argparse as argparse
import requests as requests
from botocore.exceptions import ClientError
logger = logging.getLogger(__name__)
@gmirsky
gmirsky / Route53Inventory.ps1
Created August 3, 2022 14:15
Route 53 Inventory PowerShell Script
#Inventory-RT53-Zone-Records.ps1
#Get a Full List of all records from all RT53 Zones, OR only for a targeted Zone set by Variable
#Also can get list for a single targeted Record Type, example TXT, MX etc
# ****** This WILL NOT export any records with "_domainkey" in the Name (url) for security reasons.
#Version: 1.5
#Tested with Windows Powershell: 5.1, 7.0.3
#Tested with MacOS PowerShell : 7.0.3
#Date 10/23/2020
#Modified 8/03/2022
#Created: Ed Walsh

Keybase proof

I hereby claim:

  • I am gmirsky on github.
  • I am vanapagan (https://keybase.io/vanapagan) on keybase.
  • I have a public key ASBjua-PhTAUtm8VOq70I_UYHE1NbI6ev52cXkjrfPmf1Qo

To claim this, I am signing this object:

@gmirsky
gmirsky / GrafanaDockerInstallAmazonLinux.md
Created April 21, 2020 20:33
Grafana Docker Container install on a AWS Amazon Linux 2 server

Grafana Docker Container install on a AWS Amazon Linux 2 server

This document will guide you through building a Amazon Linux 2 Server to serve as a docker host for a Grafana container that will power your server.

Prerequisites:

  • Local server to create files
  • AWS CLI access to the AWS account you want to deploy to in a bash shell console.
  • VPN access to the AWS account private subnet (or web console access via the AWS console)
  • A provisioned Amazon Linux 2 server with a static IP with an A-Record in DNS. A t3.small or larger is recommended.
@gmirsky
gmirsky / snowflake_reverse_engineer_warehouse_ddl.sql.sql
Created September 1, 2021 13:19
snowflake_reverse_engineer_warehouse_ddl
use role accountadmin;
--
-- create warehouse ddl
--
show warehouses;
--
CREATE temporary TABLE temp_warehouses as SELECT * FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));
--
select 'CREATE OR REPLACE WAREHOUSE ' || t."name" || '\n' ||
' INITIALLY_SUSPENDED = TRUE \n' ||
@gmirsky
gmirsky / snowflake_reverse_engineer_user_ddl.sql
Last active September 1, 2021 13:17
snowflake_reverse_engineer_user_ddl.sql
use role accountadmin;
--
show users;
--
CREATE temporary TABLE temp_users as SELECT * FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));
--
select 'CREATE USER ' || t."name" || '\n' ||
' PASSWORD=' || '''Ch@ng3MeN0W!''' || '\n' ||
' COMMENT = ' || '''' ||
case
@gmirsky
gmirsky / snowflake_ddl.sql.sql
Last active August 3, 2021 19:21
Snowflake DDL
select current_user();
select current_available_roles();