Skip to content

Instantly share code, notes, and snippets.

View zlatanov's full-sized avatar

Ivan Zlatanov zlatanov

  • Sofia, Bulgaria
  • 21:07 (UTC +03:00)
View GitHub Profile
@zlatanov
zlatanov / ZLibStreamPool.cs
Created April 28, 2021 13:38
Pooling ZLibStream
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using static System.IO.Compression.ZLibNative;
namespace System.Net.WebSockets.Compression
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Data;
using Maverick.Windows;
using Expression = System.Linq.Expressions.Expression;
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
public readonly struct TimeoutConfiguredAwaitable<TResult>
{
private readonly ConfiguredTaskAwaiter _awaiter;
internal TimeoutConfiguredAwaitable(Task<TResult> task, bool continueOnCapturedContext, TimeSpan timeout)
{
_awaiter = new ConfiguredTaskAwaiter(task, continueOnCapturedContext, timeout);
}
public ConfiguredTaskAwaiter GetAwaiter() => _awaiter;
@zlatanov
zlatanov / azure.sql
Last active October 22, 2020 08:34
Frequently Used Azure SQL Scripts
--Create database as a copy in Elastic Pool
CREATE DATABASE [target_db_name] AS COPY OF [source_db_name] ( SERVICE_OBJECTIVE = ELASTIC_POOL( name = [elastic_pool_name] ) )
GO
--Find out elastic pool name for each database
SELECT
@@SERVERNAME as server_name,
dso.elastic_pool_name,
d.name as database_name,
dso.edition