Skip to content

Commit

Permalink
add: aliases (find, less, head, tail), gcd;, which; fix: gitfast, isi…
Browse files Browse the repository at this point in the history
…t, profile, unix, ydc;
  • Loading branch information
kendfss committed Oct 21, 2024
1 parent b7110b9 commit 2d0b7a2
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 28 deletions.
4 changes: 4 additions & 0 deletions .profile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ set-alias editor (where.exe hx)
set-alias s select
set-alias touch "C:\Program Files\Git\usr\bin\touch.exe"
set-alias grep "C:\Program Files\Git\usr\bin\grep.exe"
set-alias find "C:\Program Files\Git\usr\bin\find.exe"
set-alias less "C:\Program Files\Git\usr\bin\less.exe"
set-alias head "C:\Program Files\Git\usr\bin\head.exe"
set-alias tail "C:\Program Files\Git\usr\bin\tail.exe"
set-alias gbash "C:\Program Files\Git\git-bash.exe"
# Variables
# $startup = "C:\Users\Kenneth\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
Expand Down
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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:
- [.profile](./.profile)
- [tilde](#tilde)
- [clone](#clone)
- [mdn](#mdn)
Expand Down Expand Up @@ -43,7 +44,8 @@ The number corresponds to the number of audio tracks the corresponding model is
##### alert
Produce a sequence of n beeps with random frequency
```powershell
> alert 3
> alert 3 # produces 3 beeps
> alert # produces a random number (lower than 12)
```
- *Requires:* [play](#play)

Expand All @@ -70,6 +72,7 @@ Echo n blank lines
>
```
- *See Also:* [goc](#goc)

Expand Down Expand Up @@ -105,6 +108,7 @@ Same as [cpr](#cpr) except it accepts arguments manually
```powershell
> choose (exts mkv webm mp4)
```

##### clone
Open your git cloning manager
```powershell
Expand All @@ -119,7 +123,7 @@ Close a running process
```

##### cls
Clears the screen before implementing [cdls](#cdls) and returning to starting directory
Clears the screen before perfoming [cdls](#cdls) and returning to starting directory
```powershell
> cls folder1 ../folder2 folder3
# closes fl64.exe
Expand Down Expand Up @@ -223,21 +227,30 @@ Open foobar2000
- *Assumes:* it is installed at *"C:\Program Files (x86)\foobar2000"*


##### goc
Go doc any number of arguments

##### gcd
`git clone` and `cd` into a repository
```powershell
> goc image.decode os.executable io/fs
c:/users/someone> gcd https://github.com/kendfss/shellpower
c:/users/someone/shellpower>
```
- *Assumes:* [Golang](https://golang.org) has been installed
- *See Also:* [blank](#blank)


##### gitfast
Quickly init, commit, and push a directory to github
```powershell
> gitfast "repo-name"
```
- *Assumes:* You're tryin to push to this github page
- *Assumes:* You're tryin to push to one of my repositories


##### goc
Go doc any number of arguments
```powershell
> goc image.decode os.executable io/fs
```
- *Assumes:* [Golang](https://golang.org) has been installed
- *See Also:* [blank](#blank)


##### gomo
Expand All @@ -253,7 +266,7 @@ cd into ```$env:gopath```
```powershell
> gosite
```
- *Assumes:* [Golang](https://golang.org) has been installed
- *Assumes:* [Go](https://golang.org) has been installed


##### gosrc
Expand Down Expand Up @@ -309,13 +322,14 @@ Check if a path is a file in the file system
> isfile path/in/question
```


##### isit
Return the boolean values associated with arguments
Return a boolean indicating if each argument is a command on this system
```powershell
> isit arg1 arg2 ... argN
```
- Wraps *get-command*
- See also [which](#which)



##### mcd
Expand Down Expand Up @@ -616,6 +630,13 @@ Convert the path of the current directory to wsl-unix form and send it to the cl
> unix
```

##### which
Echo the full paths (if found) of the given arguments
```powershell
> which arg1 arg2 ... argN
```
- Wraps *get-command*
- See also [isit](#isit)

##### y22
Grab a 1280x720-720p MP4 video (where applicable)
Expand Down
2 changes: 1 addition & 1 deletion alert.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
$n = if ($args.length) {$args[0] - 1} else {(get-random 12)+1}
echo $n
# echo $n
foreach ($i in (0..$n)) {play (get-random)}
2 changes: 1 addition & 1 deletion dls.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if ($args.length) {
ls .
cd $origin
}
cd $arg
# cd $arg
} else {
ls .
}
1 change: 1 addition & 0 deletions gcd.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git clone $args[0] && cd (basename $args[0])
4 changes: 2 additions & 2 deletions gitfast.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$name = $args[0]
if (-not (isfile "readme.md")) {
echo $name >> readme.md
if (-not (isfile "README.md")) {
echo $name >> README.md
}
git init
git add *
Expand Down
7 changes: 0 additions & 7 deletions isit.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion new.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $help = 'Create new powershell scripts
$scripts/name2.ps1
...
$scripts/nameN.ps1
And then open each file with the "editor" command defined in $profile
And then open each file with the "editor" alias defined in $profile
'


Expand Down
2 changes: 1 addition & 1 deletion profile.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
editor $profile
editor $profile && . $profile
4 changes: 1 addition & 3 deletions unix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ if ($args.length) {
$path = $args[$o]
$path = ("/mnt/" + (($path -replace "\\", "/") -replace ":", "")).tolower()
echo $path
echo $path
echo $path
# $out += '"' + ("/mnt/" + (($path -replace "\\", "/") -replace ":", "")).tolower() + '"'
# $out += ($o -le $args.length-2) ? "\n" : ""
$out += $path
Expand All @@ -16,4 +14,4 @@ if ($args.length) {
} else {
$path = pwd;
set-clipboard ("/mnt/" + (($path -replace "\\", "/") -replace ":", "")).tolower()
}
}
8 changes: 8 additions & 0 deletions which.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
foreach ($arg in $args) {
(Get-Command $arg -errorAction SilentlyContinue).Source
# if (Get-Command $arg -errorAction SilentlyContinue) {
# [boolean] 1
# } else {
# [boolean] 0
# }
}
2 changes: 1 addition & 1 deletion ydc.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
for ($i=0; $i -lt $args.length; $i++) {
blank ($i -eq 0 ? 0: 3)
youtube-dl -F $args[$i]
yt-dlp -F $args[$i]
}

0 comments on commit 2d0b7a2

Please sign in to comment.