diff --git a/ps1-profile/Microsoft.PowerShell_profile.ps1 b/ps1-profile/Microsoft.PowerShell_profile.ps1 new file mode 100644 index 0000000..312b8a9 --- /dev/null +++ b/ps1-profile/Microsoft.PowerShell_profile.ps1 @@ -0,0 +1,124 @@ + +oh-my-posh init pwsh | Invoke-Expression + +Import-Module -Name Microsoft.WinGet.CommandNotFound +$env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe" +$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = "" # Update with latest signing password +function gs { & git status @args } +function ga { & git add @args } +function gr { & git remote @args } +function gf { & git fetch @args } +function dev { & pnpm dev:app } +function phok { + Set-Location -LiteralPath "E:\JezzWTF\apps\image-gallery" # Update to wherever Phokus lives on each machine + + if ($args.Count -gt 0) { + $command = $args[0] + $commandArgs = @($args | Select-Object -Skip 1) + + & $command @commandArgs + } +} + +# Unix like touch +function touch { + param([string]$Path) + if (Test-Path $Path) { + (Get-Item $Path).LastWriteTime = Get-Date + } else { + New-Item -ItemType File -Path $Path | Out-Null + } +} + +# Weather +function weather { + param([string]$City = "") + curl "wttr.in/$City" +} + +# Move up the dir (specify how many folders you want to go up) e.g up 3 +function up { + param([int]$Levels = 1) + + for ($i = 0; $i -lt $Levels; $i++) { + Set-Location .. + } +} + +# Make folder and enter it +function mkcd { + param([string]$Path) + New-Item -ItemType Directory -Force -Path $Path | Out-Null + Set-Location $Path +} + +# big files +function big { + param([int]$Count = 20) + + Get-ChildItem -File -Recurse | + Sort-Object Length -Descending | + Select-Object -First $Count @{Name="MB";Expression={[math]::Round($_.Length / 1MB, 2)}}, FullName +} + +# Command history +function hist { + param([string]$Pattern = "") + + if ($Pattern) { + Get-History | Where-Object CommandLine -like "*$Pattern*" + } else { + Get-History + } +} + +# Open explorer at current location +function here { + explorer . +} + +# Clear +function c { + Clear-Host +} + +# Run the last matching command + +function again { + param([string]$Pattern) + + $cmd = Get-History | + Where-Object { + $_.CommandLine -like "*$Pattern*" -and + $_.CommandLine -notlike "again *" + } | + Select-Object -Last 1 + + if (-not $cmd) { + Write-Host "No matching command found." + return + } + + Write-Host "> $($cmd.CommandLine)" + Invoke-Expression $cmd.CommandLine +} +# See listening ports +function ports { + Get-NetTCPConnection -State Listen | + Select-Object LocalAddress, LocalPort, OwningProcess | + Sort-Object LocalPort +} + +# Kill Server via Port +function killport { + param([int]$Port) + + Get-NetTCPConnection -LocalPort $Port -ErrorAction SilentlyContinue | + Select-Object -ExpandProperty OwningProcess -Unique | + ForEach-Object { Stop-Process -Id $_ -Force } +} + +# Copy current dir +function cliphere { + (Get-Location).Path | Set-Clipboard +} \ No newline at end of file