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
$userPath = $env:USERPROFILE | |
$pathExclusions = New-Object System.Collections.ArrayList | |
$processExclusions = New-Object System.Collections.ArrayList | |
$pathExclusions.Add('C:\source\repos') > $null | |
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null | |
$pathExclusions.Add('C:\Windows\assembly') > $null | |
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null | |
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio Services') > $null | |
$pathExclusions.Add($userPath + '\AppData\Local\GitCredentialManager') > $null |
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
void Main() | |
{ | |
Byte[] bytes = File.ReadAllBytes(@"C:\temp\usc.cer"); | |
String file = Convert.ToBase64String(bytes); | |
File.WriteAllText(@"C:\temp\usc.cer.b64", file); | |
} |
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
void Main() | |
{ | |
Byte[] bytes = File.ReadAllBytes(@"C:\Users\natha\Desktop\star.azuredev.simedarbyindustrial.com\certificate-single.pfx"); | |
String file = Convert.ToBase64String(bytes); | |
File.WriteAllText(@"C:\Users\natha\Desktop\star.azuredev.simedarbyindustrial.com\certificate-single.pfx.b64", file); | |
} | |
// | |
//void Main() | |
//{ | |
// var file = "MIISmQIBAzCCEl8GCSqGSIb3DQEHAaCCElAEghJMMIISSDCCDP8GCSqGSIb3DQEHBqCCDPAwggzsAgEAMIIM5QYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQILrwuJyXHU/ECAggAgIIMuNROOcvftUfNfVfe7kJ4TgPmnJwCcDhrP55pafrhoFip00ozuWCHnvO2V3clmXPGOTJYCEbZR1GPCxYQrWBv5Z8WQE/S+Ppy93aitt10sIX4c4FucpmOubBc4uioyTyZc66hgg97dNCjXKR/VZOcANDYKzWKsxicLGWKLXesek2JdSj1ZUUpLnEzqtv6jm/st26HMaUHHYMDIoHh6up78EW7f9DtrlWeQFEeE9LWOHLX3zTZyOtN9DuyhVuo1jy+owItz0sG7hUjl2Ywd3pZmLeT3jmAnGjfCBB5Tjclm8bgBbHpXg6BaBOzy5HVZaNaDW2YEWk8p9CwJGONmrsVMkqF3uzN7D216pe1UHJCbPHqi3p8wzER0dwak3b4JTWcsBHASMK6PZbWw/V4QexfEAY4S9Ag2mtOvNI1D7GRrR1ltw1eZt6NEuTnOIEOFJAchnOVqtjQGjFauu3xVM0SPQZT9b5T9LXFvi6rT4HiPboI6vave9J3pxr7cM4I5xGCIMXahud4aZMTQ1psO0UxVB6xrT6pf |
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
# You may need to install the Azure RM module first | |
# https://github.com/Azure/azure-powershell/releases | |
# Install-Module -Name AzureRM -Repository PSGallery -Force | |
$writeHostForeColour="magenta" | |
write-host "Logging in to Azure..." -foregroundcolor $writeHostForeColour | |
Login-AzureRmAccount |
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 Topshelf; | |
internal static class ConfigureService | |
{ | |
internal static void Configure(<ServiceType> serviceName) | |
{ | |
HostFactory.Run(configure => | |
{ |
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
private static Configuration GetAppConfigFile() | |
{ | |
string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); | |
string configFile = System.IO.Path.Combine(appPath, System.AppDomain.CurrentDomain.FriendlyName + ".config"); | |
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap() | |
{ | |
ExeConfigFilename = configFile | |
}; | |
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
<# | |
PowerShell script to rename C# Project step-by-step: | |
* Copying project folder to folder with new project name | |
* Renaming .csproj file and other files with project name | |
* Changing project name reference in .sln solution file | |
* Changing RootNamespace and AssemblyName in .csproj file | |
* Renaming project inside AssemblyInfo.cs | |
#> | |
param( | |
[parameter( |
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.Security.Cryptography; | |
namespace CryptographyInDotNet | |
{ | |
public class DigitalSignature | |
{ | |
private RSAParameters _publicKey; | |
private RSAParameters _privateKey; | |
public void AssignNewKey() |
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.IO; | |
using System.Security.Cryptography; | |
namespace CryptographyInDotNet | |
{ | |
public class AesEncryption | |
{ | |
public byte[] GenerateRandomNumber(int length) | |
{ | |
using (var randomNumberGenerator = new RNGCryptoServiceProvider()) |
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.Security.Cryptography; | |
namespace CryptographyInDotNet | |
{ | |
public class Pbkdf2 | |
{ | |
public static byte[] GenerateSalt() | |
{ | |
using (var randomNumberGenerator = new RNGCryptoServiceProvider()) | |
{ |
NewerOlder