Last active
February 7, 2025 00:33
-
-
Save dorlugasigal/491cb79eb5e02a011c5ee22a0e334fc2 to your computer and use it in GitHub Desktop.
my PowerShell $PROFILE imports
This file contains hidden or 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
| #### user interface #### | |
| Import-Module Terminal-Icons | |
| oh-my-posh --init --shell pwsh --config 'C:\Users\dorlugasigal\OhMyPoshThemes\dlg.omp.json' | Invoke-Expression | |
| #### common aliases #### | |
| Set-Alias g git | |
| Set-Alias vim nvim | |
| Set-Alias vi nvim | |
| Set-Alias ll ls | |
| Set-Alias grep findstr | |
| ### kubectl commands ### | |
| Set-Alias k kubectl | |
| Set-Alias -Name kgp -Value GetPods | |
| Set-Alias -Name kgpw -Value GetPodsWide | |
| Set-Alias -Name kgall -Value GetAll | |
| Set-Alias -Name kgn -Value GetNodes | |
| Set-Alias -Name kgs -Value GetServices | |
| Set-Alias -Name kdp -Value DescribePod | |
| Set-Alias -Name klp -Value GetLogs | |
| Set-Alias -Name kaf -Value ApplyYaml | |
| Set-Alias -Name kexec -Value ExecContainerShell | |
| #### auto complete && suggestions ##### | |
| ## fuck | |
| $env:PYTHONIOENCODING="utf-8" | |
| iex "$(thefuck --alias)" | |
| Import-Module PSReadLine | |
| Enable-PowerType | |
| Set-PSReadLineOption -PredictionSource HistoryAndPlugin | |
| Set-PSReadLineOption -PredictionViewStyle ListView | |
| Set-PSReadLineOption -EditMode Windows | |
| ###### searching ####### | |
| Import-Module PSFzf | |
| Set-PsFzfOption -PSReadLineChordProvider 'Ctrl+f' -PSReadLineChordReverseHistory 'Ctrl+r' | |
| ### dotnet shortcuts ### | |
| Set-PSReadLineKeyHandler -Key Ctrl+Shift+b ` | |
| -BriefDescription BuildCurrentDirectory ` | |
| -LongDescription "Build the current directory" ` | |
| -ScriptBlock { | |
| [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() | |
| [Microsoft.PowerShell.PSConsoleReadLine]::Insert("dotnet build") | |
| [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() | |
| } | |
| Set-PSReadLineKeyHandler -Key Ctrl+Shift+t ` | |
| -BriefDescription BuildCurrentDirectory ` | |
| -LongDescription "Build the current directory" ` | |
| -ScriptBlock { | |
| [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() | |
| [Microsoft.PowerShell.PSConsoleReadLine]::Insert("dotnet test") | |
| [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() | |
| } | |
| Set-PSReadLineKeyHandler -Key Ctrl+Shift+r ` | |
| -BriefDescription BuildCurrentDirectory ` | |
| -LongDescription "Restore nuget packages of the current directory" ` | |
| -ScriptBlock { | |
| [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() | |
| [Microsoft.PowerShell.PSConsoleReadLine]::Insert("dotnet restore") | |
| [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() | |
| } | |
| ### functions definitions ### | |
| function GetPods([string]$namespace="default") | |
| { | |
| kubectl get pods -n $namespace | |
| } | |
| function GetPodsWide([string]$namespace="default") | |
| { | |
| kubectl get pods -n $namespace -o wide | |
| } | |
| function GetAll([string]$namespace="default") | |
| { | |
| kubectl get all -n $namespace | |
| } | |
| function GetNodes() | |
| { | |
| kubectl get nodes -o wide | |
| } | |
| function DescribePod([string]$container, [string]$namespace="default") | |
| { | |
| kubectl describe po $container -n $namespace | |
| } | |
| function GetLogs([string]$container, [string]$namespace="default") | |
| { | |
| kubectl logs pod/$container -n $namespace | |
| } | |
| function ApplyYaml([string]$filename) | |
| { | |
| kubectl apply -f $filename | |
| } | |
| function ExecContainerShell([string]$container, [string]$namespace="default") | |
| { | |
| kubectl exec -it $container -n $namespace — sh | |
| } | |
| function GetServices([string]$namespace="default") | |
| { | |
| kubectl get services -n $namespace | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment