Skip to content

Instantly share code, notes, and snippets.

@sixeyed
sixeyed / profile.ps1
Created November 1, 2018 11:25
PowerShell profile with a Linux-style prompt and aliases for common Docker commands
function Prompt(){
$W = Split-Path -leaf -path (Get-Location)
$prompt = Write-Prompt "$($env:UserName)@$($env:ComputerName):" -ForegroundColor Green
$prompt += Write-Prompt $W -ForegroundColor DarkCyan
$prompt += Write-Prompt '>'
return ' '
}
function Remove-StoppedContainers {
docker container rm $(docker container ls -q)
@crypticmind
crypticmind / README.md
Last active March 25, 2024 06:26
Setup lambda + API Gateway using localstack
@incyclum
incyclum / AWS IAM Policy - ForceMFA.json
Last active April 2, 2020 20:02
AWS IAM Policy - Force MFA - This policy allows users to manage their own passwords and MFA devices but nothing else unless they authenticate with MFA -- *EDIT*: I forgot where I found it in the 1st place. In fact this policy is explained statement by statement in AWS docs: https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_users-self-man…
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:GetAccountPasswordPolicy",
@iamkoch
iamkoch / ExampleAutoDataSpecimenBuilder.cs
Created March 21, 2018 11:05
Use your autodata attribute like the XBehave Example attribute
public class ExampleAutoDataSpecimenBuilder : ISpecimenBuilder
{
private readonly object[] _data;
public ExampleAutoDataSpecimenBuilder(object[] data)
{
_data = data;
}
public object Create(object request, ISpecimenContext context)
@gasparnagy
gasparnagy / SetupStepArgumentConverterForAssist.cs
Created December 21, 2015 08:05
Configure SpecFlow v2 Assist Table helpers to use [StepArgumentTransformation] extensions
/// <summary>
/// Sets the step argument conversion infrasuructure as default for CreateSet and CreateInstance
/// </summary>
/// <remarks>
/// This method has to be called once, in a static ctor for example. Note: this way of setting is not
/// supported for parallel execution.
/// </remarks>
private static void SetupStepArgumentConverterValueRetriever()
{
var assistService = TechTalk.SpecFlow.Assist.Service.Instance;
using System.Web;
using System.Web.Optimization;
namespace WebApplication4
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
@kcargile
kcargile / ConfigurableFilterProvider.cs
Created August 8, 2014 13:32
Inject Castle Windsor Dependencies into ASP.NET Web API Filter C#
using System.Collections.Generic;
using System.Diagnostics;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using Castle.Windsor;
using Algorythmic.Web.API.Filters;
namespace Algorythmic.Web.API.Windsor.Filters
{
@jayhjkwon
jayhjkwon / BundleConfig.cs
Last active May 18, 2017 09:14
Minification of Require.js modules with ASP.NET Bundling and r.js
using System.Web;
using System.Web.Optimization;
namespace WebApplication4
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
@jogleasonjr
jogleasonjr / SlackClient.cs
Last active October 20, 2023 15:54
A simple C# class to post messages to a Slack channel. You must have the Incoming WebHooks Integration enabled. This class uses the Newtonsoft Json.NET serializer available via NuGet. Scroll down for an example test method and a LinqPad snippet. Enjoy!
using Newtonsoft.Json;
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;
//A simple C# class to post messages to a Slack channel
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet
public class SlackClient
{
@robashton
robashton / cqrs.txt
Created September 27, 2011 11:37
CQRS is not complicated
CQRS is not complicated - complex architectures are complicated, and they're complicated because we make them complicated
-------------------
CQRS is not a complicated architecture, CQRS just means maintaining a healthy division of responsibilities between reads and writes across your system - that is, having the reads in your system executed in a thin clean manner appropriate to the views you want to retrieve, and your writes going through all the crazy logic you need such as validation, updating queues, third party systems, processing business rules - whatever.
CQRS can be achieved by using a document database like Raven or Couch - using your documents as a write store, using your indexes as a query store. It can be achieved with your favourite ORM (Even better if you can actually use that O and that M and get some good old OO going) - if you want to use your objects for encapsulating business logic and go directly to the the queries to project the data you need for views (HQL, SQL directly, SPROCS, whate