Various PowerShell scripts
Install starship via winget
winget install --id Starship.Starship
Clone the repository
git clone https://github.com/aminya/AcutePowerShell
cd AcutePowerShell
Now run the script:
Import-Module ./index.psm1 -DisableNameChecking
After you cloned the repository, open your profile:
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE
Append the script to the profile
Import-Module "path-you-cloned-the-repo/index.psm1" -DisableNameChecking
props
get
which
whichall
rmrf
ls_size
dump_bin
br
find_symlink
set_symlink_target
replace_symlink_target
abspath
wget
btime
benchmark
git_rm_merged
git_reset
git_up
video_replace_audio
video_extract_audio
cmake_configure
cmake_build
Now the following functions are available in your session:
props
: properties of an object
obj | props
get
: get property of an object
obj | get propname
which
: list only the first one
which clang
whichall
: lists all of the programs
whichall clang
find_symlink
Get the symbolic links in a folder
find_symlink .
find_symlink . --recursive
set_symlink_target
Set the target for a symbolic link
set_symlink_target path target
set_symlink_target ./folder1/mylink ./folder2/mylink
replace_symlink_target
Replaces the target of a symbolic link. It replaces the old part of the target with the new part
replace_symlink_target path old new
replace_symlink_target ./folder1/mylink folder1 folder2
abspath
: normalize a path
btime
: Benchmark a script and return the time it took. it runs the script once
btime { node -v }
benchmark
: Benchmark a script
benchmark { node -v }
You can change the count number by passing a number as the 2nd parameter
benchmark { node -v } 20
Measure-These
:
https://www.powershelladmin.com/wiki/PowerShell_benchmarking_module_built_around_Measure-Command
git_rm_merged
: Remove the merged git branch
Go to the root of the git repo and then:
git_rm_merged
git_reset
: Git fetch and reset --hard
git_reset
Specifying repo and branch:
git_reset("upstream", "master")
git_up
: rebase current branch with remote branch git_up [remote=upstream] [branch=master]
git_up
git_up origin master
-video_replace_audio
:
Batch replace the audio of video files in the current folder
video_replace_audio
video_replace_audio mp4 mp3
-video_extract_audio
:
Batch extract the audio of video files in the current folder
video_extract_audio
video_extract_audio mp4 mp3