Skip to content

Instantly share code, notes, and snippets.

Steven Kuhn stevenkuhn

Block or report user

Report or block stevenkuhn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am stevenkuhn on github.
  • I am stevenkuhn (https://keybase.io/stevenkuhn) on keybase.
  • I have a public key ASBljJq4I8JmLl_GTa2JNWQcsLo5QVVaXUKU7ZFhhSXFewo

To claim this, I am signing this object:

@stevenkuhn
stevenkuhn / Program.cs
Created Nov 11, 2015
Swagger File Generation With Swashbuckle
View Program.cs
public class Program
{
public static void Main(string[] args)
{
if (args == null || args.Length == 0) throw new InvalidOperationException("You must specify arguments.");
var path = args[0];
using (var server = TestServer.Create<Startup>())
{
View IISExpressFixture.cs
public class IISExpressFixture : IDisposable
{
public Uri Server { get; private set; }
public string SitePath { get; private set; }
private readonly Process _process;
public IISExpressFixture()
{
// Run site on a random port to prevent port clashes
View LocalFileStoreProvider.cs
public class LocalFileStoreProvider : IFileStoreProvider
{
public bool SaveScreenshot(FluentSettings settings, byte[] contents, string fileName)
{
try
{
if (!string.IsNullOrEmpty(settings.ScreenshotPrefix))
{
fileName = Path.Combine(
Path.GetDirectoryName(fileName),
View DeployToAzure.ps1
## Octopus Azure deployment script, version 1.1
## --------------------------------------------------------------------------------------
##
## This script is used to control how we deploy packages to Windows Azure.
##
## When the script is run, the correct Azure subscription will ALREADY be selected,
## and we'll have loaded the neccessary management certificates. The Azure PowerShell module
## will also be loaded.
##
## If you want to customize the Azure deployment process, simply copy this script into
@stevenkuhn
stevenkuhn / gist:5062660
Last active May 26, 2019
This PowerShell script generates release notes for Octopus Deploy that contain the GitHub commits and JIRA issues from the current build to the latest production release. It will also create the Octopus release based on the TeamCity build number.
View gist:5062660
#
# Assumptions
#
# 1. If you have a Octopus release deployed, say 1.0.0.73, there is a git
# tag set for that commit in GitHub that is "v1.0.0.73".
#
# 2. You have TeamCity label each successful build in GitHub with the format
# "v{build number}. Sidenote: it appears that TeamCity only labels the
# default branch, but not feature branches.
#
@stevenkuhn
stevenkuhn / gist:5045269
Created Feb 27, 2013
Octopus Deployment Completed Notification (PowerShell Step)
View gist:5045269
Add-Type -AssemblyName System.Web
$OctopusProjectWebLink = "/projects/myproject"
$OctopusReleaseWebLink = "/projects/myproject/releases/$OctopusReleaseNumber"
$OctopusDeploymentWebLink = "/tasks/show/$OctopusTaskId"
$OctopusWebLink = "http://my-octopus-server"
$url = "http://myhubotapp.herokuapp.com/hubot/octopus/123456"
View Deploy.ps1
$configFile = Get-Item .\nexuspwn.Service.exe.config
$xml = [xml](Get-Content $configFile)
$smtpNode = $xml.SelectSingleNode("/configuration/system.net/mailSettings/smtp")
$smtpNode.network.host = $OctopusParameters["MailSettings.Smtp.Network.Host"]
$smtpNode.network.port = $OctopusParameters["MailSettings.Smtp.Network.Port"]
$smtpNode.network.enableSsl = $OctopusParameters["MailSettings.Smtp.Network.EnableSsl"]
$smtpNode.network.userName = $OctopusParameters["MailSettings.Smtp.Network.UserName"]
$smtpNode.network.password = $OctopusParameters["MailSettings.Smtp.Network.Password"]
@stevenkuhn
stevenkuhn / releaseInfo.cshtml
Created Feb 13, 2012
Display release information via JavaScript using Octopus API, Knockout JS, and PageDown.
View releaseInfo.cshtml
<!DOCTYPE html>
<html lang="en">
<head>
<title>Octopus Release Information</title>
<style type="text/css">
</style>
</head>
<body>
<div data-bind="visible: version() != ''">
@stevenkuhn
stevenkuhn / EventService.cs
Created Feb 2, 2012
Triggering events in a Windows Service from an ASP.NET site using Redis
View EventService.cs
private void ProcessEvents() {
using (var client = redisManager.GetClient()) {
// incoming events are JSON, so deserialize each one to IDictionary<>.
var events = client.GetTypedClient<IDictionary<string, object>>().Lists["urn:events"];
while (true) {
// wait for next event, then convert it to an ExpandoObject;
dynamic @event = events.BlockingDequeue(null).ToExpando();
You can’t perform that action at this time.