Skip to content

Instantly share code, notes, and snippets.

#Requires -Version 7.0
Import-Module 'pansies'
function Hr { "`n----`n" }
<#
See related runes:
https://www.compart.com/en/unicode/block/U+2580
#>
$up = "`u{2580}" <# upper: https://www.compart.com/en/unicode/U+2580 #>
$down = "`u{2584}" <# lower: <https://www.compart.com/en/unicode/U+2584> #>
@ninmonkey
ninmonkey / Compare ImportExcel Formula Cells.ps1
Last active May 3, 2024 06:12
Compare ImportExcel Formula Cells
Import-Module ImportExcel -PassThru
Push-Location $PSScriptRoot
# Close-ExcelWindow
$PSDefaultParameterValues['Export-Excel:Verbose'] = $true
$users = @(
[pscustomobject]@{
Name = 'Jen'
Region = 'Blue'
Len = '=LEN( [@[Name]] )'
# Here's what not to do. I'm testing line continuation grammar
$daxStudioOutput = @(
'foo has | pipe', 'path \\?\c:\foo', 'other' -join "`t"
'PBIDesktopTrace', 'XEvent' -join "`t"
'tabularEditor', '96f8cba3-0ecc-4179-b720-e27ba7cef5a' -join "`t"
) | Join-String -sep "`n"
$renderArray = @{
OutputPrefix = "[`n"
OutputSuffix = "`n]"
FormatString = "`n`t{0},"
@ninmonkey
ninmonkey / Convert Join-String Iteration to ForEach.ps1.md
Last active April 17, 2024 04:44
Join-String is natural for a lot of things, but trying to include the offset is a little unpleasant
@ninmonkey
ninmonkey / Logs-Shelly-2024-04.md
Last active April 3, 2024 18:45
Shelly: VsCode Keybindings Log

About

These are the logs from the command Developer: Toggle Keyboard Shortcuts Troubleshooting.

WhatIsKey: ctrl+spacebar

see PSReadLine.WhatIsKey KeyBindings.cs

# Shelly: Disabled, Term: default
Ctrl+@: MenuComplete - 
@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