Skip to content

Instantly share code, notes, and snippets.

View akimboyko's full-sized avatar
🙃

Akim Boyko akimboyko

🙃
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@akimboyko
akimboyko / gist:4538388
Created January 15, 2013 12:45
Ninject Contextual Binding for different environments
void Main()
{
// create kernel with conventions
using(var kernel = InitializeKernel())
{
var backend = kernel.Get<IBackend>();
Assert.That(backend, Is.Not.InstanceOfType(typeof(ProdBackend))
.And.InstanceOfType(typeof(TestBackend)));
}
@akimboyko
akimboyko / gist:4258647
Created December 11, 2012 13:41
PowerShell exception re-throwing sample
Write-Host 'throw'
try
{
try
{
throw "exception"
}
catch
{
@akimboyko
akimboyko / 01_SayHello.fsx
Last active May 28, 2023 13:00
Samples from "Actor-based Concurrency with F# and Akka.NET" http://bit.ly/FSharpAkkaNET
#time "on"
#load "Bootstrap.fsx"
open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open Akka.TestKit
// #Using Actor
@akimboyko
akimboyko / gist:4622557
Last active February 23, 2022 07:11
Custom scope for Ninject that returns same instance based on first constructor argument. Using both kernel and factory
void Main()
{
using(var kernel = new StandardKernel(new Module()))
{
kernel.Load<FuncModule>(); // for sake of LinqPAD
var instance1 = kernel.Get<MyClass>(new ConstructorArgument("myArg", "test"));
var instance2 = kernel.Get<MyClass>(new ConstructorArgument("myArg", "test"));
Assert.That(instance1, Is.Not.Null.And.SameAs(instance2));
@akimboyko
akimboyko / simple_tcp_server_with_SO_REUSEPORT.py
Last active April 23, 2019 17:29
Let's play with a simple TCP server with SO_REUSEPORT
import socket
import sys
from contextlib import contextmanager
import click
so_reuseport = socket.SO_REUSEPORT
@contextmanager
@akimboyko
akimboyko / FsCheckSamples.fsx
Last active March 27, 2019 08:04
Samples for Property-based testing using FsCheck for F# and C# talk for Kiev Alt.NET
#I @".\packages\FsCheck.0.9.2.0\lib\net40-Client\"
#r @"FsCheck.dll"
// #time "on"
open FsCheck
// simple example
let revRevIsOrig (xs:list<int>) = List.rev(List.rev xs) = xs
Check.Quick revRevIsOrig;;