76 lines
2.6 KiB
PowerShell
76 lines
2.6 KiB
PowerShell
$host.ui.rawui.windowtitle="$(Get-Item .) - Windows Terminal"
|
|
|
|
# powershell.exe -NoExit -command "& {Set-Location $env:systemroot}"
|
|
|
|
# @args you can pass multi arguments for example
|
|
# ga fileName1 fileName2
|
|
function gn{git init}
|
|
|
|
# @args is optional to add argument
|
|
function add{git add @args}
|
|
function commit { git commit -m @args }
|
|
function gac{git add .;git commit -m @args}
|
|
function gacc{git add .;git commit -m @args ; git push}
|
|
function gpm{git push origin master}
|
|
function pull{git pull}
|
|
function gpp{git pull}
|
|
function gl{git log}
|
|
function glo{git log --oneline}
|
|
function gch{git checkout @args}
|
|
function gb{git branch @args}
|
|
function gs{git status}
|
|
function gdd{git diff}
|
|
function gdf{git diff}
|
|
function gsi{git submodule init}
|
|
function gsu{git submodule update --recursive --remote}
|
|
# function gsu{git submodule update --recursive --remote}
|
|
|
|
# Useful shortcuts for traversing directories
|
|
function cd.. { Set-Location ..\.. }
|
|
function cd... { Set-Location ..\..\.. }
|
|
function gg { Set-Location $HOME\Syncthing\Git }
|
|
function ll { Get-ChildItem -Path $pwd -File }
|
|
|
|
# https://www.technewstoday.com/powershell-get-ip-address/
|
|
# get ip address
|
|
function ipa { Get-NetIPAddress | Where-Object {$_.AddressState -eq "Preferred" -and $_.ValidLifetime -lt "24:00:00"}}
|
|
|
|
# Import the Chocolatey Profile that contains the necessary code to enable
|
|
# tab-completions to function for `choco`.
|
|
# Be aware that if you are missing these lines from your profile, tab completion
|
|
# for `choco` will not function.
|
|
# See https://ch0.co/tab-completion for details.
|
|
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
|
if (Test-Path($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
|
|
function cs{choco search @args}
|
|
function parus{choco search @args}
|
|
function ci{choco install -y @args}
|
|
function paru{choco install -y @args}
|
|
function cua{choco upgrade all -y}
|
|
|
|
|
|
# reload profile
|
|
# https://stackoverflow.com/questions/567650/how-to-reload-user-profile-from-script-file-in-powershell
|
|
function rl{. $profile ; Write-Host "Reloaded"}
|
|
|
|
|
|
# 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 yta{yt-dlp -f bestaudio --extract-audio --embed-thumbnail --add-metadata --no-mtime --no-playlist -o "%(title)s.%(ext)s" @args}
|