Author ::
D A R S H A N S (GitHub/azuregray)
My Identity >>
Github
SPECIAL NOTE FROM AUTHOR
:: I am turning this repo into a Public Archive as I deem that no further changes are required for the repository. Please continue reading to know how this repo might be of great help for you.
Oh wait!! There are no files in the repo other than a README! Yes, ofcourse.
Feel free to fork this repo to your own GitHub account and then populate it with files in the root folder itself so that you won't need to type longer commands 😉
(iwr -uri *UrlDirectToFile* ).content | clip
NOTE: You can write the whole function in a single line too..
- Function Definition as a BLOCK:
function gcl{
param(
[parameter(mandatory=$true, position=0)]
[string] $uri)
(iwr -uri $uri).content | clip
}
- Function definition InLine:
function gcl{ param([parameter(mandatory=$true, position=0)] [string] $uri) (iwr -uri $uri).content | clip }
- Usage of Inline Function:
gcl UrlDirectToFile
- Undefine the function:
remove-item function:\gcl
rangeSTART.....rangeEND | foreach { command_with_($)sign_at_loopingPosition }
- For fetching program1.html >> program12.html:
1..12 | foreach {iwr -uri https://raw.githubusercontent.com/azuregray/LabHelper/main/program$($_).html -outfile program$($_).html}
- For fetching q51.txt >> q55.txt:
1..5 | foreach {iwr -uri https://raw.githubusercontent.com/azuregray/LabHelper/main/q5$($_).txt -outfile q5$($_).txt}
-
For fetching a single file:
curl -s *UrlDirectToFile* | xclip -selection clipboard
-
For fetching multiple files, use a loop: Let's say program1.html >> program5.html:
numbers=(1 2 3 4 5); for i in "${numbers[@]}"; do curl -s https://raw.githubusercontent.com/azuregray/LabHelper/main/program${i}.html; done | xclip -selection clipboard
or perhaps, q51.txt >> q56.txt:
numbers=(1 2 3 4 5); for i in "${numbers[@]}"; do curl -s https://raw.githubusercontent.com/azuregray/LabHelper/main/q5${i}.txt; done | xclip -selection clipboard
https://raw.githubusercontent.com/<GithubUsername>/LabHelper/main/<FileName>
https://raw.githubusercontent.com/azuregray/LabHelper/main/<FileName>