Skip to content

Instantly share code, notes, and snippets.

@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
@ninmonkey
ninmonkey / How to move Docker-Desktop-Data to another drive.md
Last active October 10, 2023 13:31
How to move Docker-Desktop-Data to another drive

About

Docker desktop throws 20GB on c:\ . This is how you can move that to another drive like D:\wsl.2023\

EverythingSearch query

ext:vhdx
@ninmonkey
ninmonkey / Power Query Fancy Docs with Html.md
Last active August 29, 2023 22:40
Some html formatting is used by Power Query's doc strings

Here's a random example to demonstrate html

Tips : Multiline strings

It can be messy writing a bunch of newlines in a multiline string. It's easier to use a list of strings that combine.

For Html newlines

= Text.Combine({ "Line1", "", "Line3" }, "<br>")
@ninmonkey
ninmonkey / Write-LogMessage.ps1.md
Created August 11, 2023 18:19
Write-LogMessage.ps1.md
Write-LogMessage Verbose -Message 'stuff' -Json @{ 'user' = 'bob'; id = 100 }
function New-SafeFileTimeNowString {
    <#
    .SYNOPSIS
        timenow for safe filepaths: "2022-08-17_12-46-47Z"
    .notes
@ninmonkey
ninmonkey / Pwsh Config i Vs Code - temp example.md
Last active August 2, 2023 23:46
Pwsh Config i Vs Code - temp example.ps1

settings.json

{
    "powershell.startAutomatically": true,
    "powershell.enableProfileLoading": true,
    "powershell.integratedConsole.showOnStartup": true,
    "powershell.integratedConsole.suppressStartupBanner": false,
    "powershell.promptToUpdatePackageManagement": false,
    "powershell.promptToUpdatePowerShell": false,
@ninmonkey
ninmonkey / format-predent-test.md
Last active July 1, 2023 19:53
format-predent-test.md
@ninmonkey
ninmonkey / comparing original.md
Last active June 7, 2023 00:44
Refactoring ArrayList with as a Modern Array Example

I call it modern, but it fully works on PS5.1 without changes!

tip: abbreviated version using namespaces

In the examples below, if you add a using namespace statement, you can remove Systems.Collections.Generic tip: System is always included, so you can omit that prefix anywhere as well.

using namespace system.collections.generic
[List[Object]]$users = @()