Skip to content

Instantly share code, notes, and snippets.

View micdenny's full-sized avatar

Michael Denny micdenny

View GitHub Profile
@micdenny
micdenny / Program.cs
Created May 9, 2016 10:57
EasyNetQ Avoid Static Factory
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using EasyNetQ;
using EasyNetQ.ConnectionString;
using EasyNetQ.Consumer;
using EasyNetQ.Interception;
using EasyNetQ.Loggers;
using EasyNetQ.Producer;
@micdenny
micdenny / redis-ha-manual-failover.md
Last active May 28, 2018 13:31
Redis - High Availability - Manual Failover

Waiting until the support for slave-read-only on StackExchange.Redis, I would like to share my solution to fail-over a node with a minimum write interruption, maintaining data consistency, reducing (eliminating?) possible false write acknowledgment (on the node that is failing). You can lose some write because there's a window where both nodes are slaves. I feel that you can still have some false write ack because you can receive an ack while setting the master as slave and that write could be lost.

redis-slaveof-kvs01.txt

MULTI
SLAVEOF kvs01 6379
CONFIG REWRITE
PUBLISH "__Booksleeve_MasterChanged" "*"
EXEC
@micdenny
micdenny / EasyNetQ-Template.cs
Last active April 3, 2018 14:48
EasyNetQ LINQPad Template
void Main()
{
var stopHandle = new ManualResetEventSlim();
var consumer = new Thread(() =>
{
var bus = RabbitHutch.CreateBus("host=localhost", x => x.Register<IEasyNetQLogger>(s => new EasyNetQ.Loggers.ConsoleLogger()));
bus.RespondAsync<MyRequest, MyResponse>(async request =>
{
@micdenny
micdenny / Program.cs
Created May 12, 2015 13:46
EasyNetQ RPC Deadlock
using System;
using System.Threading;
using System.Threading.Tasks;
using EasyNetQ;
namespace EasynetQ.SubRpc.Deadlock
{
internal class Program
{
private static void Main(string[] args)
@micdenny
micdenny / Configuring Windows PowerShell remoting.md
Created March 27, 2015 11:31
Configuring Windows PowerShell remoting

Enabling PowerShell remoting on the server

Open PowerShell console and type the following command to enable PowerShell remoting:

Enable-PSRemoting -Force

Change scripts execution policy to allow remote scripts:

Set-ExecutionPolicy RemoteSigned
# --- settings ---
$feedUrlBase = "https://www.nuget.org/api/v2/"
# the rest will be params when converting to funclet
$latest = $true
$overwrite = $false
$top = 5000 #use $top = $null to grab all
$destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "NuGetLocal"
# --- locals ---
$webClient = New-Object System.Net.WebClient
@micdenny
micdenny / gist:db05b4d8226876f0a2b0
Last active August 29, 2015 14:15 — forked from SimplyChris/gist:dad867b3f1854528243f
all octupus parameters variables
Octopus.Acquire.MaxParallelism
Octopus.Action[Deploy Cardio API - Host].Azure.CertificateBytes
Octopus.Action[Deploy Cardio API - Host].Azure.CertificateThumbprint
Octopus.Action[Deploy Cardio API - Host].Azure.CloudServiceName
Octopus.Action[Deploy Cardio API - Host].Azure.Endpoint
Octopus.Action[Deploy Cardio API - Host].Azure.Slot
Octopus.Action[Deploy Cardio API - Host].Azure.StorageAccountName
Octopus.Action[Deploy Cardio API - Host].Azure.SubscriptionId
Octopus.Action[Deploy Cardio API - Host].Azure.SwapIfPossible
Octopus.Action[Deploy Cardio API - Host].Azure.UploadedPackageUri
@micdenny
micdenny / Program.cs
Created January 20, 2015 17:53
Rpc does not work anymore with version 0.40.3.351
using System;
using System.Threading;
using System.Threading.Tasks;
using EasyNetQ;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
@micdenny
micdenny / TopshelfBootstrapper.cs
Last active August 29, 2015 14:13
Bootstrapper sample + Topshelf
using System;
using System.Timers;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Topshelf;
namespace TopshelfBootstrapper
{
internal class Program
{
@micdenny
micdenny / TaskHelpers.cs
Created July 14, 2014 10:52
TaskHelpers
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
namespace System.Threading.Tasks
{
internal static class TaskHelpers
{