@@ -13,7 +13,8 @@ function prompt {
13
13
$curPath = ' ...' + $curPath.SubString ($curPath.Length - $maxPathLength + 3 )
14
14
}
15
15
16
- Write-Host " $time [$env: COMPUTERNAME ] $curPath " - NoNewline
16
+ # Write-Host "$time [$env:COMPUTERNAME] $curPath" -NoNewline
17
+ Write-Host " [$env: COMPUTERNAME ] $curPath " - NoNewline
17
18
Write-VcsStatus
18
19
$LASTEXITCODE = $origLastExitCode
19
20
" $ ( ' >' * ($nestedPromptLevel + 1 )) "
@@ -37,26 +38,10 @@ else {
37
38
Import-Module - Name posh- git
38
39
}
39
40
40
- # Chocolatey profile
41
- $ChocolateyProfile = " $env: ChocolateyInstall \helpers\chocolateyProfile.psm1"
42
- if (Test-Path ($ChocolateyProfile )) {
43
- Import-Module " $ChocolateyProfile "
44
- }
45
-
46
- <#
47
- function prompt {
48
- $time = (Get-DAte).ToShortTimeString()
49
- "$time [$env:COMPUTERNAME] $(Get-Location)> "
50
- }
51
-
52
- #>
53
-
54
- $global :GitPromptSettings.BeforeText = ' ['
55
- $global :GitPromptSettings.AfterText = ' ]'
41
+ # $global:GitPromptSettings.BeforeText = '['
42
+ # $global:GitPromptSettings.AfterText = ']'
56
43
$global :GitPromptSettings.DefaultPromptAbbreviateHomeDirectory = $true
57
44
58
- Set-PSReadLineOption - HistoryNoDuplicates - ShowToolTips
59
-
60
45
# derived from http://www.checkyourlogs.net/?p=38333
61
46
# if password is a passphrase (>=14 chars, return complexity = true)
62
47
# if password otherwise has 3 of the 4 criteria of MS AD complexity requirements, return true
@@ -380,6 +365,73 @@ function global:Format-WslArgument([string]$arg, [bool]$interactive) {
380
365
return $arg
381
366
}
382
367
368
+ function Get-Base64RegularExpression {
369
+
370
+ # # Get-Base64RegularExpression.ps1
371
+ # # Get a regular expression that can be used to search for content that has been
372
+ # # Base-64 encoded
373
+ param (
374
+ # # The value that we would like to search for in Base64 encoded content
375
+ [Parameter (Mandatory )]
376
+ $Value
377
+ )
378
+
379
+ # # Holds the various byte representations of what we're searching for
380
+ $byteRepresentations = @ ()
381
+
382
+ # # If we got a string, look for the Unicode and ASCII representations of the string
383
+ if ($Value -is [String ])
384
+ {
385
+ $byteRepresentations +=
386
+ [System.Text.Encoding ]::Unicode.GetBytes($Value ),
387
+ [System.Text.Encoding ]::ASCII.GetBytes($Value )
388
+ }
389
+
390
+ # # If it was a byte array directly, look for the byte representations
391
+ if ($Value -is [byte []])
392
+ {
393
+ $byteRepresentations += , $Value
394
+ }
395
+
396
+ # # Find the safe searchable sequences for each Base64 representation of input bytes
397
+ $base64sequences = foreach ($bytes in $byteRepresentations )
398
+ {
399
+ # # Offset 0. Sits on a 3-byte boundary so we can trust the leading characters.
400
+ $offset0 = [Convert ]::ToBase64String($bytes )
401
+
402
+ # # Offset 1. Has one byte from preceeding content, so we need to throw away the
403
+ # # first 2 leading characters
404
+ $offset1 = [Convert ]::ToBase64String( (New-Object ' Byte[]' 1 ) + $bytes ).Substring(2 )
405
+
406
+ # # Offset 2. Has two bytes from preceeding content, so we need to throw away the
407
+ # # first 4 leading characters
408
+ $offset2 = [Convert ]::ToBase64String( (New-Object ' Byte[]' 2 ) + $bytes ).Substring(4 )
409
+
410
+ # # If there is any terminating padding, we must remove the characters mixed with that padding. That
411
+ # # ends up being the number of equals signs, plus one.
412
+ $base64matches = $offset0 , $offset1 , $offset2 | % {
413
+ if ($_ -match ' (=+)$' )
414
+ {
415
+ $_.Substring (0 , $_.Length - ($matches [0 ].Length + 1 ))
416
+ }
417
+ else
418
+ {
419
+ $_
420
+ }
421
+ }
422
+
423
+ $base64matches | ? { $_ }
424
+ }
425
+
426
+ # # Output a regular expression for these sequences
427
+ " (" + (($base64sequences | Sort-Object - Unique) -join " |" ) + " )"
428
+
429
+ }
430
+
383
431
Import-WslCommand ' awk' , ' grep' , ' head' , ' jq' , ' less' , ' man' , ' sed' , ' seq' , ' tail' , ' vim'
384
432
433
+ import-module oh- my- posh
434
+ import-module terminal- icons
435
+ Set-PoshPrompt - Theme ~/ Documents/ WindowsPowerShell/ mdavis.omp.json
436
+
385
437
Set-Location c:\
0 commit comments