Added updated profile with misc functions
This commit is contained in:
		@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					# Set the Window Title of Windows Terminal to The filepath of current directory
 | 
				
			||||||
$host.ui.rawui.windowtitle="$(Get-Item .) - Windows Terminal"
 | 
					$host.ui.rawui.windowtitle="$(Get-Item .) - Windows Terminal"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# powershell.exe -NoExit -command "& {Set-Location $env:systemroot}"
 | 
					# powershell.exe -NoExit -command "& {Set-Location $env:systemroot}"
 | 
				
			||||||
@@ -25,6 +26,12 @@ function gsi{git submodule init}
 | 
				
			|||||||
function gsu{git submodule update --recursive --remote}
 | 
					function gsu{git submodule update --recursive --remote}
 | 
				
			||||||
# function gsu{git submodule update --recursive --remote}
 | 
					# function gsu{git submodule update --recursive --remote}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Open up files with specific program
 | 
				
			||||||
 | 
					function subl{Start-Process 'C:\Program Files\Sublime Text\sublime_text.exe' @args}
 | 
				
			||||||
 | 
					function gimp{Start-Process 'C:\Program Files\GIMP 2\bin\gimp-2.10.exe' @args}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Useful shortcuts for traversing directories
 | 
					# Useful shortcuts for traversing directories
 | 
				
			||||||
function cd..  { Set-Location ..\.. }
 | 
					function cd..  { Set-Location ..\.. }
 | 
				
			||||||
function cd... { Set-Location ..\..\.. }
 | 
					function cd... { Set-Location ..\..\.. }
 | 
				
			||||||
@@ -35,6 +42,9 @@ function ll { Get-ChildItem -Path $pwd -File }
 | 
				
			|||||||
# get ip address
 | 
					# get ip address
 | 
				
			||||||
function ipa { Get-NetIPAddress | Where-Object {$_.AddressState -eq "Preferred" -and $_.ValidLifetime -lt "24:00:00"}}
 | 
					function ipa { Get-NetIPAddress | Where-Object {$_.AddressState -eq "Preferred" -and $_.ValidLifetime -lt "24:00:00"}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Chocolatey
 | 
				
			||||||
 | 
					#------------------------------------------------
 | 
				
			||||||
# Import the Chocolatey Profile that contains the necessary code to enable
 | 
					# Import the Chocolatey Profile that contains the necessary code to enable
 | 
				
			||||||
# tab-completions to function for `choco`.
 | 
					# tab-completions to function for `choco`.
 | 
				
			||||||
# Be aware that if you are missing these lines from your profile, tab completion
 | 
					# Be aware that if you are missing these lines from your profile, tab completion
 | 
				
			||||||
@@ -45,18 +55,6 @@ if (Test-Path($ChocolateyProfile)) {
 | 
				
			|||||||
  Import-Module "$ChocolateyProfile"
 | 
					  Import-Module "$ChocolateyProfile"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Kill Process
 | 
					 | 
				
			||||||
function pkill($name) {
 | 
					 | 
				
			||||||
        Get-Process $name -ErrorAction SilentlyContinue | Stop-Process
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# https://www.educative.io/answers/what-is-the-powershell-equivalent-of-touch
 | 
					 | 
				
			||||||
function touch{ni @args}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# chocolatey
 | 
					 | 
				
			||||||
# https://gist.github.com/yunga/99d04694e2466e017c5502d7c828d4f4
 | 
					# https://gist.github.com/yunga/99d04694e2466e017c5502d7c828d4f4
 | 
				
			||||||
function cs{choco search @args}
 | 
					function cs{choco search @args}
 | 
				
			||||||
function parus{choco search @args}
 | 
					function parus{choco search @args}
 | 
				
			||||||
@@ -65,6 +63,19 @@ function paru{choco install -y @args}
 | 
				
			|||||||
function cua{choco upgrade all -y}
 | 
					function cua{choco upgrade all -y}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Misc
 | 
				
			||||||
 | 
					#------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Kill Process
 | 
				
			||||||
 | 
					function pkill($name) {
 | 
				
			||||||
 | 
					  Get-Process $name -ErrorAction SilentlyContinue | Stop-Process
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# https://www.educative.io/answers/what-is-the-powershell-equivalent-of-touch
 | 
				
			||||||
 | 
					function touch{ni @args}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# reload profile
 | 
					# reload profile
 | 
				
			||||||
# https://stackoverflow.com/questions/567650/how-to-reload-user-profile-from-script-file-in-powershell
 | 
					# https://stackoverflow.com/questions/567650/how-to-reload-user-profile-from-script-file-in-powershell
 | 
				
			||||||
function rl{. $profile ; Write-Host "Reloaded"}
 | 
					function rl{. $profile ; Write-Host "Reloaded"}
 | 
				
			||||||
@@ -73,3 +84,44 @@ function rl{. $profile ; Write-Host "Reloaded"}
 | 
				
			|||||||
# yt-dlp
 | 
					# yt-dlp
 | 
				
			||||||
function ytv{yt-dlp -f bestvideo*+bestaudio/best --embed-thumbnail --add-metadata --no-mtime --no-playlist -o "%(title)s.%(ext)s" @args}
 | 
					function ytv{yt-dlp -f bestvideo*+bestaudio/best --embed-thumbnail --add-metadata --no-mtime --no-playlist -o "%(title)s.%(ext)s" @args}
 | 
				
			||||||
function yta{yt-dlp -f bestaudio --extract-audio --embed-thumbnail --add-metadata --no-mtime --no-playlist -o "%(title)s.%(ext)s" @args}
 | 
					function yta{yt-dlp -f bestaudio --extract-audio --embed-thumbnail --add-metadata --no-mtime --no-playlist -o "%(title)s.%(ext)s" @args}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Compute file hashes
 | 
				
			||||||
 | 
					function md5    { Get-FileHash -Algorithm MD5 $args }
 | 
				
			||||||
 | 
					function sha1   { Get-FileHash -Algorithm SHA1 $args }
 | 
				
			||||||
 | 
					function sha256 { Get-FileHash -Algorithm SHA256 $args }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Simple function to start a new elevated process. If arguments are supplied then 
 | 
				
			||||||
 | 
					# a single command is started with admin rights; if not then a new admin instance
 | 
				
			||||||
 | 
					# of PowerShell is started.
 | 
				
			||||||
 | 
					function admin
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  if ($args.Count -gt 0)
 | 
				
			||||||
 | 
					  {   
 | 
				
			||||||
 | 
					   $argList = "& '" + $args + "'"
 | 
				
			||||||
 | 
					   Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $argList
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					 else
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					   Start-Process "$psHome\powershell.exe" -Verb runAs
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Set UNIX-like aliases for the admin command, so sudo <command> will run the command with elevated rights. 
 | 
				
			||||||
 | 
					Set-Alias -Name sudo -Value admin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Edit the Powershell Profile
 | 
				
			||||||
 | 
					function editps1
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  Start-Process 'C:\Program Files\Sublime Text\sublime_text.exe' ${profile}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Get Uptime
 | 
				
			||||||
 | 
					function uptime {
 | 
				
			||||||
 | 
					  Get-WmiObject win32_operatingsystem | Select-Object csname, @{LABEL='LastBootUpTime';
 | 
				
			||||||
 | 
					  EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user