Skip to content

Instantly share code, notes, and snippets.

Mike Minutillo mikeminutillo

Block or report user

Report or block mikeminutillo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mikeminutillo
mikeminutillo / Extensions.cs
Created May 23, 2018
Linearly Interpolate values in an enumerable stream of decimals
View Extensions.cs
public static class Ext
{
private static IEnumerable<decimal> LinearInterpolate(decimal lowerBound, decimal upperBound, int pointCount)
{
var gradient = (upperBound - lowerBound) / (pointCount + 1);
for(var i = 1; i <= pointCount; i++)
{
yield return lowerBound + gradient * i;
}
}
@mikeminutillo
mikeminutillo / 1.Messages.cs
Last active May 24, 2017
Run a process every midnight that gathers some data and publishes an event
View 1.Messages.cs
// Used to kick off the scheduler whenever the endpoint starts
class StartSchedulerCommand : ICommand
{
public Guid Key { get; set; }
}
// The scheduler saga sends one of these every midnight
class RunProcessCommand : ICommand
{
}
@mikeminutillo
mikeminutillo / EchoSatellite.cs
Created Feb 14, 2017
Nsb V5 satellite that just repeats what it gets sent
View EchoSatellite.cs
class EchoSatellite : ISatellite
{
public bool Handle(TransportMessage message)
{
string replyToAddress;
if (message.Headers.TryGetValue(Headers.ReplyToAddress, out replyToAddress))
{
dispatcher.Send(message, new SendOptions(replyToAddress));
return true;
}
@mikeminutillo
mikeminutillo / PublishHandledEventsAtStartup.cs
Created Dec 13, 2016
NServiceBus 6 feature. When enabled in an endpoint this feature will report all event types that can be handled to the console at startup.
View PublishHandledEventsAtStartup.cs
class PublishHandledEventsAtStartup : Feature
{
protected override void Setup(FeatureConfigurationContext context)
{
var conventions = context.Settings.Get<Conventions>();
context.RegisterStartupTask(b =>
{
var handlerRegistry = b.Build<MessageHandlerRegistry>();
return new PublishedHandledEventsToConsole(handlerRegistry.GetMessageTypes().Where(conventions.IsEventType));
@mikeminutillo
mikeminutillo / RequestTracing.cs
Created Oct 14, 2016
NSB v6 Accept Test Request Tracing
View RequestTracing.cs
static class RequestTracing
{
public static void EnableRequestTracing(this EndpointConfiguration cfg)
{
cfg.Pipeline.Register(typeof(LogIncomingBehavior), "Log incoming messages");
cfg.Pipeline.Register(typeof(LogOutgoingBehavior), "Log outgoing messages");
}
class LogOutgoingBehavior : Behavior<IDispatchContext>
{
@mikeminutillo
mikeminutillo / PipelineInspector.cs
Last active Aug 11, 2016
NServiceBus v5 Pipeline Inspector
View PipelineInspector.cs
public class PipelineInspector : IWantToRunWhenBusStartsAndStops
{
private readonly ReadOnlySettings settings;
public PipelineInspector(ReadOnlySettings settings)
{
this.settings = settings;
}
public void Start()
@mikeminutillo
mikeminutillo / ProjectDependencies.cs
Created Jun 12, 2015
Get project dependency graph out using yuml.me and LINQPad
View ProjectDependencies.cs
void Main()
{
var ignores = new Regex[]
{
new Regex(@"Approval"),
new Regex(@"Test"),
new Regex(@"Demo")
};
var serviceControl = @"C:\Code\Particular\ServiceControl\src\";
Util.Image("http://yuml.me/diagram/scruffy;scale:150/class/" + String.Join(",", GetDependencies(serviceControl, ignores))).Dump();
@mikeminutillo
mikeminutillo / ExtractUsernameAndPasswordAsStoredByIE11.cs
Created Feb 5, 2015
A LINQPad Script which will retrieve the stored password that IE autocomplete saved against a particular url.
View ExtractUsernameAndPasswordAsStoredByIE11.cs
// With massive help from http://securityxploded.com/iepasswordsecrets.php
var urlBytes = System.Text.Encoding.Unicode.GetBytes((url + '\0').ToLower());
byte[] hashBytes;
using(var sha1 = new SHA1Managed())
hashBytes = sha1.ComputeHash(urlBytes);
var checksum = hashBytes.Aggregate((x,y) => (byte)((int)x + (int)y));
var keyBytes = hashBytes.Concat(new[] { checksum }).ToArray();
var regKey = String.Join("", keyBytes.Select(x => x.ToString("X2")));
@mikeminutillo
mikeminutillo / 1.techtribes.context.c4
Created Jul 18, 2014
Architecture Definition DSL - Multi-file with components
View 1.techtribes.context.c4
internal system techtribes.je
desc techtribes.je is the only way to keep up to date with the IT, tech and digital sector in Jersey and Guernsey, Channel Islands
uses Twitter
Gets profile information and tweets from.
uses Github
Gets information about public code repositories from.
uses Blogs
Gets content using RSS and Atom feeds from.
external person Anonymous User
@mikeminutillo
mikeminutillo / Architecture Definition
Last active Aug 29, 2015
High level DSL for describing architectures according to the model outlined in http://www.codingthearchitecture.com/2014/06/24/software_architecture_as_code.html
View Architecture Definition
internal system techtribes.je
desc techtribes.je is the only way to keep up to date with the IT, tech and digital sector in Jersey and Guernsey, Channel Islands
uses Twitter
Gets profile information and tweets from.
uses Github
Gets information about public code repositories from.
uses Blogs
Gets content using RSS and Atom feeds from.
container Web Application
desc Allows users to view people, tribes, content, events, jobs, etc from the local tech, digital and IT sector.
You can’t perform that action at this time.