Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fluttr
fluttr / putty_sessions_font.ps1
Last active June 21, 2019 12:11
Set font properties for default and all saved Putty sessions
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 April 26, 2018 09:51
Example of reencoding video using nvenc with metadata removal
# 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 February 12, 2018 21:17
Waits $TimeoutSeconds for user input and then returns input if any.
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
}
}