Skip to content

Instantly share code, notes, and snippets.

View sheastrickland's full-sized avatar

Shea Strickland sheastrickland

View GitHub Profile
@sheastrickland
sheastrickland / 0_reuse_code.js
Created March 3, 2017 04:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am sheastrickland on github.
  • I am sheastrickland (https://keybase.io/sheastrickland) on keybase.
  • I have a public key ASApvPSJ9wDH_OUFjH-fHuFNrpKzZupGlVjZ55vXEUmwhwo

To claim this, I am signing this object:

@sheastrickland
sheastrickland / your.csproj
Created December 17, 2015 00:24
<Target Name="AfterBuild"> <Message Text="@(Content)" Importance="high" Condition="%(Content.Extension) == '.sql'" /> <Error Condition="%(Content.Extension) == '.sql'" Text="Nothing should be marked as Content, check your scripts are marked as Embedded Resource" /> </Target>
<Target Name="AfterBuild">
<Message Text="@(Content)" Importance="high" Condition="%(Content.Extension) == '.sql'" />
<Error Condition="%(Content.Extension) == '.sql'" Text="Nothing should be marked as Content, check your scripts are marked as Embedded Resource" />
</Target>
@sheastrickland
sheastrickland / EnableIpSecurityOverride.ps1
Created November 5, 2015 05:26
Powershell DSC for allowing override for system.webserver.security.ipSecurity in applicationHost.config
Script EnableIpSecurityOverride
{
#Allows override for system.webserver.security.ipSecurity in applicationHost.config
DependsOn = "[Script]PreviousStepGoesHere"
SetScript = {
$current = Get-WebConfiguration /system.webServer/security/ipSecurity -Metadata | select -ExpandProperty metadata | select -ExpandProperty effectiveOverrideMode
$expected = "Allow"
$incorrect = $current -ne $expected
if ($incorrect) {
try
@sheastrickland
sheastrickland / Landlord.cs
Created September 7, 2015 06:22
Landlord: The Com Destroyer. A simple utility class to wrap those nasty little devils.
using System;
using System.Runtime.InteropServices;
namespace Things
{
public static class LandLordExtensions
{
public static LandLord<TWrapped> AsDisposable<TWrapped>(this TWrapped tenant)
{
return new LandLord<TWrapped>(tenant);
@sheastrickland
sheastrickland / cTentacleAgent.psm1
Created August 18, 2015 03:51
Octopus PowerShell DSC update for AWS
function Get-TargetResource
{
[OutputType([Hashtable])]
param (
[ValidateSet("Present", "Absent")]
[string]$Ensure = "Present",
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Name,
@sheastrickland
sheastrickland / gotcha.md
Created August 2, 2015 11:26
BlockingCollection with Parallel.ForEach with a Partitioner

Lesson Learnt, Streaming Producer / Consumer issue using:

BlockingCollection<T> and Parallel.ForEach(_blockingCollection.GetConsumingEnumerable

Beware default Partitioner algo, which is chunking and buffering.

The GetConsumingPartitioner heading covers it, and also the first comment from Stephen Toub totally nails it. We implemented similar to what commenter Hernan pointed out. Stephen Toub Blog

My absolute saviour, NoBuffering in:

[Fact]
void Main()
{
var cb = new ContainerBuilder();
cb.RegisterModule(new LoggingModule<log4net.ILog>(log4net.LogManager.GetLogger));
cb.RegisterModule(new LoggingModule<Serilog.ILogger>(Serilog.Log.ForContext));
cb.RegisterType<HasLogProperty>();
cb.RegisterType<HasLogCtor>();
@sheastrickland
sheastrickland / ApplicationInitialization.ps1
Created March 20, 2015 06:19
Application Initialization config for deployments
# Load IIS module:
Import-Module WebAdministration
# Set a name of the site we want to change
$webSiteName = $OctopusParameters['OctopusWebSiteName']
# Get web site object
$webSite = Get-Item "IIS:\Sites\$webSiteName"
Write-Output "Setting IIS web site $webSiteName serverAutoStart to true"
@sheastrickland
sheastrickland / UrlRewriteResources.ps1
Created March 19, 2015 23:28
Powershell DSC for UrlRewrite Module install and ApplicationHost changes
Package UrlRewrite
{
#Install URL Rewrite module for IIS
DependsOn = "[WindowsFeaturesWebServer]windowsFeatures"
Ensure = "Present"
Name = "IIS URL Rewrite Module 2"
Path = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi"
Arguments = "/quiet"