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
$ShowHex = { param ([array]$arr) ($arr | % { [System.Convert]::ToHexString($_) }) -join ' ' } | |
$path = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3' | |
$key = 'Settings' | |
$org = Get-ItemProperty $path | Select-Object -ExpandProperty $key | |
$ShowHex.Invoke((, $org)) | |
$new = @() + $org | |
$new[12] = 0x01 | |
$ShowHex.Invoke((, $new)) | |
Compare-Object $org $new |
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
$schema: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json | |
version: 2 | |
console_title_template: "{{ if .Root }}Admin: {{ end }} {{ .Folder }}" | |
final_space: true | |
blocks: | |
# First line left. | |
- type: prompt | |
newline: true | |
alignment: left |
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
(pip freeze | ConvertFrom-StringData).Keys | Set-Content requirements.txt |
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
#451722,#777777,#DED5C0,#451722,#6B3F31,#DED5C0,#006400,#006400 |
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
$psake = Get-Command -Name Invoke-psake -ErrorAction SilentlyContinue | |
if ($psake) { | |
Register-ArgumentCompleter -Native -CommandName $psake.Name -ScriptBlock { | |
param($wordToComplete, $commandAst, $cursorPosition) | |
Get-ChildItem "$wordToComplete*.ps1" | Select-Object -ExpandProperty Name | |
} | |
Register-ArgumentCompleter -CommandName $psake.Name -ParameterName taskList -ScriptBlock { | |
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) | |
if ($commandAst -match '(?<file>[^\.]*\.ps1)') { |
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
@{ | |
'nf-custom-c' = '' | |
'nf-custom-cpp' = '' | |
'nf-custom-electron' = '' | |
'nf-custom-elixir' = '' | |
'nf-custom-elm' = '' | |
'nf-custom-folder' = '' | |
'nf-custom-folder_config' = '' | |
'nf-custom-folder_git' = '' | |
'nf-custom-folder_git_branch' = '' |
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 = $true)] | |
[string] | |
$BucketName, | |
[Parameter()] | |
[string] | |
$Prefix, | |
[Parameter(Mandatory = $true)] | |
[ValidateRange("NonNegative")] |
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
# This idea was inspired by https://github.com/aws/aws-cli/issues/5309#issuecomment-693941619 | |
$awsCompleter = Get-Command -Name aws_completer -ErrorAction SilentlyContinue | |
if ($awsCompleter) { | |
# for PyPI installation. | |
if ($awsCompleter.Name -notlike '*.exe' ) { | |
$f = { python $awsCompleter.Source } | |
} | |
else { | |
$f = { & $awsCompleter.Name } | |
} |
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 ( | |
[string[]] | |
$ids | |
) | |
foreach ($id in $ids) { | |
$before = Get-R53ResourceRecordSet -HostedZoneId $id | Select-Object -ExpandProperty ResourceRecordSets | Where-object -FilterScript { $_.Type -eq 'A' -and $_.Region } | |
if (!$before) { | |
Write-Error "$id is not target hosted zone id." | |
exit 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
class ZabbixApi { | |
[string] $Ip | |
[string] $Port | |
[string] $Auth | |
static [PSCustomObject] Invoke($Body, $Ip, $Port) { | |
return Invoke-RestMethod -Method POST -Uri "http://$Ip`:$port/api_jsonrpc.php" -Headers @{'Content-Type' = 'application/json-rpc' } -Body $Body | |
} | |
static [string] GenerateBody($Method, $Params, $Auth) { |