Skip to content

Instantly share code, notes, and snippets.

View phil-scott-78's full-sized avatar

Phil Scott phil-scott-78

View GitHub Profile
Write-Output "Cleaning exclusion paths"
$Paths=(Get-MpPreference).ExclusionPath
foreach ($Path in $Paths) { Remove-MpPreference -ExclusionPath $Path }
Write-Output "Cleaning exclusion extensions"
$Extensions=(Get-MpPreference).ExclusionExtension
foreach ($Extension in $Extensions) { Remove-MpPreference -ExclusionExtension $Extension }
Write-Output "Cleaning exclusion processes"
@phil-scott-78
phil-scott-78 / Microsoft.PowerShell_profile.ps1
Last active November 19, 2022 18:19
Powershell Profile
function Run-Step([string] $Description, [ScriptBlock]$script)
{
Write-Host -NoNewline "Loading " $Description.PadRight(20)
& $script
Write-Host "`u{2705}" # checkmark emoji
}
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$stopwatch = [system.diagnostics.stopwatch]::StartNew()
@phil-scott-78
phil-scott-78 / Spectre.Console.xml
Created April 8, 2021 02:16
External annotations for Spectre.Console
<assembly name="Spectre.Console">
<member name="T:Spectre.Console.Cli.ICommand">
<attribute ctor="M:JetBrains.Annotations.UsedImplicitlyAttribute.#ctor(JetBrains.Annotations.ImplicitUseTargetFlags)" >
<argument>5</argument>
</attribute>
</member>
<member name="T:Spectre.Console.Cli.CommandSettings">
<attribute ctor="M:JetBrains.Annotations.UsedImplicitlyAttribute.#ctor(JetBrains.Annotations.ImplicitUseTargetFlags)" >
<argument>5</argument>
</attribute>
{
"final_space":true,
"osc99":false,
"console_title":false,
"console_title_style":"",
"console_title_template":"",
"blocks":[
{
"type":"prompt",
"alignment":"left",
@phil-scott-78
phil-scott-78 / settings.json
Created August 27, 2020 19:53
Windows Terminal Settings File (1.3)
// This file was initially generated by Windows Terminal Preview 1.3.2382.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@phil-scott-78
phil-scott-78 / AutoMapper.xml
Last active July 5, 2020 14:24
External Annotations
<assembly name="AutoMapper">
<member name="T:AutoMapper.Profile">
<attribute ctor="M:JetBrains.Annotations.UsedImplicitlyAttribute.#ctor(JetBrains.Annotations.ImplicitUseTargetFlags)" >
<argument>5</argument>
</attribute>
</member>
</assembly>
@phil-scott-78
phil-scott-78 / create-event.sql
Last active April 2, 2019 17:45
extended event repo
CREATE EVENT SESSION [ShowPlanSpy-7d12bc47-1fe4-47b5-b728-4392b533bc6f] ON SERVER
ADD EVENT sqlserver.query_post_execution_showplan(
ACTION(sqlserver.plan_handle,sqlserver.query_hash,sqlserver.query_plan_hash,sqlserver.sql_text)
WHERE ([sqlserver].[equal_i_sql_unicode_string]([sqlserver].[database_name],N'StackOverflowMath')))
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=1 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
GO
@phil-scott-78
phil-scott-78 / Demystify.cs
Created November 10, 2017 21:16
Demystify with a lil reflection
using System;
using System.Reflection;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
try
@phil-scott-78
phil-scott-78 / Program.cs
Last active April 2, 2017 23:17
field or property
using System;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Running;
namespace Benchmark
{
class Program
@phil-scott-78
phil-scott-78 / xunit-and-resharper-async-tests.cs
Last active March 20, 2017 14:39
Resharper fails to run classes with async methods
using System;
using System.Threading.Tasks;
using Xunit;
namespace XUnitTestProject1
{
public class Works
{
[Fact]
public void Test1()