Skip to content

Instantly share code, notes, and snippets.

View andrewabest's full-sized avatar

Andrew Best andrewabest

View GitHub Profile
@andrewabest
andrewabest / Conversion.bat
Created February 10, 2016 03:29
Convert a crt + p7b (from godaddy) to pfx
echo off
:: download OpenSSL if you don't have it for the below
:: Conver the p7b into PEM format
openssl pkcs7 -in mydomain.p7b -print_certs -out mydomain.pem
:: Combine this with the crt server certificate and private key into a PFX
openssl pkcs12 -export -in mydomain.crt -inkey mydomain.key -certfile mydomain.pem -out mydomain.pfx
@andrewabest
andrewabest / BaseScenario.cs
Created February 9, 2016 06:07
Nancy Integration Testing
public abstract class NancyIntegrationScenario
{
private IContainer integrationTestContainer;
private readonly ContainerBuilder containerOverrides = new ContainerBuilder();
[TestFixtureSetUp]
public void TestFixtureStart()
{
integrationTestContainer = CreateIntegrationContainer();
BuildTestDatabase();
@andrewabest
andrewabest / Extraction.bat
Created December 21, 2015 00:16
AWS IAM Server Certificates (i.e. for LoadBalancer SSL) from PFX
echo off
:: download OpenSSL if you don't have it for the below
:: Extract the private key from the pfx, and convert it to rsa format
openssl pkcs12 -in wildcard_mydomain_com.pfx -nocerts -nodes -passin pass:eb | openssl rsa -out wildcard_mydomain_com.key
:: Extract the public key from the pfx, and convert it to x509
openssl pkcs12 -in wildcard_mydomain_com.pfx -clcerts -nokeys -passin pass:eb | openssl x509 -out wildcard_mydomain_com.cer
@andrewabest
andrewabest / ContinuousDeploymentWithGitVersionAndGitFlow.md
Last active October 28, 2020 10:21
How to use GitVersion for semantic versioning with TeamCity and Octopus Deploy

Setting up TeamCity and Octopus with GitVersion

Assumptions

  • You are using GitFlow
  • You want to deploy a new version of your software every time a commit is made to the develop branch
  • You are using Octopack to package your application for deployment

Instructions

@andrewabest
andrewabest / web.config
Created November 20, 2015 04:28
Url rewrite for ssl offloading
<rewrite>
<rules>
<rule name="HTTPS_AlwaysOn" patternSyntax="Wildcard">
<match url="*" />
<serverVariables>
<set name="HTTPS" value="on" />
</serverVariables>
<action type="None" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" />
@andrewabest
andrewabest / rewrite.ps1
Created November 16, 2015 05:26
Configuring global URL rewrites for reverse proxying
Import-Module WebAdministration
Set-WebConfigurationProperty system.webServer/proxy -Name enabled -Value "True"
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/rewrite/globalRules" -name "." -value @{name='Stores';stopProcessing='True'}
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/rewrite/globalRules/rule[@name='Stores']/match" -name "url" -value "^Stores/?(.*)/?$"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/rewrite/globalRules/rule[@name='Stores']/action" -name "type" -value "Rewrite"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/rewrite/globalRules/rule[@name='Stores']/action" -name "url" -value "http://localhost:10003/Stores/{R:1}"
@andrewabest
andrewabest / DOD.md
Created October 22, 2015 22:45
Team Charter and Definition of Done

“Done” has a special meaning in agile projects. It’s not “done but…” or “done except…” but “Done” with a capital D. This means that a story or task has satisfied all of its acceptance criteria and our global done criteria.

  • Acceptance criteria satisfied.
  • All code written.
  • All tests pass.
  • There are (at least some) tests for new code.
  • Tests (at least one) added when touching existing code.
  • Build is green.
  • Code merged to refs/heads/develop via PR
  • Deployed to CI
@andrewabest
andrewabest / Landlord.cs
Last active November 23, 2015 00:03 — forked from sheastrickland/Landlord.cs
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);
@andrewabest
andrewabest / gittfs.md
Last active November 22, 2015 23:59
Git-Tfs Setup

First

Then

To clone the main branch of your TFS project as a git repo (aka get the codez):

  • Create a new directory to store your git projects, seperate from your 'standard' TFS source directory**. (For example, use c:\projects.git instead of c:\projects)
  • Open a command prompt and navigate to your git source directory.
@andrewabest
andrewabest / cors.md
Last active August 29, 2015 14:22
CORS

Same-Origin Policy

Each browser has it's own Same-Origin policy (https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) that it enforces to avoid certain types of CSRF attacks.

If a browser's SOP is triggered when attempting to send a request, it will either refuse to send the request*, or trigger an OPTIONS request to be sent, which the server must respond to with a list of Access-Control headers (http://www.w3.org/TR/cors/#syntax). The browser can then inspect these to determine whether it is good to go ahead and send the request or not.

IE Gotchas