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 boto3 | |
access_key = "XXXXXXXXXXXXXXXXXX" | |
secret_key = "XXXXXXXXXXXXXXXXXX" | |
region = 'us-east-1' | |
client = boto3.client('ec2', aws_access_key_id=access_key, aws_secret_access_key=secret_key, | |
region_name=region) | |
conn = boto3.resource('ec2', aws_access_key_id=access_key, aws_secret_access_key=secret_key, region_name=region) |
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
apt-get update | |
apt-get install chrony -y | |
cp -pr /etc/chrony/chrony.conf /etc/chrony/chrony.conf.bk | |
vim /etc/chrony/chrony.conf | |
=========================chrony.conf============================== | |
# Welcome to the chrony configuration file. See chrony.conf(5) for more | |
# information about usuable directives. |
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 pprint import pprint | |
sample_json = { | |
"id": "0001", | |
"type": "donut", | |
"name": "Cake", | |
"ppu": 0.55, | |
"batters": | |
{ | |
"batter": |
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 azure.identity import ClientSecretCredential | |
from azure.storage.blob import BlobServiceClient | |
# Tenant ID for your Azure Subscription | |
TENANT_ID = "85XXX93e-XXXX-XXXX-XXXXX-96150XXX893e" | |
# Your Service Principal App ID (Client ID) | |
CLIENT_ID = "a3XXX40d-xxxxxxx-0ff72XXXX66a" | |
# Your Service Principal Password (Client Secret) |
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 on_starting(server): | |
""" | |
Do something on server start | |
""" | |
print("Server has started") | |
def on_reload(server): | |
""" |
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 fastapi import FastAPI | |
app = FastAPI() | |
@app.get("/") | |
def my_first_get_api(): | |
""" | |
Sample GET method implementation using FastAPI | |
:return: |
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 json | |
import sys | |
import requests | |
URL = "" | |
message = "" | |
def send_notification(url, message): | |
title = (f"DMP Notification :zap:") |
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 os | |
import json | |
import pandas as pd | |
def data_extractor(file_path, delimiter, required_fields=[]): | |
""" | |
:param file_path: | |
:param delimiter: | |
:param required_fields: |
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 os | |
# Modify this path as per the execution environment | |
os.environ['GIT_PYTHON_GIT_EXECUTABLE'] = r"C:\Program Files\Git\bin\git.exe" | |
import uuid | |
import git | |
import shutil | |
from git import RemoteProgress | |
from azure.storage.blob import BlobServiceClient | |
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
# coding: utf-8 | |
import os | |
from azure.storage.blob import BlobServiceClient | |
class DownloadADLS: | |
def __init__(self, connection_string, container_name): | |
service_client = BlobServiceClient.from_connection_string(connection_string) | |
self.client = service_client.get_container_client(container_name) | |