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: |
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 importlib | |
| import logging | |
| import os | |
| import shutil | |
| from bentoml.exceptions import InvalidArgument, MissingDependencyException | |
| from bentoml.service.artifacts import BentoServiceArtifact | |
| from bentoml.service.env import BentoServiceEnv | |
| logger = logging.getLogger(__name__) |
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
| git log --shortstat --pretty="%cE" | sed 's/\(.*\)@.*/\1/' | grep -v "^$" | awk 'BEGIN { line=""; } !/^ / { if (line=="" || !match(line, $0)) {line = $0 "," line }} /^ / { print line " # " $0; line=""}' | sort | sed -E 's/# //;s/ files? changed,//;s/([0-9]+) ([0-9]+ deletion)/\1 0 insertions\(+\), \2/;s/\(\+\)$/\(\+\), 0 deletions\(-\)/;s/insertions?\(\+\), //;s/ deletions?\(-\)//' | awk 'BEGIN {name=""; files=0; insertions=0; deletions=0;} {if ($1 != name && name != "") { print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net"; files=0; insertions=0; deletions=0; name=$1; } name=$1; files+=$2; insertions+=$3; deletions+=$4} END {print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net";}' |
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.Generic; | |
| using System.Linq; | |
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Jobs; | |
| namespace DanielDoesBenchmarks | |
| { | |
| [SimpleJob(RuntimeMoniker.Net472, baseline: true)] | |
| public class ListBenchmarks | |
| { |
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 Clarinet from 'clarinet'; | |
| class TrackingObject { | |
| data: { [key: string]: any } | null = null; | |
| path: string = ''; | |
| depth: number = 0; | |
| stack: StackItem[] = []; | |
| expandArray(key: string) { | |
| this.stack.push({ type: 'Array', key, value: null }); |
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 os | |
| extension = '.csv' | |
| files = [f for f in os.listdir() if f.endswith(extension)] | |
| target_dir = 'samples' | |
| lines_to_copy = 1000 | |
| os.mkdir(target_dir) |
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; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.IO; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Microsoft.Azure.EventGrid; | |
| using Microsoft.Azure.EventHubs.Processor; | |
| using Newtonsoft.Json; | |
| using CloseReason = Microsoft.Azure.EventHubs.Processor.CloseReason; |
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 pprint import pprint | |
| import requests | |
| import json | |
| import os | |
| import sys | |
| import time | |
| import datetime | |
| import traceback | |
| from azure.eventhub import EventHubClient, Sender, EventData, EventHubError | |
| import logging |