This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Azure Storage SDK 1.7 | |
public static RetryPolicy TrackingRetryExponential(int maxRetryCount, TimeSpan minBackoff, TimeSpan maxBackoff, TimeSpan deltaBackoff, ILog logger) | |
{ | |
logger.InfoFormat( | |
"Setting TrackingRetryExponential: maxRetryCount = {0}, minBackoff = {1}, maxBackoff = {2}, deltaBackoff = {3}", | |
maxRetryCount, minBackoff, maxBackoff, deltaBackoff); | |
return () => (int currentRetryCount, Exception lastException, out TimeSpan retryInterval) => | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// intended to be called only ONCE in real installations - or for a clean test run when no Jobs container exists | |
public static void GloballyInitializeJobManager(bool quiet) | |
{ | |
var blobContainer = AzureStorageAccess.GetBlobContainer(JobContainerName); | |
bool didNotExistCreated = blobContainer.CreateIfNotExist(); | |
if (!quiet) System.Diagnostics.Debug.Assert(didNotExistCreated); // else, we probably should not be calling this method | |
var blob = blobContainer.GetBlobReference(JobGlobalJobIdSequencePath); | |
if (!blob.Exists()) | |
{ | |
blob.UploadText(JobGlobalJobIdSequenceStartingValue); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Invoke-WebRequest https://gist.github.com/codingoutloud/3318347/raw/ -OutFile .\.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.IO; | |
namespace DevPartners | |
{ | |
/// <summary> | |
/// Power Switch for the Azure Emulator processes. Make it easy to programmatically turn Storage or Compute emulation On or Off. | |
/// </summary> | |
public static class AzureEmulatorPowerSwitch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Force HTTPS" enabled="true"> | |
<match url="(.*)" ignoreCase="false" /> | |
<conditions> | |
<add input="{HTTPS}" pattern="off" /> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" /> | |
</rule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# original: https://gist.github.com/codingoutloud/6730043 | |
# (inspired by http://blogs.msdn.com/b/kwill/archive/2013/08/26/azuretools-the-diagnostic-utility-used-by-the-windows-azure-developer-support-team.aspx) | |
# MANUALLY FIRST DO THIS from ELEVATED PowerShell command prompt | |
<# | |
Set-ExecutionPolicy Unrestricted -Force ; New-Item -ItemType Directory -Path c:\tools ; cd c:\tools ; notepad c:\tools\relax.ps1 | |
#> | |
<# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Implements the Unix shell 'which' command using PowerShell. | |
original: https://gist.github.com/codingoutloud/6782961 | |
#> | |
function WhichOnes | |
{ | |
if ($args.Count -eq 0) | |
{ | |
# obviously use of 'which' in usage text is a hack (since it is chosen to match the alias) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bill Wilder (@codingoutloud), 02-Oct-2013 | |
# Original: https://gist.github.com/codingoutloud/6800434 | |
import datetime | |
def ticks_since_epoch(start_time_override = None): | |
""" | |
Calculates number of Ticks since Jan 1, 0001 epoch. Uses current time unless another time is supplied. | |
Mimics behavior of System.DateTime.UtcNow.Ticks from.NET with 10 million Ticks per second. | |
http://msdn.microsoft.com/en-us/library/system.datetime.ticks.aspx | |
@return: Number of Ticks since Jan 1, 0001 epoch (earliest date supported by Python datetime feature) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if _%1_==__ goto USAGE | |
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem -subj "/CN=My Cert Name" | |
openssl pkcs12 -export -out mycert.pfx -inkey mycert.pem -in mycert.pem -passout pass:%1 | |
openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer | |
openssl pkcs12 -in mycert.pfx -nodes -passin pass:%1 | openssl x509 -noout -fingerprint | |
openssl x509 -in mycert.pem -noout -fingerprint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Example explorers hitting a web endpoint with Basic Auth, when you already have a token in hand | |
$key = "sk_test_mkGsLqEW6SLnZa487HYfJVLf" | |
$url = "https://api.stripe.com/v1/charges" | |
# this will work, but the flow in Basic Auth will first ask you for a password to go with the | |
# value passed in, which serves as the username. You hit enter because the password is null. | |
# Then the response comes back... BUT - this also involved a round-trip to the server (which | |
# returns a 401, but also a Response header indicating that is speaks Basic Auth: | |
# Www-Authenticate: Basic realm="Stripe" |