what
A collection of powershell scripts to help aid and play flows
why
Stubby little fingers grow weary of repeaded command sequences
This repository holds PowerShell scripts that I created for personal convenience.
Add them to a directory that is on your Path environment variable for optimal use.
You will have to personalize:
You may have to personalize:
You should personalize:
The three "splee" scripts enable the user to use Deezer's Spleeter CLI in a batched mode.
The number corresponds to the number of audio tracks the corresponding model is capable of parsing from a single source.
Produce a sequence of n beeps with random frequency
> alert 3 # produces 3 beeps
> alert # produces a random number (lower than 12)
- Requires: play
Echo a line of text comprised by a repetition of your chosen string
> bar 3
***
> bar qwerty 3
qwertyqwertyqwerty
offers the same functionality as the eponymous bash command
> (basename "c:/program files") -eq "program files"
True
Echo n blank lines
> blank 3
>
- See Also: goc
copy current directory to clibpoard
> ccd
- See Also: pcd
CD to and run LS in consecutive directories
> cdls folder1 ../folder2 folder3
Is equal to
> cd folder1; ls; cd ..; cd folder2; ls; cd folder3; ls
Same as cdls except it only prints the names of the directory contents as opposed to default windows behaviour (which is the same as ls -l on unix)
> cdn folder1 ../folder2 folder3
- See Also: names
Same as cpr except it accepts arguments manually
> choose (exts mkv webm mp4)
Open your git cloning manager
> clone
Close a running process
> close fl64
# closes fl64.exe
Clears the screen before perfoming cdls and returning to starting directory
> cls folder1 ../folder2 folder3
# closes fl64.exe
Copy the name of a random item in the current directory to the clipboard
> cpr
- See Also: names
a set up script for installing the .profile
> deploy
Clears the screen before implementing cdls
> cls folder1 ../folder2 folder3
# closes fl64.exe
Download a file from the internet
> download source.url destination/file.path
- Wrapper on invoke-webrequest
Execute a sequence of commands in succession
> exec "command 1" ... "command n"
- Wrapper on invoke-expression
Scan the current directory for files matching given extensions
> ext "extension 1" "extension 2" ... "extension n"
- See Also: next
Play files in tne current directory with ffmpeg's ffplay program
> ffhere 1 2 3
# will play the 1st 2nd and 3rd files listed in an "ls" call
> ffhere
# will play everything in the current directory
FFPlay files from the clipbboard or passed as argument
> ffp
# get clipboard, split by line break, play each file
> ffp (names | grep -i "search criteria")
# will play every file in the current directory whose name matches "search criteria"
Echo the names of the files in an get-childitem -file -names
call of each argument (assuming it is a path to a directory)
> files dir1 dir2 dir3
# will look in the 1st 2nd and 3rd directories passed as arguments
> files
# will look in the current directory
Echo the names of the folders in an get-childitem -directory -names
call of each argument (assuming it is a path to a directory)
> folders dir1 dir2 dir3
# will look in the 1st 2nd and 3rd directories passed as arguments
> folders
# will look in the current directory
Open foobar2000
> foo
- Assumes: it is installed at "C:\Program Files (x86)\foobar2000"
git clone
and cd
into a repository
c:/users/someone> gcd https://github.com/kendfss/shellpower
c:/users/someone/shellpower>
Quickly init, commit, and push a directory to github
> gitfast "repo-name"
- Assumes: You're tryin to push to one of my repositories
Go doc any number of arguments
> goc image.decode os.executable io/fs
Spin up a demo project for go. Assumes you have content for a "main.go" file in clipboard.
> gomo demo_project_name/or/path
- Assumes: Golang has been installed
cd into $env:gopath
> gosite
- Assumes: Go has been installed
cd into the directory above the golang installation's /bin
> gosrc
- Assumes: Golang has been installed and its /bin directory is on the path variable
Open the directory containing a given executable which is accessible via the path environment variable. Also echoes the path of the executable
> goto powershell
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Go run your Golang source file
> gun path/to/my/main/file.go
Play happy birthday with lyrics
> happy_birthday syllable1 syllable2
# prints the lyrics, while playing the melody, puts the two arguments (syllables) into "happy birthday, dear {syllable1} {syllable2}" t
- Requires: play
Echo the index of an element of a countable iterable
> ind 1 3
1 of 3
Check if a path is a directory in the file system
> isdir path/in/question
Check if a path is a file in the file system
> isfile path/in/question
Return a boolean indicating if each argument is a command on this system
> isit arg1 arg2 ... argN
- Wraps get-command
- See also which
Create a whole tree with a single command
> mcd folder1 ../folder2 folder3
# equals md folder1; cd folder1; cd ..; md folder2; cd folder2; md folder3; cd folder3
> mcd testdir1 td2 ../td3 td4
# testdir1
# ├───td2
# └───td3
# └───td4
Opens the mozilla mdn docs in explorer
> mdn
- assumes you've set a
$mdn
variable
takes file and directory paths and creates a file, named image_list.txt
with the found images for giving to ffmpeg
> mkimagelist [path1 [path2 ...]]
Commands ffmpeg to create a video using the file generated by mkimagelist
. The resulting file will be called out.mp4
> mkimagevid
Commands ffmpeg
to create a video using a given image and audio file. The resulting file will be called out.mp4
> mkvid image/file/path audio/file/path
run ls -n
aka get-childitem -n
and filter for files whose names match arguments
> names arg1 arg2 argN
- case insensitive
Check if a given path exists and return a version of it that doesn't
> nameSpacer c:/users
c:/users_2
Scan a sequence of directories for names matching a given extension
> next "extension" "directory 1" ... "directory n"
- See Also: ext
Create a new powershell script
> new name1 name2 ... nameN
# will create:
# $base/name1.ps1
# $base/name2.ps1
...
# $base/nameN.ps1
# and open each one in a text editor
- Assumes you have set a
$scripts
variable - Assumes you have set a
editor
alias
open [in] notepad
> np file/path
open [in] notepad++
> npp path/to/some/thing/or/place
- Assumes you have an alias for notepad++ as "n++" in your path or $profile
Find out precisely where executables on the path are located
> onde exe1 exe2 etc..
- Note: You will have to append '.ps1' if you are looking for powershell scripts
Open the given file with the default program
> open path/to/file
cd into the directory in your clipboard
> pcd
Play a sequence of notes on a single 11-note octave "keyboard" rooted at 440hz
> play 0 1 1 2 3 5 8 13 21
open something with explorer and focus its window.
> pop
- "start-process"/"start"/etc don't focus the new window
Repetitive echo that was probably the first powershell script i wrote. I forgot about, and would otherwise delete, it but reading it now I realize I'd also forgotten some syntax features I should remember to implement elsewhere in this library. So it's sticking around, for now.
> pout
Raise some argument to a power of choice
> pow 2 3
8
Open your $profile
file
> profile
- Assumes you have set a
editor
alias
Pub get a sequence of arguments
> pub uri1 uri2 #etc...
- Assumes you have installed flutter/dart installed
Augment an environment variable
> pushenv "key" "value" "separator"
> pushenv "key" "value"
- Not persistent
- Remember to use a separator if needed
Set an environment variable
> putenv "variable" "value"
- Not persistent
Cat the readme.md files of multiple directories by simply stating the folder names
> cd my/repository/depository
> readus tensorflow python some/other/repo or/folder maybe/its/on/another/disk idk/up/to/you/really
Send path to the recycle bin
> recycle path1 path2 pathN
- Currently broken
Remove a file whose path is in the clipboard
> rmp
- Equivalent to
rm (get-clipboard)
move the selected file to the samples folder
> sample
# gets path from clipboard
> sample arg1 arg2 ... argN
# act on a sequence of arguments
- Assumes you have set a
$samples
variable
Rage quit the project in the current directory by sending it to the recycle bin
> scrap
- Requires recycle
Print the names and sizes of files in the current directory, first argument(s) denote(s) [a] search term[s], if the last argument is an int it will mean b, kb, mb (default), or gb mode
> sizes [search_term_1 ... search_term_N] [0_1_2_or_3]
- case insensitive
Print the sizes of the given arguments. Size of all child files for directories.
> sizeof .ssh
2012
> sizeof links
1399
> sizeof music
37889861619
Open the sound control panel
> sound
Split an audio stream into a vocal and instrumental track
> splee2 path/to/audio/file
- Assumes you have python and have previously installed spleeter
Split an audio stream into a vocal, instrumental, drum, bass, and piano tracks
> splee4 path/to/audio/file
- Assumes you have python and have previously installed spleeter
Split an audio stream into a vocal, instrumental, drum, bass, and piano tracks
> splee5 path/to/audio/file
- Assumes you have python and have previously installed spleeter
Split the last suffix from the path
> splitext path/to/something.suffix1.suffix2
suffix2
Serve the unofficial Sublime Text documentation locally
> sublime_docs
- Assumes you have previously cloned docs.sublimetext.io
Open a sequence of arguments (or the current directory) in sublime text
> st dir/file1.ext file2.ext .
- Assumes you have previously installed Sublime Text and have it aliased as "sublime"
ssh into tilde
> tilde
Convert the path of the current directory to wsl-unix form and send it to the clip-board
> unix
Echo the full paths (if found) of the given arguments
> which arg1 arg2 ... argN
- Wraps get-command
- See also isit
Grab a 1280x720-720p MP4 video (where applicable)
> y22 url1 url2 urlN
- Assumes you have installed youtube-dl
- Assumes $ytdls is set
Youtube download the audio streams associated with a sequence of arguments
> yda url1 url2 urlN
- Assumes you have installed youtube-dl
- Assumes $ytdls is set
- uses ind
Check the available formats associated with a sequence of arguments
> ydc url1 url2 urlN
- Assumes you have installed youtube-dl
Youtube download the audio streams associated with a sequence of arguments
> ydl url1 url2 urlN
- Assumes you have installed youtube-dl
- uses ind
cd into a pre-defined directory
C:\Windows\System32> ytdls url1 url2 urlN
pre/defined/directory>
- Assumes $ytdls is set
- uses ind