Skip to content

Instantly share code, notes, and snippets.

View potatoqualitee's full-sized avatar
big permz energy

Chrissy LeMaire potatoqualitee

big permz energy
View GitHub Profile
@potatoqualitee
potatoqualitee / ZInstall-KBUpdate.ps1
Last active September 29, 2023 23:06
Installing KB Updates on Remote System, 5 day dev journal
# THIS HASN'T BEEN ADDED TO THE KBUPDATE REPO YET BUT WILL BE WHEN I GET A MOMENT
function Install-KbPatch {
<#
.SYNOPSIS
Installs KBs on local and remote servers on Windows-based systems
.DESCRIPTION
Installs KBs on local and remote servers on Windows-based systems
PowerShell 5.1 must be installed and enabled on the target machine and the target machine must be Windows-based
@potatoqualitee
potatoqualitee / getguid.ps1
Created December 28, 2021 12:32
Get GUID / Product Id / Registration ID from Windows Update EXE Executable
# Install WIX toolset
Import-Module "C:\Program Files (x86)\WiX Toolset v3.11\bin\Microsoft.Deployment.Compression.dll"
Import-Module "C:\Program Files (x86)\WiX Toolset v3.11\bin\\Microsoft.Deployment.Compression.Cab.dll"
$cab = New-Object Microsoft.Deployment.Compression.Cab.Cabinfo "$home\Downloads\file\dotnet-sdk-5.0.404-win-x64_a943fac999a30b3eb83580112b793d37de0c0700.exe"
$cab.UnpackFile("0","C:\temp\0.xml")
$a = [xml](Get-Content "C:\temp\0.xml")
$guid = [guid]$a.BurnManifest.Registration.Id
@potatoqualitee
potatoqualitee / sqldemo.yml
Last active July 25, 2021 19:58
sql demo.yml
name: Test sqlcmd against SQL Server container
on: [push, pull_request]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download and start the container (aka.ms/sqlcontainers)
@potatoqualitee
potatoqualitee / starship.toml
Last active July 10, 2021 08:05
$home\.config\starship.toml
add_newline = false
format = "$cmd_duration $directory[❯](fg:#ffffff) "
[cmd_duration]
min_time = 0
format = "\\[[$duration](bold yellow)\\]"
[git_status]
disabled = true
$base64 = [convert]::ToBase64String(([IO.File]::ReadAllBytes("C:\temp\cert.pfx")))
$buffer = [System.Convert]::FromBase64String($base64, $securestring)
$certificate = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($buffer)
Set-AuthenticodeSignature -FilePath $filePath1 -Certificate $certificate
@potatoqualitee
potatoqualitee / rundeck
Last active May 31, 2021 23:43
rundeck nginx config ssl https
# /etc/rundeck/profile
-Drundeck.jetty.connector.forwarded=true
# /etc/rundeck/rundeck-config.properties
grails.serverURL=https://rundeck
#dataSource.url = jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;MVCC=true
dataSource.driverClassName = com.microsoft.sqlserver.jdbc.SQLServerDriver
dataSource.url = jdbc:sqlserver://localhost;DatabaseName=rundeck
dataSource.username = rundeck
dataSource.password = xyz
$MyScript = [powershell]::Create()
$null = $MyScript.AddScript( { Import-Module -Name Terminal-Icons } )
$Runspace = [runspacefactory]::CreateRunspace()
$MyScript.Runspace = $Runspace
$null = Register-ObjectEvent -InputObject $MyScript -EventName InvocationStateChanged -Action {
Import-Module -Name Terminal-Icons
}
@potatoqualitee
potatoqualitee / New-Logger.ps1
Last active March 3, 2022 21:10
PowerShell Async Logging using log4net.dll
function New-Logger {
$dll = Join-Path -Path $script:ModuleRoot -ChildPath log4net.dll
$null = Add-Type -Path $dll
$pattern = '[%date{yyyy-MM-dd HH:mm:ss}] [%level] [%message]%n'
$layout = [log4net.Layout.ILayout](New-Object log4net.Layout.PatternLayout($Pattern))
$dir = "C:\temp" # this is actually in my json config file
$dir = Join-Path -Path $dir -ChildPath logs
if (-not (Test-Path -Path $dir)) {
@potatoqualitee
potatoqualitee / profile.ps1
Last active September 16, 2021 06:42
profile.ps1
##### Expand $env:psmodulepath to include C:\github
$env:psmodulepath = "$env:psmodulepath;C:\github\twitch\;C:\github\;C:\github\psframework\"
#### Tired of typing this out. notepad $hosts instead
$hosts = "C:\windows\system32\drivers\etc\hosts"
#### Quickly import everything I'm currently working on
function f {
write-output "force imports all the modules I'm working on (import-module -force), which reloads my changes"
Import-Module tvbot, tvclient, tentools -Force
add_newline = false
format = "$cmd_duration $directory[❯](fg:#ffffff) "
[cmd_duration]
min_time = 0
format = "\\[[$duration](bold yellow)\\]"
[git_status]
disabled = true