Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Cambridgeport90/d7026958abc4d3f88c338232526541ae to your computer and use it in GitHub Desktop.
Save Cambridgeport90/d7026958abc4d3f88c338232526541ae to your computer and use it in GitHub Desktop.
Powershell Profile
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space":true,
"osc99":true,
"console_title":true,
"console_title_style":"template",
"console_title_template":"{{.Folder}}{{if .Root}} :: root{{end}} :: {{.Shell}}",
"tooltips": [
{
"type": "dotnet",
"tips": ["dotnet", "dv"],
"style": "diamond",
"foreground": "black",
"background": "blue",
"leading_diamond": "",
"trailing_diamond": ""
}
],
"blocks":[
{
"type":"prompt",
"alignment":"left",
"horizontal_offset":0,
"vertical_offset":1,
"segments":[
{
"type": "root",
"style": "plain",
"foreground": "yellow",
"properties": {
"root_icon": ""
}
},
{
"type":"path",
"style":"diamond",
"powerline_symbol":"",
"invert_powerline":false,
"foreground":"transparent",
"foreground_templates":null,
"background":"green",
"background_templates":null,
"leading_diamond":"",
"trailing_diamond":"",
"properties":{
"style":"mixed",
"home_icon": ""
}
},
{
"type": "poshgit",
"style": "plain",
"foreground": "green",
"background": "black"
}
]
}
]
}
function Run-Step([string] $Description, [ScriptBlock]$script)
{
Write-Host -NoNewline "Loading " $Description.PadRight(20)
& $script
Write-Host "`u{2705}" # checkmark emoji
}
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$stopwatch = [system.diagnostics.stopwatch]::StartNew()
#hides the cursor
Write-Host "`e[?25l" -NoNewline
Write-Host "Loading PowerShell $($PSVersionTable.PSVersion)..." -ForegroundColor 3
Write-Host
# this takes a sec, but we can also do it concurrently with the rest of the profile loading
$vsshell = Start-ThreadJob {
Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
$Env:VSCMD_SKIP_SENDTELEMETRY = 1
Enter-VsDevShell d0d15d66 -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64" | Out-Null
}
# Chocolatey profile
Run-Step "Chocolatey" {
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
Import-Module "$ChocolateyProfile"
}
# posh-git
Run-Step "Posh-Git" {
Import-Module posh-git
$env:POSH_GIT_ENABLED = $true
}
# oh-my-posh
Run-Step "oh-my-posh" {
Import-Module oh-my-posh
set-poshprompt C:\Users\phils\hotstick.omp.json
$DefaultUser = 'phils'
Enable-Poshtooltips
}
# Chocolatey profile
Run-Step "ZLocation" {
Import-Module ZLocation
}
# we already started this task earlier, just gotta receive it now
Run-Step "VS2022 Shell" {
Receive-Job $vsshell -Wait -AutoRemoveJob
}
# show the cursor and complete the progress
Write-Host "`e[?25h" -NoNewline
$updateCheckedPath = "$($env:LOCALAPPDATA)\update-checked.txt"
$timespan = new-timespan -days 7
if (((Test-Path $updateCheckedPath) -eq $false) -or ((get-date) - (Get-Item $updateCheckedPath).LastWriteTime -gt $timespan))
{
Write-Host
Write-Host "Been a minute since running global update checks. Doing that now."
Write-Host
Write-Host "Running npm -g outdated"
npm -g outdated
Write-Host
Write-Host "Running choco outdated"
choco outdated
Write-Host
Write-Host "Running dotnet-tools-outdated"
dotnet-tools-outdated
get-date | Out-File -FilePath $updateCheckedPath
}
update-help
Write-Host "`nProfile loaded in " $stopwatch.Elapsed.TotalMilliseconds "ms"
// Based on original retro pixel shader
// https://github.com/microsoft/terminal/blob/main/samples/PixelShaders/Retro.hlsl
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
#define SCANLINE_FACTOR 0.3
#define SCALED_SCANLINE_PERIOD Scale
float SquareWave(float y)
{
return 1 - (floor(y / SCALED_SCANLINE_PERIOD) % 2) * SCANLINE_FACTOR;
}
float4 Scanline(float4 color, float4 pos)
{
float wave = SquareWave(pos.y);
return color * wave;
}
float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET
{
Texture2D input = shaderTexture;
float4 color = input.Sample(samplerState, tex);
color = Scanline(color, pos);
// brighten this up a bit
color.xyz *= 1.2;
return color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment