if (Get-Module -ListAvailable -Name PSWindowsUpdate) { Import-Module -Name PSWindowsUpdate } else { Write-Host "PSWindowsUpdate module not found" -ForegroundColor Red } if (Get-Module -ListAvailable -Name gsudoModule) { Import-Module -Name gsudoModule } else { Write-Host "gsudoModule module not found" -ForegroundColor Red } if (Get-Module -ListAvailable -Name Terminal-Icons) { Import-Module -Name Terminal-Icons } else { Write-Host "Terminal-Icons module not found" -ForegroundColor Red } # aliases Set-Alias -Name reboot -Value Restart-Computer Set-Alias -Name shutdown -Value Stop-Computer Set-Alias -Name st -Value streamlink Set-Alias -Name v -Value nvim Set-Alias -Name cat -Value batcat function batcat($file) { bat $file --style=plain } function randomscript { $artDir = "$env:USERPROFILE\asciiart" if (Test-Path $artDir -ErrorAction SilentlyContinue) { $art = Get-ChildItem -Path $artDir | Get-Random Get-Content -Path $art | Write-Host -ForegroundColor DarkMagenta } } function Get-Weather($location) { # Invoke-RestMethod wttr.in/$location"?2FQ" Invoke-RestMethod (-join("wttr.in/", $location, "?2FQ")) } Set-Alias -Name weather -Value Get-Weather function hsconnect { netsh wlan connect name="Arc V2" } function wificonnect($profilename) { netsh wlan connect name=$profilename } function lsfunc($dir) { eza -la --group-directories-first --git --git-repos --icons $dir } Set-Alias -Name ls -Value lsfunc function Invoke-WinutilExtrnal { Start-Process pwsh.exe -Verb runas -ArgumentList "-c irm https://christitus.com/win | iex" } function Invoke-Winutil { Invoke-RestMethod "https://christitus.com/win" | Invoke-Expression } Set-Alias -Name winutil -Value Invoke-Winutil Set-Alias -Name winutilup -Value Invoke-WinutilExtrnal function emd { if (Get-Process -Name "emacs" -ErrorAction SilentlyContinue) { Write-Host "====================================" -ForegroundColor Red Write-Host "Emacs is already running" -ForegroundColor DarkMagenta Write-Host "====================================" -ForegroundColor Red return } emacs --daemon & } function nvims($appname, $file) { $env:NVIM_APPNAME = $appname if ($file) { nvim $file } else { nvim } Remove-Item -Force env:NVIM_APPNAME } function grep($pattern, $file) { if (-not (Test-Path $file)) { Write-Host "====================================" -ForegroundColor Red Write-Host "Error: $file does not exist" -ForegroundColor DarkMagenta Write-Host "====================================" -ForegroundColor Red return } if (Test-Path $file -PathType Container) { Write-Host "====================================" -ForegroundColor Red Write-Host "Error: $file is a directory" -ForegroundColor DarkMagenta Write-Host "====================================" -ForegroundColor Red return } Get-Content $file | Select-String $pattern } function unzip ($file) { Write-Output("Extracting", $file, "to", $pwd) $fullFile = Get-ChildItem -Path $pwd -Filter .\cove.zip | ForEach-Object { $_.FullName } Expand-Archive -Path $fullFile -DestinationPath $pwd } function frm($path) { Remove-Item $path -Force } function lnk($link, $target) { New-Item -Type SymbolicLink -Path $link -Target $target } Function Get-PubIP { (Invoke-WebRequest http://ifconfig.me/ip ).Content } function uptime { Get-WmiObject win32_operatingsystem | Select-Object csname, @{LABEL='LastBootUpTime'; EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)} } } function reload_profile { & $profile } function touch($file) { "" | Out-File $file -Encoding ASCII } function export($name, $value) { set-item -force -path "env:$name" -value $value; } function killall($name) { Get-Process $name -ErrorAction SilentlyContinue | Stop-Process } function pgrep($name) { Get-Process $name } function find-file($name) { Get-ChildItem -recurse -filter "*${name}*" -ErrorAction SilentlyContinue | ForEach-Object { $place_path = $_.directory Write-Output "${place_path}\${_}" } } function admin { if ($args.Count -gt 0) { $argList = "& '" + $args + "'" Start-Process "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.15.3465.0_x64__8wekyb3d8bbwe\wt.exe" -Verb runAs -ArgumentList $argList } else { Start-Process "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.15.3465.0_x64__8wekyb3d8bbwe\wt.exe" -Verb runAs } } #f45873b3-b655-43a6-b217-97c00aa0db58 PowerToys CommandNotFound module Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58 $ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" } $ENV:FZF_DEFAULT_OPTS=@" --color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 --color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc --color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 --color=selected-bg:#45475a --multi "@ if (Get-Command -Name fnm -ErrorAction SilentlyContinue) { Invoke-Expression (& { (fnm env --shell power-shell --use-on-cd | Out-String) }) } if (Get-Command -Name zoxide -ErrorAction SilentlyContinue) { Invoke-Expression (& { (zoxide init --cmd j powershell | Out-String) }) } if (Get-Command -Name starship -ErrorAction SilentlyContinue) { Invoke-Expression (&starship init powershell) } randomscript