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
// for azure web sites | |
makecert -r -pe -b 01/01/2013 -e 01/01/2014 -eku 1.3.6.1.5.5.7.3.1 -ss My -n CN=serverdnsname -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -len 2048 | |
// This will install it in current user | |
// Then export the PFX from MMC (do not run pvktopfx!) | |
// for remote desktop for cloud services (powershell) | |
$cert = New-SelfSignedCertificate -DnsName mysite.cloudapp.net -CertStoreLocation "cert:\LocalMachine\My" | |
$password = ConvertTo-SecureString -String "your-password" -Force -AsPlainText | |
Export-PfxCertificate -Cert $cert -FilePath ".\tryazurecdnworker-westus-dev.pfx" -Password $password |
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
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser); | |
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly); | |
var cert = store.Certificates.Find(X509FindType.FindByThumbprint, "ff9afddf408ccd62a5dc83aacc48f8432ab7c86c", false)[0]; | |
var messageHandler = new WebRequestHandler(); | |
messageHandler.ClientCertificates.Add(cert); | |
messageHandler.ClientCertificateOptions = ClientCertificateOption.Manual; | |
HttpClient httpClient = new HttpClient(messageHandler); | |
var result = httpClient.GetAsync("https://clientcertificatetesting.azurewebsites.net/").Result; |
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
var operationUrl = string.Format("{0}/repos/{1}/{2}/commits/{3}/comments", GitHubClientApiUrl, this.repoOwner, this.repoName, commitId); | |
var jsonBody = JsonConvert.SerializeObject(new { body = message }); | |
using (var httpClient = new HttpClient()) | |
{ | |
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Token", ConfigurationManager.AppSettings["GitHubApiAccessToken"]); | |
httpClient.DefaultRequestHeaders.Add("User-Agent", UserAgent); | |
httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); | |
return await httpClient.PostAsync(new Uri(operationUrl), new StringContent(jsonBody)); |
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
public class GitHubTokenEncoder | |
{ | |
public static string Encode(string body, string token) | |
{ | |
var tokenBytes = Encoding.ASCII.GetBytes(token); | |
var tokenHmacSha1 = new HMACSHA1(tokenBytes); | |
tokenHmacSha1.Initialize(); | |
var bodyBytes = Encoding.ASCII.GetBytes(body); | |
return BitConverter.ToString(tokenHmacSha1.ComputeHash(bodyBytes)).Replace("-", string.Empty).ToLowerInvariant(); | |
} |
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
netstat -ano | |
Open commandline as administrator |
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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<ItemGroup> | |
<MsDeploySkipRules Include="SkipNewRelic"> | |
<SkipAction></SkipAction> | |
<ObjectName>dirPath</ObjectName> | |
<AbsolutePath>\\newrelic$</AbsolutePath> | |
<Apply>Destination</Apply> | |
</MsDeploySkipRules> | |
</ItemGroup> |
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
.\scriptParam.ps1 | |
----------------- | |
Param ( | |
[array] $myArray | |
) | |
foreach($foo in $myArray) | |
{ | |
Write-Host "Value $foo" | |
} |
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
netsh wlan show interfaces |
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
Dism /online /enable-feature /featurename:NetFx3 /All /Source:D:\sources\sxs /LimitAccess |
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
public static string Reverse( string s ) | |
{ | |
char[] charArray = s.ToCharArray(); | |
Array.Reverse( charArray ); | |
return new string( charArray ); | |
} |