Skip to content

Instantly share code, notes, and snippets.

@fluttr
fluttr / putty_sessions_font.ps1
Last active Jun 21, 2019
Set font properties for default and all saved Putty sessions
View putty_sessions_font.ps1
foreach($session in $(gci registry::hkcu\Software\SimonTatham\PuTTY\Sessions\).name){
Set-ItemProperty -Path "registry::$session" -Name Font -Value "Terminus"
Set-ItemProperty -Path "registry::$session" -Name FontHeight -Value 0x0c # 12
Set-ItemProperty -Path "registry::$session" -Name FontCharSet -Value 0xcc # cyrillic
}
@fluttr
fluttr / ffmpeg_nvenc_example.ps1
Created Apr 26, 2018
Example of reencoding video using nvenc with metadata removal
View ffmpeg_nvenc_example.ps1
# converts all files specified in FileGlob using ffmpeg and nvenc
function ConvertWith-Nvenc(parameter(mandatory=$true)[string]$FileGlob){ # FileGlob can contain path and wildcards
$OutputDir = "$(Split-Path -Parent "$FileGlob")\out"
mkdir "$OutputDir"
foreach($vid in (gi "$FileGlob")){
echo "converting $vid..."
ffmpeg -i "$($vid.name)" -c:v h264_nvenc -preset slow `
-ac 2 -c:a aac -strict -2 -b:a 128k `
-map_metadata -1 `
"$OutputDir\$($vid.name)"
@fluttr
fluttr / timed_wait_for_user_input.ps1
Last active Feb 12, 2018
Waits $TimeoutSeconds for user input and then returns input if any.
View timed_wait_for_user_input.ps1
function waitForUserInput([parameter(mandatory=$true)][int]$TimeoutSeconds, [string]$Prompt){
$counter = 0
while($counter++ -lt $TimeoutSeconds){
if(-not [console]::KeyAvailable){
Start-Sleep -Seconds 1
} else {
$input = Read-Host -Prompt "$Prompt"
break
}
}
You can’t perform that action at this time.