Skip to content

Instantly share code, notes, and snippets.

$wingetCompleter = {
param($wordToComplete, $commandAst, $cursorPosition)
$tokens = $commandAst.Extent.Text.Trim() -split '\s+'
$completions = switch ($tokens[1]) {
'install' { "-q","-m","-v","-s","-e","-i","-h","-o","-l",
"--query","--manifest","--id","--name","--moniker","--version","--source","--exact","--interactive",
"--silent","--log","--override","--location","--help"; break }
'search' { "-q","-s","-n","-e","-?",
"--query","--id","--name","--moniker","--tag","--command","--source","--count","--exact","--help"
@rkeithhill
rkeithhill / settings.json
Last active November 21, 2020 22:39
Windows Terminal home profile
// This file was initially generated by Windows Terminal 0.11.1121.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@rkeithhill
rkeithhill / dir_colors.txt
Last active October 25, 2018 02:15
dir_colors.txt
DIR 34
LINK 33
*.exe 38;2;0;192;0 # Bold executables
*.ps1 92 # PowerShell scripts
*.psm1 92 # PowerShell module scripts
@rkeithhill
rkeithhill / posh-git_config.ps1
Last active February 26, 2023 19:27
Config file for posh-git.
# Import Posh-Git and configure Git prompt
Import-Module posh-git
#Import-Module ~\GitHub\dahlbyk\posh-git\src\posh-git.psd1
#Import-Module ~\GitHub\dahlbyk\posh-git\out\posh-git\1.0.0\posh-git.psd1
# Windows PowerShell doesn't parse `e or `u escape sequences in DQ strings. I added that support to the PS parser in 6.0
if ($PSVersionTable.PSVersion.Major -lt 6) {
$global:GitPromptSettings.WindowTitle = {
param($GitStatus, [bool]$IsAdmin)
@rkeithhill
rkeithhill / VSCode-settings.json
Last active January 14, 2021 12:46
My Visual Studio Code user settings
// Place your settings in this file to overwrite the default settings
{
"debug.toolBarLocation": "docked",
"diffEditor.ignoreTrimWhitespace": true,
"editor.codeLens": true,
"editor.detectIndentation": false,
"editor.dragAndDrop": false,
"editor.renderWhitespace": "none",
@rkeithhill
rkeithhill / VSCode-keybindings.json
Last active April 30, 2020 18:43
My Visual Studio Code customized keyboard shorcuts
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "alt+n", "command": "explorer.newFile" },
{ "key": "alt+shift+s", "command": "PowerShell.InvokeRegisteredEditorCommand",
"args": { "commandName": "ConvertToSplatExpression" },
"when": "editorLangId == 'powershell'" },
{ "key": "ctrl+shift+q", "command": "workbench.action.toggleMaximizedPanel" },
{ "key": "ctrl+shift+s", "command": "workbench.action.files.saveAll" },
{ "key": "ctrl+shift+t", "command": "workbench.action.tasks.test" },
{ "key": "ctrl+alt+t", "command": "workbench.action.tasks.runTask" },
@rkeithhill
rkeithhill / gitconfig.txt
Last active November 29, 2019 18:35
Config file for Git
# More gitconfig goodness here - https://gist.github.com/tdd/470582
git config --global user.name "Keith Hill"
git config --global user.email <email here>
git config --global core.editor '\"C:\Program Files (x86)\Microsoft VS Code\bin\code.cmd\" --new-window --wait'
git config --global core.autocrlf true
git config --global pull.ff only
git config --global pull.rebase true
git config --global rebase.autoStash true
if (($PSVersionTable.PSVersion.Major -le 5) -or $IsWindows) {
Set-Alias nano 'C:\Program Files\Git\usr\bin\nano.exe'
Set-Alias vim 'C:\Program Files\Git\usr\bin\vim.exe'
}
# Edition/platform specific configuration
if ($IsWindows) {
$env:PAGER = 'less -Ps"Page %db?B of %D:.\. Press h for help or Q to quit\."'
if ($PSVersionTable.PSEdition -eq 'Desktop') {
$PSDefaultParameterValues['Get-Help:Full'] = $true
@rkeithhill
rkeithhill / ConfigureConsoleSettings.ps1
Last active January 25, 2021 22:40
Configures the PowerShell console settings (colors, fonts, buffer size, etc).
<#
.SYNOPSIS
Sets the console settings to the specified values and color theme.
.DESCRIPTION
Sets the console settings to the specified values and color theme.
.EXAMPLE
C:\PS> Configure-ConsoleSettings -Theme ConEmu -WindowSize 120,50 `
-FontFace Consolas -FontSize 12
Sets the colors to those used in ConEmu and sets the font and window size.
@rkeithhill
rkeithhill / Optimize-PSReadlineHistory.ps1
Last active April 19, 2024 20:00
Removes duplicate and optionally short commands from your PSReadline history file
<#
.SYNOPSIS
Optimizes your PSReadline history save file.
.DESCRIPTION
Optimizes your PSReadline history save file by removing duplicate
entries and optionally removing commands that are not longer than
a minimum length
.EXAMPLE
C:\PS> Optimize-PSReadlineHistory
Removes all the duplicate commands.