1- get the public key in .pem format
openssl rsa -in id_rsa -outform pem > id_rsa.pem
openssl rsa -in id_rsa -pubout -outform pem > id_rsa.pub.pem
2- generate a 256 bit (32 byte) random key
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Reflection.Emit; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using System.Threading; |
#Based on <http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542> | |
function Test-RebootRequired | |
{ | |
$result = @{ | |
CBSRebootPending =$false | |
WindowsUpdateRebootRequired = $false | |
FileRenamePending = $false | |
SCCMRebootPending = $false | |
} |
1- get the public key in .pem format
openssl rsa -in id_rsa -outform pem > id_rsa.pem
openssl rsa -in id_rsa -pubout -outform pem > id_rsa.pub.pem
2- generate a 256 bit (32 byte) random key
public class IniFormatter : IFormatter | |
{ | |
public class IniTypeBinder : SerializationBinder | |
{ | |
public override Type BindToType(string assemblyName, string typeName) => Type.GetType(typeName.Split('=')[1]); | |
public override void BindToName(Type serializedType, out string assemblyName, out string typeName) | |
{ | |
assemblyName = $"{IniFormatter.AssemblyNameKey}={serializedType.Assembly.FullName}"; | |
typeName = $"{IniFormatter.ClassNameKey}={serializedType.AssemblyQualifiedName}"; | |
} |
// So you want to use anonymous interface implementations in C#? Does this lambda-based usage look ok? | |
// Ignore the fact that "list" and "projection" are undefined here, just note the lambdas that can close | |
// around any variables and procedures you want. | |
new AnonymousReadOnlyList<TOut>( | |
count: () => list.Count, | |
item: i => projection(list[i]), | |
iterator: list.AsEnumerable().Select(projection)); | |
new AnonymousReadOnlyList<TOut>( |
namespace Analogy | |
{ | |
/// <summary> | |
/// This example shows that a library that needs access to target .NET Standard 1.3 | |
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET | |
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library. | |
/// </summary>INetCoreApp10 | |
class Example1 | |
{ | |
public void Net45Application(INetFramework45 platform) |
<# | |
Script Name : Get-NetFrameworkVersion.ps1 | |
Description : This script reports the various .NET Framework versions installed on the local or a remote computer. | |
Author : Martin Schvartzman | |
Reference : https://msdn.microsoft.com/en-us/library/hh925568 | |
#> | |
function Get-DotNetFrameworkVersion | |
{ | |
param( | |
[string]$ComputerName = $env:COMPUTERNAME |
#requires -version 2.0 | |
[CmdletBinding()] | |
param ( | |
[parameter(Mandatory=$true)] | |
[ValidateScript({ Test-Path -Path $_ -PathType Leaf })] | |
[string] | |
$Path | |
) | |
$ErrorActionPreference = 'Stop' |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text; | |
namespace DataExportClass | |
{ | |
class Program | |
{ | |
public class Employee |