Skip to content

Instantly share code, notes, and snippets.

@pitermarx
Last active May 2, 2022 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pitermarx/2a19f071c6b77184e7deb2abe4ecfc64 to your computer and use it in GitHub Desktop.
Save pitermarx/2a19f071c6b77184e7deb2abe4ecfc64 to your computer and use it in GitHub Desktop.
Powershell Profile
Import-Module 'C:\tools\poshgit\dahlbyk-posh-git-9bda399\src\posh-git.psd1'
$GitPromptSettings.EnablePromptStatus = $false
Set-PoshPrompt negligible
Import-Module -Name Terminal-Icons
Set-Alias vi 'C:\Program Files (x86)\vim\vim80\vim.exe'
Function prof { & vim.exe $profile; & $profile }
Function vimrc { vim.exe $home\_vimrc }
Function branchesNotOnRemote { git.exe branch -vv | ForEach-Object { $_.Trim() } | Where-Object { $_ -Match ": gone]" } }
Function deleteBranchesNotOnRemote { branchesNotOnRemote | ForEach-Object { git.exe branch -D $_.Split(' ')[0] } }
function retrySudo() { sudo ((Get-History -Count 1).CommandLine) }
Set-Alias dammit -v retrysudo
Import-Module PSReadline
# cls; docker build . -t test; docker run -p 8080:8080 test
function dockerCleanAll { docker ps -a; docker images -a; docker container prune -f; docker image prune -a -f }
function nugetClearCache { dotnet nuget locals all --clear; rm $devPath\packages -Recurse }
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
function getBranches($arg) {
return git branch --sort=committerdate --format "%(committerdate:short);%(authorname);%(refname:short)" -r $arg |
% {
$parts = $_.Split(";");
return @{ date = [datetime]::Parse($parts[0]); user = $parts[1]; branch = $parts[2] }
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment