Skip to content

Instantly share code, notes, and snippets.

@davidfowl
davidfowl / DynamicController.cs
Last active October 9, 2023 12:30
Dynamically loading a controller
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Infrastructure;
@Jaykul
Jaykul / New-Hyperlink.ps1
Last active August 21, 2024 11:02 — forked from JustinGrote/Write-ANSIHyperlink.ps1
Powershell Function to create Terminal HyperLinks using ANSI Escape Sequences (Supported in Windows Terminal PREVIEW)
@JustinGrote
JustinGrote / Write-ANSIHyperlink.ps1
Last active November 22, 2024 17:33
Powershell Function to create ANSI HyperLinks (Usable in Windows Terminal Preview)
@karaeren
karaeren / winget-package-install.ps1
Last active October 14, 2025 08:32
Install multiple packages with winget (and install winget if does not exist).
# Create a file named "winget.txt" in the same directory as this script.
# Write exact names for packages on each line.
# Ex: filename: winget.txt
# Microsoft.Edge
# Google.Chrome
Write-Host "Checking winget..."
Try{
# Check if winget is already installed
@natesubra
natesubra / no_mp.bat
Created May 21, 2020 16:10
Disable Windows Defender - Powershell
# disable
powershell -command 'Set-MpPreference -DisableRealtimeMonitoring $true -DisableScriptScanning $true -DisableBehaviorMonitoring $true -DisableIOAVProtection $true -DisableIntrusionPreventionSystem $true'
# Or exclude
powershell -command 'Add-MpPreference -ExclusionPath "c:\temp" -ExclusionProcess "c:\temp\yourstuffs.exe"'
@f9n
f9n / unbound-cheat-sheet.md
Last active October 22, 2025 14:40
Unbound Cheat Sheet

Unbound Cheat Sheet

Installation

$ yum install -y unbound

Setup SSL keys for unbound-control

@dlumpp
dlumpp / SurroundWithParentheses.snippet
Created October 25, 2019 15:36
Surround With Parentheses - Visual Studio Surrounds With Snippet
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>parens</Title>
<Shortcut>parens</Shortcut>
<Description>Code snippet to surround a block of code with parentheses</Description>
<Author>Dan Lumpp</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@russcam
russcam / Ingesting_Attachments.cs
Last active April 20, 2023 12:37
Ingesting attachments with Elasticsearch and NEST 7.x
using System;
using Elasticsearch.Net;
using Nest;
namespace Example
{
private static void Main()
{
var defaultIndex = "attachments";

Recreating the Windows bootloader on a new EFI partition

This guide is for UEFI-GPT Windows installs. Microsoft's bcdboot utility can recreate the bootloader on any selected partition quite easily, and it won't break any existing EFI entries (unlike the bootrec /fixmbr on MBR installs).

This process can be done on a working Windows install, or on the Windows Installer. To access the Command Promt on the Windows Installer, press ShiftF10 after the Windows Setup window appears, or click Next > Repair your computer.

Assign a drive letter to the EFI partition you want to use

You can do this with Disk Managment as well, if you can boot the installed Windows.

Enter diskpart

@cpyfferoen
cpyfferoen / NugetManager.cs
Last active May 13, 2025 15:09
NuGet API wrapper to search/install packages WITH AUTHENTICATION the same way Nuget.Exe/Client does it - looks up CredentialProviders and plugins (also for Credentials). Specific use case was Azure DevOps feed access.
using NuGet.Common;
using NuGet.Configuration;
using NuGet.Credentials;
using NuGet.PackageManagement;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Packaging.Signing;
using NuGet.ProjectManagement;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;