Skip to content

Instantly share code, notes, and snippets.

@ml4den
ml4den / Get-FileHash.ps1
Created January 12, 2020 23:10
Hash a file easily with PowerShell
function FileSelector {
# Define a function that allows the user to select files.
# Credit: https://4sysops.com/archives/how-to-create-an-open-file-folder-dialog-box-with-powershell/
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
InitialDirectory = [Environment]::GetFolderPath('Desktop')
}
$null = $FileBrowser.ShowDialog()
return $FileBrowser
}
@ml4den
ml4den / Compare-Lists.ps1
Created January 20, 2020 20:02
Find the unique values in the second list with PowerShell
$a=@(1,2,3,4,5,8)
$b=@(1,2,3,4,5,6,9,"ten")
$c = $b | where { -not ($a -contains $_) }
Write-Host $c
@ml4den
ml4den / Fix-Warzone.ps1
Last active April 11, 2020 12:56
Easy Fix for Call of Duty Warzone Crashing in PowerShell
# Set path to game:
$game = "X:\Games\Warzone\Call of Duty Modern Warfare\ModernWarfare.exe"
Write-Host "Please start the game if not already running." -ForegroundColor Yellow
Write-Host "$(Get-Date)`tChecking for game process..."
Do {
$process = Get-Process -Name "ModernWarfare" -ErrorAction SilentlyContinue
Start-Sleep 5
@ml4den
ml4den / s3-upload-for-scaleway.js
Created May 1, 2022 10:56
Using aws-sdk to upload to a Scaleway S3 bucket in Node.js
const fs = require('fs');
import path from 'path';
const AWS = require('aws-sdk');
const BUCKET_NAME = 'my-bucket';
const awsConfig = new AWS.Config({
accessKeyId: process.env['SCALEWAY_ACCESS_KEY'],
secretAccessKey: process.env['SCALEWAY_SECRET_KEY'],
region: 'fr-par', // Not actually required to work
//s3BucketEndpoint: true, // Required if configuring for a single bucket endpoint like https://my-bucket.s3.fr-par.scw.cloud