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 json | |
import subprocess | |
import psutil | |
import random | |
# uses cpp test program to gather the real data | |
def run(alpha, size): | |
# protocol is as follows: |
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 bisect | |
import inspect | |
import itertools | |
import inspect | |
import random | |
import time | |
import unittest | |
import numpy as np | |
from matplotlib import pyplot |
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
internal enum CodeExecutionContainerState | |
{ | |
Created, | |
Running, | |
Succeeded, | |
Failed, | |
CancellationRequested, | |
Cancelled, | |
AbortRequested, | |
Aborted |
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
public class JsonLayout : LayoutSkeleton | |
{ | |
private class Container | |
{ | |
public DateTime Timestamp { get; set; } | |
public string Level { get; set; } | |
public string Logger { get; set; } | |
public object Message { get; set; } | |
public string ThreadName { get; set; } | |
public int ThreadId { get; set; } |
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
// Usage: | |
// 1. Install-Package MultipartDataMediaFormatter.V2 | |
// 2. Alter Swagger Config | |
// c.OperationFilter<FormDataOperationFilter>(); | |
// 3. Annotate method you want to expose with multipart/form-data with [SwaggerMultipartAnnotatorAttribute] | |
public class FormDataOperationFilter : IOperationFilter | |
{ | |
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) | |
{ |
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
/// <summary> | |
/// This static wrapper around HttpClient allows to avoid issue with exhausting | |
/// outgoing sockets via reusing single instance of that. Additionally, it addresses | |
/// issue caused by resusing connections -- skipping DNS changes via limiting connection | |
/// lifespan. | |
/// See for details: | |
/// https://blogs.msdn.microsoft.com/shacorn/2016/10/21/best-practices-for-using-httpclient-on-services/ | |
/// http://byterot.blogspot.ru/2016/07/singleton-httpclient-dns.html | |
/// </summary> | |
public class SafeHttpClient |
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
public static class Instrument | |
{ | |
public class OperationMetrics | |
{ | |
public string OperationName { get; set; } | |
public DateTime StartedAt { get; set; } | |
public TimeSpan Duration { get; set; } | |
public bool IsSuccess { get; set; } | |
public Exception Error { get; set; } | |
} |
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
/// <summary> | |
/// Tolerant Enum converter. Based on code in the StackOverflow post below, but adds EnumMember attribute support. | |
/// http://stackoverflow.com/questions/22752075/how-can-i-ignore-unknown-enum-values-during-json-deserialization | |
/// </summary> | |
public class TolerantEnumConverter : JsonConverter | |
{ | |
[ThreadStatic] | |
private static Dictionary<Type, Dictionary<string, object>> _fromValueMap; // string representation to Enum value map | |
[ThreadStatic] |