Skip to content

Instantly share code, notes, and snippets.

//поиск
https://yandex.ru/search/smart/?text=%25s
//подсказки
https://suggest.yandex.ru/suggest-ff.cgi?part=%s
//using static System.Linq.Expressions.Expression;
void Main()
{
var obj = new {yoba = "zheltiy", peka = 1488};
var obj2 = new {A = "zheltiy", B = 1488, C = BindingFlags.DoNotWrapExceptions};
obj.GetAnonDict().Dump();
obj2.GetAnonDict().Dump();
}
async Task Main()
{
var dir = @"C:\Work\work\nsrj\trunk\lib";
var http = new HttpClient { BaseAddress = new Uri("https://search.maven.org") };
var deps = new StringBuilder();
foreach (var jar in Directory.EnumerateFiles(dir, @"*.jar", SearchOption.AllDirectories))
{
jar.Dump();
var hash = Sha1(File.ReadAllBytes(jar));
var url = $"https://search.maven.org/solrsearch/select?q=1:%20{hash}&start=0&rows=20";
from dataclasses import dataclass
from typing import List
T_co = TypeVar('T_co', Employee, Engineer, Manager, covariant=True)
T_contra = TypeVar('T_contra', Employee, Engineer, Manager, contravariant=True)
@dataclass
class Employee:
salary: int
@stdray
stdray / sbp.cs
Last active March 29, 2019 14:35
void Main()
{
var options = new GeneratorOptions
{
CsPath = @"C:\Users\aokarpov\Downloads\PayMsgRes\PayMsgRes.cs",
DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffZ",
Namespace = "Yoba.Peka",
XsdPath = @"C:\Users\aokarpov\Downloads\PayMsgRes\PayMsgRes.xsd",
};
Generate(options).Dump();
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Threading;
namespace ConsoleApp1
{
public class Program
{
static readonly Random Rng = new Random();
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Text;
namespace Interfax.SM.Utils.IO
{
/// <inheritdoc />
/// <summary>
@stdray
stdray / DataDogFilterAttribute.cs
Last active September 14, 2017 15:00
Simple metrics attrinute
public class DataDogFilterAttribute : ActionFilterAttribute
{
const string KEY = nameof(DataDogFilterAttribute) + "Value";
readonly string _name;
public DataDogFilterAttribute(string name)
{
if (string.IsNullOrEmpty(name))
throw new ArgumentNullException(nameof(name));
public class SerializerInfo
{
const double EPSILON = 0.0001;
readonly object _lock = new object();
double _averageSize = 0;
long _count = 0;
public SerializerInfo(XmlSerializer serializer)
{
Serializer = serializer;