View (Un)Protect-CmsMessage.ps1
# Also see https://cyber-defense.sans.org/blog/2015/08/23/powershell-protect-cmsmessage-example-code
$cert = New-SelfSignedCertificate -subject 'CN=TestCert' -Type DocumentEncryptionCert -NotAfter 2100-07-01 -TextExtension @("2.5.29.37={text}1.3.6.1.4.1.311.80.1") -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider"
Export-Certificate -cert $cert -FilePath cert.cer
$ciphertext = Protect-CmsMessage -Content 'password' -To $cert.Thumbprint
$ciphertext
$plaintext = Unprotect-CmsMessage -Content $ciphertext
View VS-PackageManager-AttachW3.ps1
# Paste this into the Nuget Package Manager window in Visual Studio to attach to all w3wp processes
$DTE.Debugger.LocalProcesses | ? Name -m "w3wp.exe" | % Attach
View web-service.md

"%ProgramFiles(x86)%\IIS Express\iisexpress.exe" /path:%cd%

Defaults to port 8080

View clone-all.ps1
Param ($accessToken, $organisation)
(invoke-webrequest -Uri https://api.github.com/orgs/$organisation/repos?per_page=200"&"access_token=$accessToken"&"type=private).Content | ConvertFrom-Json | % {$_.clone_url} | % {git clone $_}
View RxVideo.cs
internal class VideoExample {
/**
* Demonstrate how Rx is used to compose Observables together such as
* how a web service would to generate a JSON response.
*
* The simulated methods for the metadata represent different services
* that are often backed by network calls.
*
* This will return a sequence of dictionaries such as this:
View AtomicDiamond.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
class X : IObservable<int>
{
public IDisposable Subscribe(IObserver<int> observer)
{
return Observable.Interval(TimeSpan.FromSeconds(1))
View GetIISPhysicalDir.cmd
powershell -command "ipmo WebAdministration; (gi $(gi 'iis:\Sites\Default Web Site\VDIR').physicalpath).parent.fullname | write-host" > destinationtmp.txt
SET /p DESTINATION=<destinationtmp.txt
del destinationtmp.txt