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
locals { | |
sys_admin_role = "SYSADMIN" | |
snowflake_user = "SANDBOX_USER" | |
} | |
resource "snowflake_database" "sandbox" { | |
provider = snowflake.sys_admin | |
name = "SANDBOX" | |
} |
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
export AWS_PROFILE=<aws-profile> | |
export SNOWFLAKE_USER=<snowflake-user> | |
export SNOWFLAKE_PASSWORD=<snowflake-password> | |
export SNOWFLAKE_ACCOUNT=<snowflake-account> | |
export SNOWFLAKE_REGION=<snowflake-region> |
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
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = "~> 3.0" | |
} | |
snowflake = { | |
source = "chanzuckerberg/snowflake" | |
version = "~> 0.25" |
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 itertools import chain, combinations | |
from typing import Collection, Iterable, Optional | |
def subsets( | |
collection: Collection, min_size: int = 0, max_size: Optional[int] = None | |
) -> Iterable: | |
"""Produce all the subsets of `collection` with cardinalities between | |
`min_size` and `max_size` (inclusive).""" |
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
def log_before(f): | |
def _wrapper(*args, **kwargs): | |
print("logging before...") | |
f(*args, **kwargs) | |
return _wrapper | |
def log_after(f): | |
def _wrapper(*args, **kwargs): |
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 typing import Any, Tuple | |
Pair = Tuple[Any, Any] | |
def pair_first(pair: Pair) -> Any: | |
"""Returns the first item in a given pair""" | |
return pair[0] | |
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 math import floor, sqrt | |
def is_even(num: int) -> bool: | |
"""Returns True if a given number is even, otherwise False""" | |
return num % 2 == 0 | |
def is_prime(num: int) -> bool: | |
"""Returns True if a given number is prime, otherwise False""" |
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
def first_name(full_name: str) -> str: | |
"""Extracts and returns the first name from a full name""" | |
return full_name.split(" ")[0] | |
def square(n: int) -> int: | |
"""Returns the square of the given number""" | |
return n ** 2 | |
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
#!/usr/bin/env python | |
import logging | |
import operator as op | |
import sys | |
from typing import Any, List, Union | |
logging.getLogger(__name__).setLevel("INFO") | |
supported_operators = {"+": op.add, "-": op.sub, "*": op.mul, "/": op.truediv} |
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 redis | |
r = redis.Redis(host='localhost', port=6379, db=1) | |
r.set('hello', 'world') # True | |
value = r.get('hello') | |
print(value) # b'world' | |
r.delete('hello') # True |