This file contains hidden or 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
| function Get-InternetTime | |
| { | |
| param($NtpServer = 'time.windows.com') | |
| try | |
| { | |
| $address = [Net.Dns]::GetHostEntry($NtpServer).AddressList[0]; | |
| } | |
| catch | |
| { |
This file contains hidden or 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
| # source: https://adamtheautomator.com/powershell-iis/ | |
| New-Item -ItemType Directory -Name 'MyWebsite' -Path 'C:\inetpub\wwwroot'; | |
| New-IISSite ` | |
| -Name 'MyWebsite' ` | |
| -PhysicalPath 'C:\inetpub\wwwroot\MyWebsite'; | |
| New-IISSiteBinding ` | |
| -Name 'MyWebsite' ` | |
| -BindingInformation "*:443:" ` | |
| -CertificateThumbPrint "D043B153FCEFD5011B9C28E186A60B9F13103363" ` |
This file contains hidden or 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
| # install dependencies | |
| Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart | |
| Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature | |
| Restart-Computer –Force | |
| # install provider | |
| Install-Module -Name DockerMsftProvider -Repository PSGallery -Force | |
| Install-Package -Name docker -ProviderName DockerMsftProvider | |
| Restart-Computer –Force |
This file contains hidden or 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
| .\vs.exe --nickname Reports --installPath 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Reports\' |
This file contains hidden or 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
| DECLARE @fileName NVARCHAR(MAX) = N'c:\foo.trn'; | |
| SELECT | |
| SUSER_SNAME (l.[Transaction SID]) AS [User], | |
| l.* | |
| FROM sys.fn_dump_dblog(NULL,NULL,N'DISK',1, @fileName, | |
| DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT, | |
| DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT, | |
| DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT, |
This file contains hidden or 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
| [int]$year = 2019; | |
| ls * -File | where { $_.lastwritetime.year -eq $year } | mv -Destination ".\${$year}\" |
This file contains hidden or 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
| -- a) List the equality columns first (leftmost in the column list). | |
| -- b) List the inequality columns after the equality columns (to the right of equality columns listed). | |
| -- c) List the include columns in the INCLUDE clause of the CREATE INDEX statement. | |
| -- d) To determine an effective order for the equality columns, order them based on their selectivity; that is, list the most selective columns first. | |
| -- TODO: determine required index type | |
| CREATE NONCLUSTERED INDEX [IDX_TEST] ON [dbo].[MYDB] | |
| ( | |
| -- equality_columns; start with most distinctive | |
| [TYPE] ASC, |
This file contains hidden or 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 NodaTime.Serialization.JsonNet; | |
| namespace MyApp | |
| { | |
| public sealed class Startup | |
| { | |
| public Startup(IHostingEnvironment env, IConfiguration configuration) | |
| { | |
| Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); | |
| HostingEnvironment = env ?? throw new ArgumentNullException(nameof(configuration)); |
This file contains hidden or 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
| USE [master] | |
| EXEC sp_configure 'show advanced options', 1 | |
| RECONFIGURE | |
| GO | |
| EXEC sp_configure 'xp_cmdshell', 1 | |
| RECONFIGURE | |
| GO |
This file contains hidden or 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 Polly; | |
| using Polly.Registry; | |
| namespace MyApp.MyComponent | |
| { | |
| public sealed class MyService : IMyService | |
| { | |
| private static Serilog.ILogger Log => Serilog.Log.ForContext<MyService>(); | |
| public GetResource2MaximumParticipantsUoW(IReadOnlyPolicyRegistry<string> policyRegistry) |