Skip to content

Instantly share code, notes, and snippets.

🤗
Living the dream

Adam Ralph adamralph

View GitHub Profile
@adamralph
adamralph / ConcurrencyThrottlingByMessageType.cs
Created Dec 10, 2018
Throttling concurrency by message type in NServiceBus
View ConcurrencyThrottlingByMessageType.cs
using NServiceBus.Pipeline;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
internal class ConcurrencyThrottlingByMessageType : IBehavior<IIncomingLogicalMessageContext, IIncomingLogicalMessageContext>
{
private static readonly Dictionary<Type, Throttle> throttles = new Dictionary<Type, Throttle>
{
@adamralph
adamralph / UdiWorld.cs
Created Oct 22, 2018
My solution to the saga homework for https://particular.net/adsd
View UdiWorld.cs
namespace UdiWorld
{
using System;
using System.Threading.Tasks;
using NServiceBus;
public class UserBecamePreferred
{
public Guid UserId { get; set; }
}
@adamralph
adamralph / bullseye-custom-args.cs
Last active Sep 25, 2018
Using Bullseye with custom args
View bullseye-custom-args.cs
// dotnet add package McMaster.Extensions.CommandLineUtils
using McMaster.Extensions.CommandLineUtils;
using static Bullseye.Targets;
class Program
{
static void Main(string[] args)
{
var app = new CommandLineApplication(throwOnUnexpectedArg: false);
View twitter-home-hider.js
// ==UserScript==
// @name Twitter Home hider 323465
// @version 1
// @grant none
// @include https://twitter.com/*
// ==/UserScript==
document.getElementById("global-nav-home").style.display = "none";
@adamralph
adamralph / search-package-usage.linq
Last active Nov 10, 2017
A LINQPad script to search GitHub repos for package usage (and potentially other things)
View search-package-usage.linq
<Query Kind="Statements">
<NuGetReference>Humanizer</NuGetReference>
<NuGetReference>Octokit</NuGetReference>
<Namespace>Humanizer</Namespace>
<Namespace>Octokit</Namespace>
<Namespace>Octokit.Internal</Namespace>
<Namespace>System.Threading.Tasks</Namespace>
</Query>
// I wrote this script to help me find out where my NuGet packages are being used.
View .editorconfig
root = true
[*]
charset = utf-8
end_of_line = crlf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true
@adamralph
adamralph / build.cmd
Last active Nov 17, 2017
Standard build boostrapper
View build.cmd
@echo Off
cd %~dp0
setlocal EnableDelayedExpansion
set CSI_VERSION=2.4.0
set NUGET_VERSION=4.3.0
set SCRIPT=%~n0.csx
set PACKAGES_CONFIG=packages.config
set PACKAGES_DIR=packages\
@adamralph
adamralph / list-video-duration.linq
Last active Sep 28, 2017
List duration of video files
View list-video-duration.linq
<Query Kind="Statements">
<NuGetReference>Xabe.FFmpeg</NuGetReference>
<Namespace>Xabe.FFmpeg</Namespace>
</Query>
Util.AutoScrollResults = true;
FFbase.FFmpegDir = @"C:\ffmpeg-3.3.3-win64-static\bin";
Directory.EnumerateFiles(@"C:\vids")
@adamralph
adamralph / HashBus.DeDup-Program.cs
Created Mar 31, 2017
A hack to remove dups from HashBus, from before we fixed the app to strip them out on the way in
View HashBus.DeDup-Program.cs
namespace HashBus.DeDup
{
using System;
using System.Linq;
using System.Threading.Tasks;
using HashBus.ReadModel;
using HashBus.ReadModel.MongoDB;
using MongoDB.Driver;
class Program
@adamralph
adamralph / inspectcode-error.txt
Created Nov 14, 2016
Intermittent error in InspectCode in Resharper Command Line tools
View inspectcode-error.txt
Running '"./.resharper/inspectcode.exe" --profile=./src/NServiceBus.RabbitMQ.sln.DotSettings --output=./src/NServiceBus.RabbitMQ.sln.inspections.xml ./src/NServiceBus.RabbitMQ.sln'...
JetBrains Inspect Code 2016.2.2
Running in 64-bit mode, .NET runtime 4.0.30319.42000 under Microsoft Windows NT 6.2.9200.0
Custom settings layer is mounted. Used file C:\code\Particular\NServiceBus.RabbitMQ\src\NServiceBus.RabbitMQ.sln.DotSettings
Asking for writer lock unexpected. File changes:
--- EXCEPTION #1/1 [LoggerException]
Message = "Asking for writer lock unexpected. File changes:"
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
You can’t perform that action at this time.