Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
ninmonkey / FindCommandAndConquery-using-FD.ps1
Last active March 17, 2024 22:40
CommandAndConquerySet-ConfigFileLocations.md
using namespace System.Collections.Generic
$script:Paths = [ordered]@{}
@'
try this EverythingSearchQuery:
dm:last45minutes path:"*sun*" ( !path:ww:"%appdata%\code" ( !file:"-old.ini" !file:"-prev.ini" ) !path:"c:\windows" !path:"%AppData%\Microsoft\Windows\Recent" )
'@
$Paths.TiberianSun = @{
Root = gi 'H:\SteamLibrary\steamapps\common\Command & Conquer Tiberian Sun'
@ninmonkey
ninmonkey / Pwsh Copy Some Properties Constructor.md
Last active March 13, 2024 18:56
Pwsh Copy Some Properties Constructor.md
@ninmonkey
ninmonkey / Text.Rune-CalculatedFormatExample.ps1
Created January 19, 2024 21:30
Text.Rune - Calculated Columns using EzOut
Write-FormatView -TypeName ([Text.Rune]) -Property @(
'Render', 'Hex', 'Dec', 'Utf16', 'Utf8', 'Numeric' , 'Cat' , 'Ctrl' , 'Enc8', 'Enc16', 'Enc16Be', 'Upper', 'Lower'
) -AliasProperty @{
'Cat' = 'GetUnicodeCategory'
'Dec' = 'Value'
'Utf16' = 'Utf16SequenceLength'
'Utf8' = 'Utf8SequenceLength'
'Text' = 'Render'
'Lower' = 'ToLowerInvariant'
'Upper' = 'ToUpperInvariant'
@ninmonkey
ninmonkey / Basic Completions.ps1
Last active November 30, 2023 15:29
Basic powershell completions
function New.CompletionResult {
[Alias('New.CR')]
param(
# original base text
[Alias('Item', 'Text')]
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrWhiteSpace()]
[string]$ListItemText,
@ninmonkey
ninmonkey / NativeCompleter-Template-Pwsh7.ps1
Last active November 27, 2023 22:01
Minimum Native Completer Template for Pwsh 7
using namespace System.Collections
using namespace System.Collections.Generic
using namespace System.Management
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
function New.CompletionResult {
[Alias('New.CR')]
param(
# original base text
@ninmonkey
ninmonkey / Invoking-Native-Command-Example-Winget.ps1
Last active November 22, 2023 22:04
Invoking-Native-Command-Example-Winget.ps1
using namespace System.Collections.Generic
# $PSStyle.OutputRendering = 'Ansi'
@'
I used winget as a quick example case.
if you're doing more with it, check out the export as json and detailed logging options
https://learn.microsoft.com/en-us/windows/package-manager/winget/troubleshooting
https://learn.microsoft.com/en-us/windows/package-manager/winget/export#exporting-files
'@
@ninmonkey
ninmonkey / Join-String Variants Verses Format Operator.md
Last active November 10, 2023 20:13
Using Join-String verses the -format operator in Powershell
@ninmonkey
ninmonkey / Invoke-NativeCommandRipGrep.ps1
Last active October 30, 2023 18:05
Calls Native command rg with args
using namespace System.Collections.Generic
Function InvokeGrep {
<#
.SYNOPSIS
wraps the native command RipGrep
#>
param(
[string]$Pattern,
@ninmonkey
ninmonkey / Jaykul👨Grouping.psm1
Last active October 26, 2023 20:27
Wrapper to Expand Rows or Merge Arrays for Tables | Export-Excel
filter Expand-Property {
<#
.SYNOPSIS
Expands an array property, creating a duplicate object for each value
.EXAMPLE
[PSCustomObject]@{ Name = "A"; Value = @(1,2,3) } | Expand-Property Value
Name Value
---- -----
A 1
@ninmonkey
ninmonkey / Template for readme.md using screenshots.md
Last active October 12, 2023 21:20
Template for readme.md using screenshots

template-with-images.md

This example organizes all the non-pbix files in subdirectories.
Imagine main is a local folder, ex: inside the root folder: `c:\git\PowerQuery

The absolute path to my screenshot is:

c:\git\PowerQuery\img\title.screenshot.png