Skip to content

Instantly share code, notes, and snippets.

@monaboiste
Last active February 11, 2021 20:18
Show Gist options
  • Save monaboiste/a112ae30e67c76b935c606a99f5cb7d4 to your computer and use it in GitHub Desktop.
Save monaboiste/a112ae30e67c76b935c606a99f5cb7d4 to your computer and use it in GitHub Desktop.
Powershell profile
$msvcBinPath = Resolve-Path -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\*\bin\Hostx86\x86\"
$msvcIncludePath = Resolve-Path -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\*\include\"
$mvnPath = Resolve-Path -Path "C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition *\plugins\maven\lib\maven3\bin"
$Env:Path = "$Env:PATH;
S:\Programs\Scoop\shims\;
S:\Programs\Microsoft VS Code\bin\;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\;
$msvcBinPath;
$msvcIncludePath;
$mvnPath"
<#
# shims:
# scoop, git, subl,
#>
function chd {
Set-Location "$Env:STORE_USER"
}
function cwd {
Set-Location "S:\Dev"
}
function U([int]$code) {
if ((0 -le $code) -and ($code -le 0xFFFF)) {
return [char] $code
}
if ((0x10000 -le $code) -and ($code -le 0x10FFFF)) {
return [char]::ConvertFromUtf32($code)
}
throw "Invalid character code $code"
}
function Git-Log { & git log --graph --abbrev-commit --decorate --format=format:'%C(brightyellow)%h%C(reset) - %C(green)(%ar)%C(reset) %C(white)%s%C(reset) %C(red)- %an%C(reset)%C(yellow)%d%C(reset)' $args }
# Modules and Theme
Import-Module Get-ChildItemColor
Import-Module posh-git
Import-Module Recycle
Set-Alias -Name la -Value Get-ChildItemColor -Option AllScope -Force
Set-Alias -Name ls -Value Get-ChildItemColorFormatWide -Option AllScope
Set-Alias -Name del -Value Remove-ItemSafely -Option AllScope
Set-Alias -Name ipcalc -Value $Env:STORE_USER\Documents\WindowsPowerShell\Scripts\ipcalc.ps1 -Option AllScope
Set-Alias -Name gl -Value Git-Log -Option AllScope -Force
Set-Theme "$Env:STORE_USER\Documents\Assets\PinkBlueProfile.psm1"
# Set/unset env var
# [System.Environment]::SetEnvironmentVariable("DOCKER_HOST", "tcp://docker.artofshell.com:2376", [System.EnvironmentVariableTarget]::User)
# [System.Environment]::SetEnvironmentVariable("DOCKER_HOST", $null, [System.EnvironmentVariableTarget]::User)
# Popup suggestions
# Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
<# Old prompt
# $computerName = $Env:COMPUTERNAME.ToLower()
# function Prompt {
# # Escape character
# $esc = $([char]27)
# # Window title
# $Host.UI.RawUI.WindowTitle = (Get-Location).ToString()
# # Set prompt
# $currentTime = Get-Date -UFormat "%H:%M:%S"
# Write-Host "[" -NoNewline
# Write-Host "$currentTime" -NoNewline
# Write-Host "] " -NoNewline
# Write-Host "$esc[38;2;183;42;42m$Env:USERNAME" -NoNewline
# Write-Host ":" -NoNewline
# Write-Host "$esc[38;2;3;130;136mpwsh@$computerName" -NoNewline
# return "> "
# }
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment