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 lxml import etree | |
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, String, DateTime | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy.ext.declarative import declarative_base | |
from datetime import datetime | |
# Database connection details | |
DATABASE_URI = 'postgresql+psycopg2://username:password@localhost:5432/dbname' | |
# Initialize SQLAlchemy engine and session |
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 boto3 | |
aws_access_key = "" | |
aws_secret_key = "" | |
bucket_name = "" | |
region_name = "" | |
# Path of the files in S3 bucket | |
prefix_path = "" | |
# Path to be written in DBFS |
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.mgmt.storage import StorageManagementClient | |
from azure.mgmt.storage.models import StorageAccountUpdateParameters | |
# Enter the subscription id, resource group name and storage account name | |
subscription_id = "xxxxxxxx" | |
resource_group_name="xxxxx" | |
storage_account_name="xxxx" | |
# Update the service principle credentials below. |
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.mgmt.storage import StorageManagementClient | |
from azure.identity import ClientSecretCredential | |
# Update the below variables with the correct values | |
subscription_id="Your-subscription-id" | |
resource_group_name = "your-resource-grp-name" | |
storage_account_name = "your-storage-account-name" | |
# Update the below variables with the Service Principle credentials. | |
AZURE_CLIENT_ID = "" |
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
value = dbutils.secrets.get(scope="myScope", key="myKey") | |
for char in value: | |
print(char, end='\u200B') |
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
# pip install azure-keyvault-secrets | |
# pip install azure-identity | |
from azure.keyvault.secrets import SecretClient | |
from azure.identity import ClientSecretCredential | |
source_vault_url = "https://<sourcekeyvault>.vault.azure.net" | |
destination_vault_url = "https://<destkeyvault>.vault.azure.net/" | |
# Get the below details from Service Principle-01 (has access to source keyvault) |
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
# pip install azure-keyvault-secrets | |
# pip install azure-identity | |
from azure.keyvault.secrets import SecretClient | |
from azure.identity import ClientSecretCredential | |
source_vault_url = "https://<sourcekeyvault>.vault.azure.net" | |
destination_vault_url = "https://<destkeyvault>.vault.azure.net/" | |
# Get the below details from Service Principle |
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
kind: ClusterRole | |
apiVersion: rbac.authorization.k8s.io/v1 | |
metadata: | |
labels: | |
k8s-app: kubernetes-dashboard | |
name: kubernetes-dashboard | |
rules: | |
# Allow Metrics Scraper to get metrics from the Metrics server | |
- apiGroups: ["metrics.k8s.io"] | |
resources: ["pods", "nodes"] |
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 ldap | |
ldap_host = "" | |
pem_file_loc = "" | |
ldap_bind_dn = "" | |
conn = ldap.initialize(ldap_host) | |
conn.protocol_version = ldap.VERSION3 | |
conn.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_DEMAND) | |
conn.set_option(ldap.OPT_X_TLS_CACERTFILE, pem_file_loc) | |
conn.set_option(ldap.OPT_X_TLS_NEWCTX, 0) |
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
Topics = ["test1","test2"] | |
class createTopics: | |
def __init__(self): | |
self.a = AdminClient({'bootstrap.servers': 'localhost:9092', | |
'debug':'broker,admin,protocol', | |
'compression.type':'none', | |
'group.id':'mygroup'}) | |
new_topics = [NewTopic(topic, num_partitions=1, replication_factor=1) | |
for topic in Topics] | |
self.a.create_topics(new_topics) |
NewerOlder