This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test script for interactive console window. | |
# currently cannot prevent mouse scrolling. | |
function Test-ConsoleWindowWithoutBufferCleaning { | |
# backup cursor x position. | |
$x = [Console]::CursorLeft | |
# add lines to the end of the screen for scrolling using the PSReadLine method. | |
# https://github.com/PowerShell/PSReadLine/blob/e57f7d691d8df8c1121fddf47084f96aea74a688/PSReadLine/DisplayBlockBase.cs#L17-L24 | |
$h = [Console]::WindowHeight | |
0..($h - 1) | ForEach-Object { [Console]::Write("`n") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[Parameter(Mandatory, | |
Position = 0, | |
ValueFromPipeline, | |
ValueFromPipelineByPropertyName)] | |
[string] | |
$WorkGroup, | |
[Parameter(Mandatory, | |
Position = 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Download Google Sheet as CSV. | |
.DESCRIPTION | |
Download Google Sheet as CSV using GCP OAuth Client. | |
.PARAMETER OAuthClientSecretsPath | |
The path to the JSON file for the OAuth 2.0 Client Secrets created on GCP. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-IAMUsers | ForEach-Object { | |
do { | |
$j = Request-IAMServiceLastAccessedDetail -Arn $_.Arn | |
Start-Sleep -Seconds 1 | |
$r = Get-IAMServiceLastAccessedDetail -JobId $j | |
} until ( | |
$r.JobStatus.Value -eq 'COMPLETED' | |
) | |
$d = $r.ServicesLastAccessed | Sort-Object -Descending -Property LastAuthenticated | Select-Object -First 1 | |
[PSCustomObject]@{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory)] | |
[ValidateNotNullOrEmpty()] | |
[string[]] | |
$VolumeIds, | |
[Parameter(Mandatory)] | |
[ValidateNotNullOrEmpty()] | |
[ValidateSet('IOPS', 'Throughput')] | |
[string] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Start-VBoxMachine() { | |
vboxmanage list vms | Select-Pocof -CaseSensitive | Out-String -Stream | Select-String -Pattern '\{(.+)\}' | ForEach-Object { vboxmanage startvm ($_.Matches[0].Groups['1'].Value) --type headless } | |
} | |
function Stop-VBoxMachine() { | |
vboxmanage list runningvms | Select-Pocof -CaseSensitive | Out-String -Stream | Select-String -Pattern '\{(.+)\}' | ForEach-Object { vboxmanage controlvm ($_.Matches[0].Groups['1'].Value) poweroff } | |
} | |
function Get-RunningVBoxMachines() { | |
vboxmanage list runningvms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AWS.Tools.* modules must be imported first to get all property information. | |
Get-Module -Name *AWS* | Import-Module | |
Get-Command *Tag* | Where-Object -Property Source -Like '*aws*' | ForEach-Object { | |
[pscustomobject]@{ | |
Name = $_.Name | |
TagParameterType = $_.Parameters.Values | Where-Object -Property Name -Like '*tag*' | Select-Object -ExpandProperty ParameterType | |
} | |
} | Where-Object -Property TagParameterType -NE $Null | Group-Object TagParameterType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$timeline = Invoke-RestMethod -Method Get https://instancetyp.es/timeline.json | |
$releases = $timeline.instances | ForEach-Object { | |
[pscustomobject]@{ | |
instanceType = ($_.instance_type -split '\.')[0] | |
releaseYear = $_.release_year | |
} | |
} | Group-Object -Property instanceType | ForEach-Object { | |
$_.Group[0] | |
} | Group-Object -Property releaseYear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | |
return new (P || (P = Promise))(function (resolve, reject) { | |
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | |
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | |
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | |
step((generator = generator.apply(thisArg, _arguments || [])).next()); | |
}); | |
}; | |
Object.defineProperty(exports, "__esModule", { value: true }); |
NewerOlder