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
.create table Person (Id: int, name:string) | |
.ingest inline into table Person <| | |
1, John | |
2, Mary | |
3, Alice | |
4, Jacob | |
5, Julie | |
.create table Restaurant (Id: int, name:string, city:string) |
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 abc | |
from collections import defaultdict | |
import json | |
import os | |
import pandas as pd | |
import time | |
from dataclasses import dataclass | |
from typing import Any, Dict, List, Optional, Tuple | |
import requests |
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 subprocess | |
import sys | |
import importlib | |
def install_modules(modules): | |
"""Install multiple Python modules using pip.""" | |
subprocess.check_call([sys.executable, "-m", "pip", "install", *modules]) | |
def install_dependencies(required_modules): | |
def wrapper(func): |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFrameworks>net6.0;net48</TargetFrameworks> | |
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="BenchmarkDotNet" Version="0.13.3" /> |
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
using System.Diagnostics; | |
namespace TestinManuelResetEventHandler | |
{ | |
internal class Program | |
{ | |
private enum RunMode | |
{ | |
cluster, | |
listen, |
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
using System.Collections.Concurrent; | |
using System.Threading.Tasks; | |
namespace ProperLockingTester | |
{ | |
public class WellLockedResource | |
{ | |
private readonly object m_lock; | |
private bool lockedState = false; | |
private TaskCompletionSource<bool> m_taskCompletionSource; |
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
.create-or-alter function with (folder = "formatting", docstring = "Table to Markdown", skipvalidation = "true") TableToMarkdown(t:(*)) { | |
let schema = t | getschema; | |
let headers = schema | project ColumnName | summarize make_list(ColumnName) | extend String = strcat('| ', strcat_array(list_ColumnName, ' | '), ' |') | project String, Order=1; | |
let upperDivider = schema | project ColumnName, Sep = '---' | summarize Cols=make_list(Sep) | extend String = strcat('| ', strcat_array(Cols, ' | '), ' |') | project String, Order=2; | |
let data = t | extend Cols=pack_array(*) | extend String = strcat('| ', strcat_array(Cols, ' | '), ' |') | project String, Order=3; | |
headers | |
| union upperDivider | |
| union data | |
| order by Order asc | |
| summarize Rows=make_list(String) |
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 List | |
import requests | |
import json | |
import time | |
from azure.kusto.data import KustoClient, KustoConnectionStringBuilder | |
from datetime import datetime, timedelta | |
def main(): | |
def read_kusto_data(q): | |
results = kc.execute_query(KUSTO_DB ,q) |
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 Tuple, List | |
# pip install sqlparse | |
import sqlparse | |
# https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/ | |
SQL_TYPE_TO_KQL_TYPE = { | |
'int': 'int', | |
'varchar': 'string', | |
'datetime': 'datetime', | |
'bool': 'bool' |
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 List, Tuple | |
from azure.cli.core import get_default_cli # requires `pip install azure-cli-core` | |
from tqdm import trange # requires `pip install tqdm`, can be removed | |
DEFAULT_RG = "resource_group" | |
NAME_FORMAT = "app0storage{0}" | |
SA_PREFIX_ARGS = ["storage", "account"] | |
GENERATE_SAS_DEFAULT_ARGS = ["--expiry", "2023-01-01", "--services", "ftqb", "--resource-types", "sco" ,"--permissions" ,"cdlruwap"] | |
class StorageAccountCreator: |
NewerOlder