This file contains 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 get_calling_file_name(): | |
# If this function is embedded in another function, offset the stack appropriately | |
import inspect | |
stack_offset = 1 | |
stack = inspect.stack() | |
calling_file = stack[stack_offset][1] | |
return calling_file |
This file contains 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
# Setup Classes for the Example | |
class Shifter: | |
def __init__(self, label): | |
self.label = label | |
def __str__(self): | |
return str(self.label) | |
def __rshift__(self, other): | |
print("#%s.__rshift__(%s)" % (self, other)) |
This file contains 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
Host target-repo-name.github.com | |
HostName github.com | |
User git | |
IdentityFile /home/ec2-user/.ssh/target-repo-name | |
IdentitiesOnly yes |
This file contains 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 for setting up a virtualenv venv | |
######### | |
# SETUP # | |
######### | |
## Make sure you have python3 | |
python3 --version |
This file contains 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 hashlib | |
import json | |
from typing import Dict, Any | |
def hash_dict(data: Dict[str, Any]): | |
data_str = json.dumps(data, sort_keys=True, default=str) | |
md5 = hashlib.md5() | |
md5.update(data_str.encode("utf-8")) | |
hash_value = md5.hexdigest() | |
return hash_value |
This file contains 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 io import StringIO | |
from typing import Optional, Dict, Any | |
import yaml | |
from kedro.framework.hooks import hook_impl | |
from kedro.io import DataCatalog | |
from kedro.versioning import Journal | |
def _read_github_repo_file(access_token, repo_name, filepath, branch='master'): |
This file contains 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
######################################################################################################### | |
# Call this script locally using: | |
# eval "$(curl --silent https://gist.githubusercontent.com/tamsanh/92f0546322583dfd46f7d85d3510bdb7/raw)" | |
# This will override current AWS environment variables | |
######################################################################################################### | |
# First type in a token code that will expire after at least 20 seconds | |
# Ex: TOKEN_CODE=192392 | |
read -p TOKEN_CODE= TOKEN_CODE |
This file contains 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 | |
# Install brew and asdf | |
# Setup Brew | |
brew --help > /dev/null 2>/dev/null | |
if [ $? -ne 0 ]; then | |
## Install if does not exist | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo "brew setup complete" |
This file contains 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 | |
# Setup based on .tool-version in the current directory | |
while read package; do | |
plugin=${package%% *} | |
version=${package#* } | |
printf "Checking ${package}... " | |
asdf list $plugin | grep $version >/dev/null 2>/dev/null | |
if [ $? -ne 0 ]; then |