Skip to content

Instantly share code, notes, and snippets.

@mrjamiebowman
Last active April 6, 2024 00:24
Show Gist options
  • Save mrjamiebowman/7796cdabf84938965d3f63854557c4a1 to your computer and use it in GitHub Desktop.
Save mrjamiebowman/7796cdabf84938965d3f63854557c4a1 to your computer and use it in GitHub Desktop.
# oh my posh
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\clean-detailed.omp.json" | Invoke-Expression
# vim aliases
New-Alias -Name vi -Value 'C:\Program Files\Vim\vim90\vim.exe'
New-Alias -Name vim -Value 'C:\Program Files\vim\vim90\vim.exe'
New-Alias -Name omp -Value oh-my-posh
New-Alias -Name notepad++ -Value 'C:\Program Files\Notepad++\notepad++.exe'
New-Alias -Name gt -Value 'git log --graph --abbrev-commit --decorate --oneline --all'
$env:KUBE_EDITOR="code -w"
# git aliases
function Get-LogGraph{ & git log --graph --abbrev-commit --decorate --oneline --all }
New-Alias -Name gt -Value Get-LogGraph -Force -Option AllScope
# aliases
New-Alias -Name admin -Value Do-Admin
New-Alias -Name cs -Value Do-ClearScreenGitStatus
New-Alias -Name sync-bin -Value Do-SyncBinFolder
# aliases: kubernetes
New-Alias -Name k -Value kubectl
New-Alias -Name kx -Value kubectx
New-Alias -Name kns -Value kubens
# aliases: istio
New-Alias -Name istio -Value istioctl
New-Alias -Name i -Value istioctl
# ssh
#Start-Service ssh-agent
# alias functions
function Do-ClearScreenGitStatus {
clear;
git status;
}
function Do-Admin {
clear;
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
}
function Do-SyncBinFolder {
clear;
# create bin directory (c:\bin2\)
New-Item -ItemType Directory -Force -Path C:\bin
cd C:\bin2\
# add c:\bin to path environment variable
# download: ccloud
# download: dapr
# download: kind
curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.9.0/kind-windows-amd64
Move-Item .\kind-windows-amd64.exe c:\bin\kind.exe
# downlaod: kubectx
# download: kubens
# download: isitio
# download: linkerd
}
# Import the Chocolatey Profile that contains the necessary code to enable
# tab-completions to function for `choco`.
# Be aware that if you are missing these lines from your profile, tab completion
# for `choco` will not function.
# See https://ch0.co/tab-completion for details.
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# nuke build
Register-ArgumentCompleter -Native -CommandName nuke -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
nuke :complete "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
cd w:\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment