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
@KevinMarquette
KevinMarquette / words.md
Created March 25, 2017 20:40 — forked from fogleman/words.md
Mnemonic Encoding Word List

Mnemonic Encoding Word List

http://web.archive.org/web/20090918202746/http://tothink.com/mnemonic/wordlist.html

  • The wordlist contains 1626 words.
  • All words are between 4 and 7 letters long.
  • No word in the list is a prefix of another word (e.g. visit, visitor).
  • Five letter prefixes of words are sufficient to be unique.
  • The words should be usable by people all over the world. The list is far from perfect in that respect. It is heavily biased towards western culture and English in particular. The international vocabulary is simply not big enough. One can argue that even words like "hotel" or "radio" are not truly international. You will find many English words in the list but I have tried to limit them to words that are part of a beginner's vocabulary or words that have close relatives in other european languages. In some cases a word has a different meaning in another language or is pronounced very differently but for the purpose of the encoding it is still ok - I assume that when the encoding is
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 {