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 System; | |
using System.Collections.Generic; | |
using System.Drawing; | |
using System.Windows.Forms; | |
using System.Reactive.Disposables; | |
public static class ControlExtensions | |
{ | |
public static IDisposable IsRightOf(this Control control, Control target, int spacing = 0, VisibilityBehavior behavior = VisibilityBehavior.MaintainSpacing) | |
{ |
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
SELECT MIN(CustomerNumber + 1) | |
FROM Customer | |
WHERE NOT EXISTS (SELECT * FROM Customer WHERE CustomerNumber = MIN(CustomerNumber) + 1) |
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
^(.+)\n(?=.*^\1$) |
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
function Get-InternetTime | |
{ | |
param($NtpServer = 'time.windows.com') | |
try | |
{ | |
$address = [Net.Dns]::GetHostEntry($NtpServer).AddressList[0]; | |
} | |
catch | |
{ |
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
# 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 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 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 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 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 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, |
NewerOlder