Skip to content

Instantly share code, notes, and snippets.

@mikaelo
mikaelo / Program.cs
Created March 9, 2021 17:08 — forked from tmarkovski/Program.cs
Generate elliptic curve SECP256K1 key pair using Bouncy Castle for .NET
using System;
using System.Linq;
using Org.BouncyCastle.Asn1.X9;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;
namespace Program
{
namespace System.Collections.Generic
{
public static class ConcurrentDictionaryExtensions
{
/// <summary>
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
/// <param name="dictionary"></param>
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;

public class Program
{
    static void Main() => WebHost.Start(ctx => ctx.Response.WriteAsync("Hello World!")).WaitForShutdown();
}
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
математика
курсы
Математика и Python для анализа данных
https://www.coursera.org/learn/mathematics-and-python
Введение в машинное обучение - Higher School of Economics | Coursera
https://www.coursera.org/learn/vvedenie-mashinnoe-obuchenie
Лекции
[Школа анализа данных. Яндекс] Дискретный анализ и теория вероятностей.
http://rutracker.org/forum/viewtopic.php?t=4640811
Дискретная математика (видеозапись лекций WEBRip)
@mikaelo
mikaelo / gist:588baf274e19935f5895
Last active August 29, 2015 14:26
MediatR MediatorPipeline
public class MediatRInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store) {
container.Register(Classes.FromAssemblyContaining<IMediator>().Pick().WithServiceAllInterfaces());
container.Kernel.AddHandlersFilter(new ContravariantFilter());
container.Register(Classes.FromThisAssembly().BasedOn(typeof (IRequestHandler<,>)).WithService.AllInterfaces().LifestyleTransient());
container.Register(Classes.FromThisAssembly().BasedOn(typeof (IPreRequestHandler<>)).WithService.AllInterfaces().LifestyleTransient());
container.Register(Classes.FromThisAssembly().BasedOn(typeof (IPostRequestHandler<,>)).WithService.AllInterfaces().LifestyleTransient());
container.Register(Classes.FromThisAssembly().BasedOn(typeof (INotificationHandler<>)).WithService.AllInterfaces().LifestyleTransient());
@mikaelo
mikaelo / AsyncMediatorPipeline.cs
Last active August 29, 2015 14:26
AsyncMediatorPipeline and Autofac Registration
public class AsyncMediatorPipeline<TRequest, TResponse> : IAsyncRequestHandler<TRequest, TResponse> where TRequest : IAsyncRequest<TResponse>
{
private readonly IAsyncRequestHandler<TRequest, TResponse> inner;
private readonly IAsyncPreRequestHandler<TRequest>[] preRequestHandlers;
private readonly IAsyncPostRequestHandler<TRequest, TResponse>[] postRequestHandlers;
public AsyncMediatorPipeline(IAsyncRequestHandler<TRequest, TResponse> inner, IAsyncPreRequestHandler<TRequest>[] preRequestHandlers, IAsyncPostRequestHandler<TRequest, TResponse>[] postRequestHandlers)
{
this.inner = inner;
using System.Collections.Generic;
namespace System.Threading
{
public class PollingWorker : IPollingWorker,IDisposable
{
private class TickAction
{
public string Name { get; set; }
public Action Work { get; set; }
using System.Collections.Generic;
namespace System.Threading
{
public class PollingWorker : IPollingWorker,IDisposable
{
private class TickAction
{
public string Name { get; set; }
public Action Work { get; set; }
// ProxyRequest proxies a request to a JSON-based API
// to avoid the cross origin request issue.
// It assumes the API supports POST.
// JsonResult is an ASP.NET MVC construct.
private JsonResult ProxyRequest(string url, string data)
{
HttpWebRequest wr = (HttpWebRequest)HttpWebRequest.Create(url);
wr.Method = "POST";
wr.ContentType = "application/json";