Skip to content

Instantly share code, notes, and snippets.

View krymtkts's full-sized avatar
🤘

KURIYAMA Takatoshi krymtkts

🤘
View GitHub Profile
@krymtkts
krymtkts / taskbar-to-the-top-win11.ps1
Created January 10, 2022 08:00
Move the Taskbar to the Top in Windows 11.
$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
@krymtkts
krymtkts / .oh-my-posh.omp.yaml
Last active April 21, 2024 05:00
My own oh-my-posh v3 theme.
$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
(pip freeze | ConvertFrom-StringData).Keys | Set-Content requirements.txt
#451722,#777777,#DED5C0,#451722,#6B3F31,#DED5C0,#006400,#006400
$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)') {
@krymtkts
krymtkts / glyphs.ps1
Last active November 22, 2021 07:56
my Terminal-Icons glyphs.
@{
'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' = ''
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$BucketName,
[Parameter()]
[string]
$Prefix,
[Parameter(Mandatory = $true)]
[ValidateRange("NonNegative")]
# 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 }
}
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
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) {