Skip to content

Instantly share code, notes, and snippets.

View PaulNichols's full-sized avatar

Paul Nichols PaulNichols

  • Australia
View GitHub Profile
@PaulNichols
PaulNichols / Windows Defender Exclusions VS 2019.ps1
Created September 10, 2020 10:12 — forked from Braytiner/Windows Defender Exclusions VS 2019.ps1
Adds Windows Defender exclusions for Visual Studio 2019
$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
@PaulNichols
PaulNichols / gist:a25a0d94fde21e467e58aba232b109ee
Created August 26, 2019 01:44
public cerrificate file to b64 encoded
void Main()
{
Byte[] bytes = File.ReadAllBytes(@"C:\temp\usc.cer");
String file = Convert.ToBase64String(bytes);
File.WriteAllText(@"C:\temp\usc.cer.b64", file);
}
@PaulNichols
PaulNichols / gist:516321287633b3cdc5c40e453432caa9
Created November 27, 2018 00:49
Get FIle as Base 64 string
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
@PaulNichols
PaulNichols / login.ps1
Last active February 2, 2018 05:57
Azure login
# 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
@PaulNichols
PaulNichols / ConfigureService.cs
Created August 21, 2017 23:54
Topshelf Windows Service configuration
using Topshelf;
internal static class ConfigureService
{
internal static void Configure(<ServiceType> serviceName)
{
HostFactory.Run(configure =>
{
@PaulNichols
PaulNichols / updated a config file appsetting
Created August 21, 2017 23:52
updated a config file appsetting
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
};
@PaulNichols
PaulNichols / RenameCSharpProject.ps1
Created January 18, 2017 23:30 — forked from dadhi/RenameCSharpProject.ps1
PowerShell script to rename C# Project.
<#
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(
using System.Security.Cryptography;
namespace CryptographyInDotNet
{
public class DigitalSignature
{
private RSAParameters _publicKey;
private RSAParameters _privateKey;
public void AssignNewKey()
@PaulNichols
PaulNichols / AesEncryption.cs
Last active March 1, 2017 22:38
Cryptography - AES Encyption
using System.IO;
using System.Security.Cryptography;
namespace CryptographyInDotNet
{
public class AesEncryption
{
public byte[] GenerateRandomNumber(int length)
{
using (var randomNumberGenerator = new RNGCryptoServiceProvider())
@PaulNichols
PaulNichols / Pbkdf2.cs
Created January 9, 2017 23:06
Cryptography - Password Based Key Derivation Function Demonstration
using System.Security.Cryptography;
namespace CryptographyInDotNet
{
public class Pbkdf2
{
public static byte[] GenerateSalt()
{
using (var randomNumberGenerator = new RNGCryptoServiceProvider())
{