Skip to content

Instantly share code, notes, and snippets.

View lennybacon's full-sized avatar
🏠
Working from home

Daniel Fisher lennybacon

🏠
Working from home
View GitHub Profile
@lennybacon
lennybacon / vscode-markdown.css
Created May 6, 2021 12:38
Visual Studio Code Markdown Style
html{
background-color: #343434;
font-size: 14px;
color: #404040;
}
body{
width:700px;
background-color: #e6e6e6;
margin: auto;
@lennybacon
lennybacon / ietf-dark.css
Last active May 27, 2021 15:48
Stylus dark theme for RFCs
/* ==UserStyle==
@name IETF Dark
@namespace https://gist.github.com/lennybacon
@version 1.0.1
@description Dark theme for IETF
@author lennybacon
@homepageURL https://gist.github.com/lennybacon/aa4b520e6a04e17c820b70fca793db6a
@updateURL https://gist.githubusercontent.com/lennybacon/aa4b520e6a04e17c820b70fca793db6a/raw/355f11c3c3f4e4aa2103e2fe9754d61f41e07ced/ietf-dark.css
@license CC-BY-SA-4.0
==/UserStyle== */
@lennybacon
lennybacon / TimeZoneInfoConverter.tt
Created May 26, 2020 20:40
T4 Template for conversion of IANA and Windows time zones.
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ output extension=".g.cs" #>
<#@ assembly name="EnvDTE" #>
<#@ assembly name="System.Text.Json" #>
<#@ assembly name="System.Memory" #>
<#@ assembly name="netstandard" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Net" #>
<#@ import namespace="System.Text.Json" #>
<#
@lennybacon
lennybacon / Customize-Windows.ps1
Last active March 9, 2020 08:13
Customize Windows after First Start
Write-Host "Disable Telemetry" -ForegroundColor Cyan;
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name AllowTelemetry -PropertyType DWord -Value 0 -force | Out-Null;
Stop-Service DiagTrack | Out-Null;
Set-Service DiagTrack -startupType Disabled | Out-Null;
Stop-Service dmwappushservice | Out-Null;
Set-Service dmwappushservice -startupType Disabled | Out-Null;
Write-Host "Add Developer Exclusions For Windows Defender" -ForegroundColor Cyan;
Add-MpPreference -ExclusionProcess "light.exe" | Out-Null;
Add-MpPreference -ExclusionProcess "candel.exe" | Out-Null;
@lennybacon
lennybacon / Reboot-IfNecessary.ps1
Created January 16, 2020 10:38
Detect a pending reboot and restart computer
$registryKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired");
if ($null -ne $registryKey){
if ($registryKey.GetValueNames().Length -ne 0) {
Write-Host "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired indicates a pending reboot.";
Write-EventLog –LogName Application –Source $EventLogSourceName –EntryType Information –EventID 99 –Message "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired indicates a pending reboot.";
Restart-Computer -Force
}
}
$registryKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Updates");
@lennybacon
lennybacon / sql_2019_unattended.ps1
Last active November 7, 2019 08:31
Install Microsoft SQL Server 2019 unattended
$setupPath = ".\Setup.exe";
$productKey = "XXX";
$instanceName = "MSSQLSERVER";
$version = "2019";
$collation = "Latin1_General_CI_AS";
$serviceAccount = "";
$serviceAccountPassword = "";
$currentUser = [System.Environment]::UserDomainName + "\" + [System.Environment]::UserName;
$sqlAdminAccount = "";
$sqlAdminGroup = "";
@lennybacon
lennybacon / GenerateMachineKey.targets
Last active October 16, 2019 09:04
Machine Key Section validation and decryption key rotation on build
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask
TaskName="GenerateMachineKey"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup />
<Task>
<Reference Include="System.Xml"/>
<Using Namespace="System"/>
@lennybacon
lennybacon / keybase.md
Created September 12, 2019 07:34
keybase.md

Keybase proof

I hereby claim:

  • I am lennybacon on github.
  • I am lennybacon (https://keybase.io/lennybacon) on keybase.
  • I have a public key ASAvI6JKRHH2pitIjxBbmRXuLmZoDaQBD9lQ9vlyK0IXfgo

To claim this, I am signing this object:

@lennybacon
lennybacon / New-AES256Key.ps1
Last active April 29, 2024 11:54
Generate a new AES 256 Key with PowerShell
$random = [System.Security.Cryptography.RandomNumberGenerator]::Create();
$buffer = New-Object byte[] 32;
$random.GetBytes($buffer);
[BitConverter]::ToString($buffer).Replace("-", [string]::Empty);
@lennybacon
lennybacon / Set-LnkToRunAsAdmin.ps1
Created June 28, 2019 06:51
Modify Link to run as admin
$linkFilePath = "C:\Users\$([Environment]::UserName)\Desktop\WindowsTerminal.lnk"
$bytes = [System.IO.File]::ReadAllBytes($linkFilePath)
$bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON
[System.IO.File]::WriteAllBytes($linkFilePath, $bytes)