Skip to content

Instantly share code, notes, and snippets.

View JeffMill's full-sized avatar

Jeff Miller JeffMill

  • Microsoft
  • Redmond, WA
View GitHub Profile
@JeffMill
JeffMill / cloudSettings
Last active July 13, 2017 18:06
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-07-13T18:06:50.116Z","extensionVersion":"v2.8.2"}
@JeffMill
JeffMill / WordAutomation-Threaded.ps1
Created May 10, 2021 17:06
Automate word (threaded)
$ScriptBlock =
{
Param([int]$RunNumber)
$filename = Join-Path ([IO.Path]::GetTempPath()) "powershell-$RunNumber.doc"
'Opening Word ...'
$oWord = New-Object -Com Word.Application
$oWord.Visible = $true
@JeffMill
JeffMill / Get-Signatures.ps1
Created July 26, 2023 20:15
Enumerate EXE and DLL signatures, returning Issuer and Subject.
# .\Get-Signatures.ps1 | Export-Csv -Path output.csv -NoTypeInformation
function Split-X500 {
Param([string]$X500)
$dict = @{}
$X500 -split ', ' | ForEach-Object {
$item = $_.Split('=')
$dict[$item[0]] = $item[1]
}
@JeffMill
JeffMill / List-Shared-SvcHost.ps1
Last active May 31, 2024 20:45
List all services in a shared svchost
tasklist.exe /svc /fo csv `
| Select-String -Pattern '"(?<ImageName>.*)","(?<PID>\d*)","(?<Services>.*)"' `
| ForEach-Object -MemberName Matches `
| Select-Object `
@{Name='Image Name'; Expression={$_.Groups['ImageName'].Value}}, `
@{Name='PID'; Expression={[int]$_.Groups['PID'].Value}}, `
@{Name='Services';Expression={$_.Groups['Services'].Value}} `
| Where-Object {$_.'Services' -ne 'N/A' } `
| Format-List
@JeffMill
JeffMill / kdiff3-config.md
Last active November 2, 2024 12:57
kdiff3 configuration for Windows

KDiff3

Fast on Linux and Windows, and supports 3-way merging! Diffinity and Meld are a couple of other viable options.

KDiff3 Merge Tutorial

Install KDiff3

winget install KDE.KDiff3
@JeffMill
JeffMill / git-vs.ps1
Last active August 2, 2023 22:38
Edit all open git files in a new vscode instance
& "$env:LocalAppData\Programs\Microsoft VS Code\bin\code.cmd" --new-window $(git diff --name-only --diff-filter=d HEAD | ForEach-Object { Join-Path (git rev-parse --show-toplevel) $_ })
@JeffMill
JeffMill / windows_build.md
Last active November 2, 2024 11:36
Windows build environment using cmake and Visual Studio Build Tools

Windows build environment using cmake, vcpkg, Visual Studio Build Tools

Installation

App Installer (winget)

This is included in Windows 11.

Downlevel: In Microsoft Store, Install "App Installer" (aka winget)

@JeffMill
JeffMill / ansi.ps1
Created April 10, 2024 22:20
PowerShell ansi
# https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
function Write-Bold() {
param([Parameter(Mandatory)][string]$Message)
$ESC = [char]27
"$ESC[1m$Message$ESC[0m"
}
@JeffMill
JeffMill / MessageBoxHook.cpp
Created May 31, 2024 19:56
Using a CBT Hook to modify a Windows dialog box.
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <SDKDDKVer.h>
#include <windows.h>
#include "resource.h"
INT_PTR CALLBACK AboutProc(
HWND hDlg,
UINT message,
@JeffMill
JeffMill / GitBackup.ps1
Last active September 20, 2024 20:19
git backup
git.exe stash store -m ('WIP on {0}: {1}' -f (git.exe rev-parse --abbrev-ref HEAD), (git.exe log -1 --pretty=format:'%h %s')) (git.exe stash create)
git.exe stash show 0