Skip to content

Instantly share code, notes, and snippets.

View gabriel-vanca's full-sized avatar

Gabriel Vanca gabriel-vanca

View GitHub Profile
@gabriel-vanca
gabriel-vanca / refresh.ps1
Last active January 23, 2024 03:02
Refreshing PowerShell Terminal
Write-Host "Refreshing terminal"
.$PROFILE
# ($NULL -eq $IsWindows) checks for Windows Sandbox enviroment
if($IsWindows -or ($NULL -eq $IsWindows)) {
# Expected path of the choco.exe file.
$chocoInstallPath = "$Env:ProgramData/chocolatey/choco.exe"
if(Test-Path -path $chocoInstallPath) {
# Make `refreshenv` available right away, by defining the $env:ChocolateyInstall
@gabriel-vanca
gabriel-vanca / clone.ps1
Last active January 22, 2024 04:08
Quick Clone Github repository
$repoDownloadLocalPath = "$env:Temp\WinGet"
#Ensure download folder is empty
if(Test-Path -path $repoDownloadLocalPath)
{
Remove-Item $repoDownloadLocalPath -Recurse -Force
}
$repoUrl = "https://github.com/gabriel-vanca/WinGet"
git clone $repoUrl $repoDownloadLocalPath --depth 1 --progress -v
Get-ChildItem $repoDownloadLocalPath -Recurse | Unblock-File
@gabriel-vanca
gabriel-vanca / run.ps1
Last active January 22, 2024 04:11
Run Github script with Parameters
$scriptPath = "https://raw.githubusercontent.com/gabriel-vanca/PowerShell_Library/main/Scripts/Windows/Software/close_program.ps1"
$WebClient = New-Object Net.WebClient
$close_program = $WebClient.DownloadString($scriptPath)
$close_program_sb = [Scriptblock]::Create($close_program)
$param1 = "Windows Terminal"
$param2 = "WindowsTerminal"
$param3 = "WindowsTerminal"
Invoke-Command -ScriptBlock $close_program_sb -ArgumentList ($param1, $param2, $param3) -NoNewScope