Skip to content

Instantly share code, notes, and snippets.

@DMeurer
DMeurer / MultiCopy.ps1
Last active September 2, 2024 06:36
A wrapper for robocopy asking for the paths and filling in the rest. Can be used as automatable cli or just startet with some prompts.
$paramMode = $args[0]
$paramSource = $args[1]
$paramDestination = $args[2]
$paramSilent = $args[3]
$silent = (($paramSilent -eq "-s") -or ($paramSilent -eq "--silent"))
if ($silent -eq $false)
{
Write-Host "$( [char]0x1b )[38;5;51m ______ ___ _______________ $( [char]0x1b )[38;5;84m _________ $( [char]0x1b )[0m
@DMeurer
DMeurer / install_chocolately_and_package.ps1
Created October 24, 2024 10:20
Install a chocolately package and chocolately if not already installed. You have to run `Set-ExecutionPolicy remotesigned` to execute the script.
# install Chocolately
If(Test-Path -Path "$env:ProgramData\Chocolatey") {
echo "Chocolately is installed"
} Else {
echo "Chocolately is not installed. Installing now..."
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
echo "Chocolately is installed"
}
# reload path
@DMeurer
DMeurer / gitAutoBackup.ps1
Created December 12, 2024 14:42
Auto-Backup a Git Repository. You can run it in Autostart or from TaskScheduler, etc. It will display MERGE CONFLICT and pause if you got one, otherwise it will just close itself. I'm using it to Backup a KeePass File.
git stash -u
git pull
git stash pop
$outp = $null;
$outp = git ls-files -u
if ($outp -eq $null){
Write-Host "No conflics" -ForegroundColor Green
} else {
Write-Host "===== MERGE CONFLICTS =====" -BackgroundColor DarkRed