$ git clone https://gist.github.com/DannyQuah/5f43f9b75970bc4e357e42c7c9214b5d 2020.05-D.Quah-Managing-Gists-Locally.md
View 2022-11-21-managing-gists-locally.md
View dotnet-update-powershell
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
dotnet tool update --global powershell |
View win-update-powershell.ps1
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
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI" |
View nuget-restore.ps1
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
if (Test-Path "nuget.exe") { | |
Invoke-Expression "./nuget restore" | |
} | |
elseif((Get-Command "nuget" -ErrorAction SilentlyContinue) -ne $null) { | |
nuget restore | |
} | |
else { | |
"Nuget was not found and is required to run bootstrap.ps1. Download and retry now?" | |
choice /c yn | |
if ($LASTEXITCODE -eq 1) { |
View GetLatestVersion.cs
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 Newtonsoft.Json; | |
public static async Task<Version> GetLatestVersion() | |
{ | |
const string latestReleaseRequestUrl = | |
@"https://api.github.com/repos/{user}/{repo}/releases/latest"; | |
try | |
{ | |
string versionStr; |
View Clear-NuGet-Cache.ps1
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
[CmdletBinding(SupportsShouldProcess=$True)] | |
Param( | |
[int]$CutoffDays = 150 | |
) | |
$cutoffDate = (Get-Date).AddDays(-$CutoffDays) | |
# get path to cached NuGet packages | |
$nugetCachePath = .\Get-Nuget-Cache-Path.ps1 |
View dosomethingasync.cs
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 async Task DoSomethingAsync() | |
{ | |
await SomethingElseAsync(); | |
} | |
public async Task<Foo> DoAnotherAsync() | |
{ | |
return await ReturnAFooAsync(); | |
} |
View lists.txt
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
3D1W9MPQGSM8P,29C9ZTBRYZTRN,BT1GTNLE3DJW,1EAB07GESHF2W,2PF1IAYUTBODP,204W6ITX1MQF4 |
View linq_expression.cs
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
// IObservable<byte> (socket.Receiver) to IObservable<string> (Receiver) | |
Receiver = from header in socket.Receiver.Buffer(sizeof(int)) | |
let length = BitConverter.ToInt32(header.ToArray(), 0) | |
let body = socket.Receiver.Take(length) | |
select encoding.GetString(body.ToEnumerable().ToArray()); |
NewerOlder