- Originally adapteed from Scott Hanselman's excellent guide.
- Updated in 2021-08 for oh-my-posh v3.
- Uses a theme based on Paradox theme
- Short folder names, special icons for Registry, Home, etc
- Different prompt icon when running as admin
- Shows last exit code
- Timing info for long-running commands
- Git status
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
private static string[] ByteUnits = new string[] { "B", "KB", "MB", "GB", "TB" }; | |
/// <inheritdoc cref="BytesToString(decimal, byte)"/> | |
public static string BytesToString(this int? value, byte decimals = 2) => BytesToString((decimal)value, decimals); | |
/// <summary> | |
/// Display a byte value with units, rounded up to nearest possible size unit. | |
/// </summary> | |
/// <param name="value">Number of bytes</param> |
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
#!/bin/bash | |
# simple script to take stdin, timestamp it, and optionally append to a log file | |
# usage: command | timestamp-log /path/to/file.log | |
if [[ ! -z "$1" ]]; then | |
echo "Logging to $1" | |
exec > >(tee -ia $1) | |
exec 2> >(tee -ia $1) | |
fi |
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
$sampleTime = 2; # timespan to use for CPU% | |
$cmds = @{}; Get-CimInstance Win32_Process | %{ $cmds[$_.ProcessId.ToString()] = $_.CommandLine; }; | |
$cpu1 = @{}; Get-Process | %{ $cpu1[$_.Id.ToString()] = $_.CPU } | |
start-sleep -seconds $sampleTime | |
Get-Process | select ` | |
Id, ` | |
Name, ` | |
@{Name="CPU";Expression={ (($_.CPU-$cpu1[$_.Id.ToString()]) / $sampleTime / [System.Environment]::ProcessorCount / 100) }}, ` | |
WorkingSet64, ` | |
@{Name="CommandLine";Expression={$cmds[$_.Id.ToString()]}} ` |
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
# Windows Powershell script to bootstrap AWS CloudFormation:Init | |
# This can be used from a userdata script (in the <powershell> section) | |
# * Sets up cfn-hup to automatically run when changes are made to an assoicated LaunchConfiguration | |
# * Does initial invocation of cfn-init | |
$instanceId = (Invoke-WebRequest http://169.254.169.254/latest/meta-data/instance-id).Content | |
$region = (Invoke-WebRequest http://169.254.169.254/latest/meta-data/placement/availability-zone).Content -replace ".$" | |
$tags = (Get-EC2Instance -InstanceId $instanceId -Region $region).RunningInstance.Tags | |
$autoscalingGroupName = ($tags | Where-Object {$_.Key -eq "aws:autoscaling:groupName"}).Value | |
$stackId = ($tags | Where-Object {$_.Key -eq "aws:cloudformation:stack-id"}).Value | |
$launchConfigurationName = (Get-ASAutoScalingGroup -AutoScalingGroupName $autoscalingGroupName -Region $region).LaunchConfigurationName |
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
# better long-running ping command (timestamped output, but no stats) | |
function Ping2 | |
{ | |
param( | |
[Parameter(Mandatory=$true,Position=0)][string]$Target, | |
[int]$Timeout = 1000, | |
[int]$Interval = 1000, | |
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
{ | |
NLog.LogManager.Configuration = new NLog.Config.LoggingConfiguration(); | |
NLog.LogManager.Configuration.AddTarget("console", new NLog.Targets.ConsoleTarget()); | |
NLog.LogManager.Configuration.AddRule(NLog.LogLevel.Debug, NLog.LogLevel.Fatal, "console"); | |
NLog.LogManager.ReconfigExistingLoggers(); | |
} |
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
# Import posh-git (if installed via scoop) | |
$poshGitModule = "$HOME\scoop\apps\posh-git\current\posh-git.psd1"; | |
if (Test-Path $poshGitModule) { Import-Module $poshGitModule } | |
# msbuild convenience alias | |
Set-Alias MSBuild 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe' | |
# bash-style completion | |
Set-PSReadlineKeyHandler -Key Tab -Function Complete | |
#Set-PSReadlineOption -ShowToolTips |
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
{ | |
"homepage": "https://github.com/RolandPheasant/TailBlazer", | |
"version": "0.9.0.536", | |
"license": "GPL-3.0-only", | |
"url": "https://github.com/RolandPheasant/TailBlazer/releases/download/0.9.0.536/Tailblazer_v0.9.0.536.zip", | |
"hash": "53341485375b0a9ebd4085dbafa71c68af9a2044ff1bb65f3300be4b43f6c11c", | |
"bin": "TailBlazer.exe", | |
"shortcuts": [ | |
[ | |
"TailBlazer.exe", |