Skip to content

Instantly share code, notes, and snippets.

View KevinMarquette's full-sized avatar

Kevin Marquette KevinMarquette

View GitHub Profile
<#
.Example
.\HadoopVSPowershell.ps1
.Author
@KevinMarquette
.Notes
You may need to [GC]::Collect() after this because it uses a lot of RAM
#>
[cmdletbinding()]
param([string]$Path = (Get-Location))
function Get-ChessResult
{
[CmdletBinding()]
Param(
[Parameter(
Position = 0,
Mandatory = $true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true
<#
.SYNOPSIS
Used to replace text in a file.
.EXAMPLE
Get-ChildItem -Recurse | Set-String -Pattern "c:\documents" -ReplaceWith "c:\users"
.EXAMPLE
Set-String -Pattern "c:\documents" -ReplaceWith "c:\users" -Path c:\temp\script.ps1
#>
Function Set-String
{
function Get-Double ($number){$number + $number}
function Get-Double2
{
<#
.SYNOPSIS
.EXAMPLE
New-Function -ComputerName server
.EXAMPLE
function Get-AllCaps
{
param(
[char[]]$InputObject
)
If($InputObject.count -eq 1)
{
Write-Output $InputObject[0].ToString().ToUpper()
Write-Output $InputObject[0].ToString().ToLower()
@KevinMarquette
KevinMarquette / PowerShellv4_DynamicKeyword.md
Created June 3, 2017 19:45 — forked from altrive/PowerShellv4_DynamicKeyword.md
Test code of PowerShell v4 Dynamic Keyword

Define DynamicKeyword

Define DynamicKeyword 'ExecTest'

Note: Don't copy&paste from following code. PowerShell SyntaxHighlighter remove some lines. Instead, use RAW view.

#Requires -Version 4.0
Set-StrictMode -Version Latest
@KevinMarquette
KevinMarquette / elastickeywordslowercase
Created May 29, 2019 16:33
lowercase elastic keywords
{
"template": "*",
"order": 0,
"mappings": {
"doc": {
"dynamic_templates": [
{
"strings_as_keywords": {
"match_mapping_type": "string",
"mapping": {
$path = 'D:\Games\Blizzard\World of Warcraft\_classic_\Interface\AddOns\ISBoxer\ISBoxer.toc'
$data = Get-Content $path
$properties = @{}
$pattern = '## (?<propertyName>[^:]*): (?<propertyValue>.*)'
foreach($line in $data)
{
@KevinMarquette
KevinMarquette / Find-CommandDelta
Created December 30, 2021 17:28
A function that compares the commands listed in dbatools to the commands listed in the commands index page. No errorhandling.
using namespace System.Collections.Generic
function Find-CommandDelta {
param(
$ModulePath = 'C:\git\dbatools',
$Uri = 'C:\git\web\commands\index.html',
$Exclude = @('Where-DbaObject')
)
end {
0eNqV2L1u2zAYheFbCTjLAPVv6UY6FBnkmjWIMpQhyW2CwPdeOTlAh6LF+42WHlLD6+m8u1O6hesS8+bGd7fm6XrY5sNliefH71c3lqUv3Jsbh+FeuOm0zum2hcMDXmO+uHFbbqFw8ducVzd+3a+Ilzylx+E8vQQ3ujTl8/eYktvPx3wOjzvvz4XbYgqfR67zGrc4Z33x83t+53/f8A9clhZdVRZd1xbdNBbdthbddRbd9xZ9PFr0x58B6LK0tJSmMcVpTXGaU5z2FKdBxWlRcZpUnDYVp1GryhJVmkYVp1HFaVRxGlWcRhWnUcVpVHEaVZxGrWtLVGkaVZxGFadRxWlUcRpVnEYVp1HFaVRxGrVpLFGlaVRxGlWcRhWnUcVpVHEaVZxGFadRxWnUtrVElaZRxWlUcRpVnEYVp1HFaVRxGlWcRhWnUbvOElWaRhWnUcVpVHEaVZxGFadRxWlUcRpVnEbte0tUaRpVnEYVp1HFaVRxGlWcRhWnUcVpVHEa9Xi0RJWmUcVpVHEaVZxGFadRxWlUcRpVnEYVp1GHwRJVmkYVp1HFaVRxGlWcRhWnUcVpVHEaVZyPD962Pnjj/OCN+4M3DhDeuEB44wThjRuEN44Q3rhC/G9bei5c3MLL/uzPYFns708h7c++TOlHzJenOT/9mraw7K9+hmX9uLztqqEZhrbp68rX7f3+G7OWnks=