Skip to content

Instantly share code, notes, and snippets.


Bill Wilder codingoutloud

View GitHub Profile
codingoutloud / ByteArraySerializer.cs
Created Jul 16, 2012
Serialize/Deserialize an object for passing through Windows Azure Queue
View ByteArraySerializer.cs
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
// Alternative (not related to this code, but in case you want to serialize to XML
// instead):
// Usage example
// NOTE: The Windows Azure CloudQueueMessage constructor accepts either a string
// or a byte array. If a byte array is passed in, it is Base64 encoded.
// Base64 encoding results in approx a 1/3 payload size penalty (so the
codingoutloud / PatientlyCreateBlobContainer.cs
Created Jul 16, 2012
Patiently create blob container; useful when container of same name was recently deleted (and full deletion may take a little time)
View PatientlyCreateBlobContainer.cs
using Microsoft.WindowsAzure.StorageClient;
/// <summary>
/// Ensure that blobContainer exists before this method returns.
/// There is no timeout or maximum time for which this method can run.
/// </summary>
/// <param name="blobContainer">The (possibly not-yet-created) blob container.</param>
/// <param name="options">Required options for blob creation.</param>
/// <param name="retryDelay">Optional. Control how long to sleep between creation attempts.</param>
/// <returns>If success, just returns. Otherwise, exception is thrown.</returns>
codingoutloud / blob-frame.html
Created Jul 26, 2012
Display a Public Blob in another HTML Page with an IFRAME
View blob-frame.html
title="Last Github commit."/>
codingoutloud / github-webhook.cs
Created Jul 26, 2012
Handle HTTP Post for WebHook
View github-webhook.cs
// POST /api/githubpushes
// FAILS: Content-Type: application/json
// WORKS: Content-Type: application/x-www-form-urlencoded
public HttpResponseMessage<string> Post(
// not needed, but might be if more complex: [FromBody]
SimpleFormData webHookData)
var pushManifestJson = webHookData.Payload;
var pushManifest = JsonConvert.DeserializeObject<GithubPushManifest>(pushManifestJson);
codingoutloud / .gitignore
Last active Oct 9, 2016
Git Ignore for ASP.NET MVC / Windows Azure development
View .gitignore
# .gitignore for ASP.NET MVC / Windows Azure development
# Original file: by @codingoutloud
## Github doc on ignoring files:
## The man page for .gitignore (referenced by github):
## Of possible interest (can be complex):
# Troubleshooting
# 1. If you add a .gitignore file to an existing repo (or significantly change one), you may want
# to force it to act as though the new/updated .gitignore was in force the whole time.
codingoutloud / make-waz-mgmt-cert.bat
Created Sep 22, 2012
Create a Windows Azure Management certificate for use with the Service Management API. This is also useful for using the "Publish" option from Visual Studio. A -private option can be used to also create a .pvk. You will need the private key (.pvk) if you
View make-waz-mgmt-cert.bat
@echo off
rem - Generate a self-signed certificate useful for use with the Windows Azure Service Management API
if .%1.==.. goto USAGE
if .%2.==.. goto USAGE
if "%3"=="-private" goto PRIVATE
makecert.exe -r -pe -n %1 -ss My -sky exchange -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 %2.cer
goto END
codingoutloud / WebRoleSimpleWAD.cs
Created Sep 23, 2012
Turning on Windows Azure Diagnostics
View WebRoleSimpleWAD.cs
// Simple approach, usually done in RoleEntryPoint::OnStart - though could be otherwise (even done remotely)
// See full working project at
public override bool OnStart()
Trace.Listeners.Add(new DiagnosticMonitorTraceListener());
Trace.AutoFlush = true;
// Set up to transfer to blob storage
DiagnosticMonitorConfiguration diagnosticConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();
codingoutloud / azure-mvc-about.cshtml
Created Oct 3, 2012
Windows Azure Web About Box snippet
View azure-mvc-about.cshtml
The beginnings of some useful context to display so one might understand some simple things about a
Windows Azure deployment without a lot of effort
As might be included in an About page:
Note: only useful when run within a custom assembly; if run from within default.cshtml on, say, trivial
Windows Azure Web Sites site, it would show the About info for mscorlib, such as:
Last compiled: Saturday, January 21, 2012 at 5:40:04 PM UTC, File version:
codingoutloud / Web.Release.config
Created Oct 3, 2012
Web.Release.config transform to apply a real Windows Azure SQL Database connection string
View Web.Release.config
<?xml version="1.0"?>
<!-- Source: -->
<configuration xmlns:xdt="">
<add name="NameOfConnectionStringNeedsToMatchWhatsInRegularWebConfig"
",1433;Database=pop-tart;User ID=hopefullynonadminuser@abcd12bhdj;Password=TopSecretPassw0rd;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
codingoutloud / make-waz-certs.bat
Created Oct 24, 2012
Generate a self-signed certificate (*.cer) useful for use with the Windows Azure Service Management API. Optionally create Private Key (*pvk) and Personal Information Exchange (*.pfx) files.
View make-waz-certs.bat
@echo off
rem - Generate a self-signed certificate (*.cer) useful for use with the Windows Azure Service Management API.
rem - Optionally create Private Key (*pvk) and Personal Information Exchange (*.pfx) files.
rem - A more advanced version of
rem - Assumes the makecert.exe and pvk2pfx.exe are available in your path on Windows.
rem - SOURCE:
if .%1.==.. goto USAGE
if .%2.==.. goto USAGE
if "%3"=="-private" goto PRIVATE
You can’t perform that action at this time.