Skip to content

Instantly share code, notes, and snippets.

@milnak
milnak / doublecmd-backup.ps1
Last active February 26, 2025 20:06
Backup Double Commander settings folder using 7z
Param(
[string]$SourcePath = '~\scoop\persist\doublecmd',
[string]$DestinationPath = (Resolve-Path '~').Path,
[string]$Filename = 'DoubleCmd Backup {0}' -f (Get-Date -Format '(yyyy-MM-dd)')
)
# Ensure 7z.exe exists
Get-Command '7z.exe' -CommandType Application -ErrorAction Stop | Out-Null
$archiveName = '{0}.7z' -f (Join-Path -Path $DestinationPath -ChildPath $Filename)
@milnak
milnak / how-to-digitize-recordings.md
Last active February 25, 2025 06:43
How to Digitize Recordings using Audacity

How to Digitize Recordings using Audacity

Adapted parts from Splitting a recording into separate tracks.

Set up connections

If using a record player, you'll need a phono preamp to increase the level from the record player to line level. Better still, use a record player that has RCA line out or USB out. The Audio-Technica LP-120XUSB has both. If the record player has USB out, you can connect that directly to your computer, and skip to the next section.

If using a tape deck, or a record player with RCA line out, you'll need to connect RCA cables to a DAC (digital-to-analog converter). For example, I use Livewire Essential Interconnect Dual Cable RCA Male to 1/4" TS Male, plugging the RCA Male to the "Line Out (Play)" jacks on my tape deck, and the 1/

@milnak
milnak / dump-sqlite.ps1
Created February 17, 2025 23:39
Dump Sqlite Table using PowerShell
$SqliteAssembly = Resolve-Path -LiteralPath '~\scoop\apps\scoop\current\supporting\sqlite\System.Data.SQLite.dll'
$DbPath = Resolve-Path -LiteralPath '~\AppData\Roaming\Code\User\globalStorage\state.vscdb'
if (!('System.Data.SQLite.SQLiteConnection' -as [Type])) {
Add-Type -Path $SqliteAssembly
}
$connection = New-Object -TypeName 'Data.SQLite.SQLiteConnection'
$connection.ConnectionString = "Data Source=$DbPath"
$connection.Open()
$command = $connection.CreateCommand()
@milnak
milnak / catver-to-folder.ps1
Last active February 14, 2025 01:39
Convert MAME catver.ini file to a folder INI file
# Convert a category in catver.ini to a folder INI file.
Param(
# Path to catver.ini file
[string]$CatVerPath = 'catver.ini',
# Category to extract, e.g. "driving". Output file will be created with that name in "folders"
[Parameter(Mandatory)]$Category
)
Test-Path -LiteralPath 'mame.exe' -PathType Leaf | Out-Null
@milnak
milnak / HyperV-VM-Creator.ps1
Last active February 12, 2025 04:01
Create a Hyper-V VM from an ISO.
<#
.SYNOPSIS
Create a Hyper-V VM from an ISO.
.DESCRIPTION
Create a Hyper-V VM from an ISO.
.PARAMETER VMName
VM Name
@milnak
milnak / colors.json5
Last active February 6, 2025 21:18
Double Commander "colors.json" file - colors from "Crystal Color Center" and eza
{
Styles : [
{
Name : "Light",
FilePanel : {
CursorBorderColor : -2147483635,
ForeColor : 13421772,
BackColor : 0,
BackColor2 : 0,
MarkColor : 10875385,
@milnak
milnak / Texas Hold 'Em Poker Tournament Rules.md
Last active February 5, 2025 06:52
Texas Hold 'Em Poker Tournament Rules

Texas Hold 'Em Poker Tournament Rules

Adapted from Bill Costin

The Game

Texas Hold 'Em is Seven Card Stud where each player gets two down cards; "Hole" cards with the remaining five up cards; "Community" cards being placed in the center of the table which all players use to complete their hand.

@milnak
milnak / Web Search Engine Queries.md
Last active February 2, 2025 22:59
Web Search Engine Queries

Web Search Engine Queries

For use with ueli.

File location on Windows: $env:AppData\ueli\ueli9.settings.json

Table created using:

"|Name|Prefix|Url|`n|----|------|---|"; (Get-Content "$env:AppData/ueli/ueli9.settings.json" | ConvertFrom-Json).'extension[CustomWebSearch].customSearchEngines' | Sort-Object name | ForEach-Object { '|{0}|{1}|`{2}`|' -f $_.name,$_.prefix,$_.url }
@milnak
milnak / Get Windows Product Key from PowerShell.ps1
Last active February 5, 2025 06:55
Get Windows Product Key from PowerShell
# Derived from WinProdKeyFinder
# https://github.com/mrpeardotnet/WinProdKeyFinder
$digitalProductId = (Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion').DigitalProductId
# First byte appears to be length
if ($digitalProductId[0] -ne $digitalProductId.Length) {
throw 'Invalid length.'
}
$ProductId = [Text.Encoding]::UTF8.GetString($digitalProductId[8..30])
@milnak
milnak / Controls-for-GTA-IV.md
Last active January 5, 2025 04:06
Controls for GTA IV

Controls for GTA IV

Adapted from the GTA IV Wiki

General

Control PC 360
Take phone out Up D-Pad Up