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) |
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 sshtunnel import SSHTunnelForwarder | |
import pymysql | |
with SSHTunnelForwarder( | |
('ec2-52-202-194-76.public-ec2-instance.amazonaws.com'), | |
ssh_username="ec2-user", | |
ssh_pkey="~/ssh-tunnel-rds.pem", | |
remote_bind_address=('private-rds-instance.ckfkidfytpr4.us-east-1.rds.amazonaws.com', 3306) | |
) as tunnel: | |
print("****SSH Tunnel Established****") |
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 math | |
n = int(input("Enter the number of points\n")) | |
line_points = [] | |
for i in range(n): | |
x, y = input("Enter the coordinate x,y \n").split(',') | |
coordinates = [int(x), int(y)] | |
line_points.append(coordinates) | |
xp, yp = input("Enter the coordinate of center point P \n").split(',') |
NewerOlder