Skip to content

Instantly share code, notes, and snippets.

View memark's full-sized avatar
💭
Need help on your Rust project?

Magnus Markling memark

💭
Need help on your Rust project?
View GitHub Profile
@memark
memark / Program.cs
Last active December 18, 2021 11:00
DK-53
using System.Text.RegularExpressions;
using Amazon.Route53;
using Amazon.Route53.Model;
var route53AccessKey = Environment.GetEnvironmentVariable("...");
var route53SecretKey = Environment.GetEnvironmentVariable("...");
var route53ZoneId = Environment.GetEnvironmentVariable("...");
var meeowNowAddressPattern = Environment.GetEnvironmentVariable("...")!;
var client = new AmazonRoute53Client();
@memark
memark / logging.py
Last active September 27, 2020 18:30
iso format timestamp python
import logging
logger = logging.getLogger()
ch = logging.StreamHandler()
formatter = logging.Formatter(fmt='%(asctime)s.%(msecs)03dZ - %(msg)s', datefmt='%Y-%m-%dT%H:%M:%S')
ch.setFormatter(formatter)
logger.addHandler(ch)
logger.warning("some message")
private static void RegisterBusinessLogicStubs(ContainerBuilder containerBuilder)
{
var tempContainer = CreateBusinessLogicAutofacModuleContainer();
var interfaceToStubList = GetInterfaceTypeList(tempContainer);
var stubList = interfaceToStubList.Select(x => Substitute.For(new[] { x }, new object[] { }));
foreach (var s in stubList)
containerBuilder.RegisterInstance(s).AsImplementedInterfaces();
}
private static void RegisterBusinessLogicStubs(ContainerBuilder containerBuilder)
{
var tempContainerBuilder = new ContainerBuilder();
var module = BusinessLogicAutofacModule.CreateWithoutDatabaseDefaults(default, default, default, default, default, default, default, default);
containerBuilder.RegisterModule(module);
var tempContainer = tempContainerBuilder.Build();
var interfaceToStubList = tempContainer.ComponentRegistry.Registrations
.SelectMany(x => x.Services)
.OfType<IServiceWithType>()
namespace Jwc.MoqExtensions
{
using Moq;
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Xunit;
public interface IFoo