Skip to content

Instantly share code, notes, and snippets.

View MovGP0's full-sized avatar

Johann Dirry MovGP0

View GitHub Profile
Push-Location
Set-Location HKCU:\Console
New-Item ".\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe"
Set-Location ".\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe"
New-ItemProperty . FaceName -type STRING -value "Lucida Console"
New-ItemProperty . FontFamily -type DWORD -value 0x00000036
New-ItemProperty . FontSize -type DWORD -value 0x000c0000
New-ItemProperty . FontWeight -type DWORD -value 0x00000190
New-ItemProperty . HistoryNoDup -type DWORD -value 0x00000000
@MovGP0
MovGP0 / MyApp.MyComponent.MyService.cs
Last active August 31, 2018 06:59
Using Polly for Retry Policies
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)
@MovGP0
MovGP0 / Environment Variables.sql
Created September 11, 2018 08:04
SQL Server Environment Variables
USE [master]
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE
GO
@MovGP0
MovGP0 / Startup.cs
Created September 11, 2018 09:51
Configure NodaTime for NewtonSoft.Json
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));
@MovGP0
MovGP0 / create_index.sql
Last active November 28, 2019 10:03
Database Maintanance
-- 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,
@MovGP0
MovGP0 / Move-FilesByYear.ps1
Last active July 1, 2020 11:21
Copy Files into folder by year
[int]$year = 2019;
ls * -File | where { $_.lastwritetime.year -eq $year } | mv -Destination ".\${$year}\"
@MovGP0
MovGP0 / Get_changes_on_table_schema.sql
Created November 4, 2020 13:53
Analyze SQL Server Transaction logs
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,
@MovGP0
MovGP0 / Visual Studio Named Instance.ps1
Created November 13, 2020 09:37
Visual Studio Named Instance
.\vs.exe --nickname Reports --installPath 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Reports\'
@MovGP0
MovGP0 / Install Docker.ps1
Created November 13, 2020 15:48
Install Docker on Windows Server 2019
# 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