Created
May 2, 2023 08:27
-
-
Save SQLDBAWithABeard/b8e34072c6ed77415ec9c58ea3359820 to your computer and use it in GitHub Desktop.
Random OhMyPosh prompt :-)
This file contains 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
function Load-Profile { | |
$env:POSH_THEMES_PATH = '{0}\Programs\oh-my-posh\themes' -f $env:LOCALAPPDATA | |
function global:Set-PoshPrompt { | |
param( | |
$theme | |
) | |
& oh-my-posh.exe init pwsh --config "$env:POSH_THEMES_PATH\$theme.omp.json" | Invoke-Expression | |
} | |
# Create scriptblock that collects information and name it | |
Register-PSFTeppScriptblock -Name "poshthemes" -ScriptBlock { Get-ChildItem $env:POSH_THEMES_PATH | Select-Object -ExpandProperty Name -Unique | ForEach-Object { $_ -replace '\.omp\.json$', '' } } | |
#Assign scriptblock to function | |
Register-PSFTeppArgumentCompleter -Command Set-PoshPrompt -Parameter theme -Name poshthemes | |
$themes = @( | |
'neko', | |
'sonicboom_dark', | |
'neko', | |
'easy-term', | |
'if_tea', | |
'neko', | |
'kushal' | |
'nigfht-owl', | |
'neko', | |
'powerlevel10k_rainbow', | |
'quick-term', | |
'neko', | |
'stelbent.minimal', | |
'tokyo', | |
'neko', | |
'unicorn', | |
'wholespace', | |
'sonicboom_dark', | |
'lambdageneration' | |
) | |
$global:__currentTheme = (Get-Random -InputObject $themes) | |
function global:Get-CurrentPoshTheme {$__currentTheme} | |
Set-PoshPrompt -Theme $__currentTheme | |
if ($psstyle) { | |
$psstyle.FileInfo.Directory = $psstyle.FileInfo.Executable = $psstyle.FileInfo.SymbolicLink = "" | |
$PSStyle.FileInfo.Extension.Clear() | |
$PSStyle.Formatting.TableHeader = "" | |
$PsStyle.Formatting.FormatAccent = "" | |
} | |
} | |
"Load-Profile for full profile" | |
function prompt { | |
#Load-Profile | |
"PS > " | |
} | |
switch ($ENV:COMPUTERNAME) { | |
'BEARD-DESKTOP' { | |
$GitRoot = 'G:\OneDrive\Documents\GitHub' | |
} | |
Default { | |
$GitRoot = 'C:\Users\mrrob\OneDrive\Documents\GitHub' | |
} | |
} | |
if (-not (Get-PSDrive -Name Git -ErrorAction SilentlyContinue)) { | |
$Error.Clear() | |
$null = New-PSDrive -Name Git -PSProvider FileSystem -Root $GitRoot | |
} | |
if (-not (Get-PSDrive -Name Presentations -ErrorAction SilentlyContinue)) { | |
$Error.Clear() | |
$Path = "$GitRoot\Presentations" | |
$null = New-PSDrive -Name Presentations -PSProvider FileSystem -Root $Path | |
} | |
if (-not (Get-PSDrive -Name dockercompose -ErrorAction SilentlyContinue)) { | |
$Error.Clear() | |
$Path = "$GitRoot\DockerStuff" | |
$null = New-PSDrive -Name dockercompose -PSProvider FileSystem -Root $Path | |
} | |
function Start-BeardSQL { | |
#region Run as Admin Code | |
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) | |
if ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
Write-Verbose "Process is running as Admin" | |
Start-Service SQLSERVERAGENT | |
Start-Service MSSQLSERVER | |
} else { | |
$MyInvocation.MyCommand.Definition | |
Start-Process powershell.exe "-Command", ('"{0}"' -f "Start-Service SQLSERVERAGENT;Start-Service MSSQLSERVER") -Verb RunAs | |
} | |
} | |
function whatsmyip { | |
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[switch] | |
$clip | |
) | |
if ($clip) { | |
(Invoke-WebRequest -Uri "http://ifconfig.me/ip").Content | Set-Clipboard | |
} else { | |
(Invoke-WebRequest -Uri "http://ifconfig.me/ip").Content | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment