Skip to content

Instantly share code, notes, and snippets.

View petermorlion's full-sized avatar

Peter Morlion petermorlion

View GitHub Profile
@petermorlion
petermorlion / README.md
Created July 16, 2019 06:42
Find AWS lambda cold start durations

Full code I used to get the amount and duration of AWS Lambda cold starts during 2 given months.

Also see the question on StackOverflow.

@petermorlion
petermorlion / LoggingModule.cs
Created August 18, 2016 08:06
Autofac LoggingModule
/// <remarks>
/// Found in the Autofac documentation: http://docs.autofac.org/en/latest/examples/log4net.html
/// </remarks>
public class LoggingModule : Autofac.Module
{
private static void InjectLoggerProperties(object instance)
{
var instanceType = instance.GetType();
// Get all the injectable properties to set.
@petermorlion
petermorlion / Proxy.cs
Last active May 11, 2016 12:14
Simple WCF Proxy
public static class Proxy<T>
{
private static readonly ChannelFactory<T> ChannelFactory = new ChannelFactory<T>("*");
public static void Execute(Action<T> serviceAction)
{
var proxy = (IClientChannel) ChannelFactory.CreateChannel();
var success = false;
try
{
@petermorlion
petermorlion / DictionaryJsonConverter
Last active November 12, 2022 16:45
Generic JsonConverter for JSON.NET and IDictionaries
// UPDATE!
// In Json.NET 7, a DictionaryKeyResolver was added.
// This might be able to fix the problem more elegantly.
// I haven't checked though.
public class DictionaryJsonConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var dictionary = (IDictionary)value;