Skip to content

Instantly share code, notes, and snippets.

@niko-la-petrovic
niko-la-petrovic / wavheader.cs
Created March 23, 2022 15:48
Wav Header Parsing
// Spec
// https://docs.fileformat.com/audio/wav/
public static WavHeader ParseWavHeader(this Stream fs)
{
int bitDepth;
int channelCount;
int samplingRate;
int dataSectionByteCount;
@niko-la-petrovic
niko-la-petrovic / speedtest.ps1
Created March 26, 2022 13:49
Speedtest to CSV
// CLI util at https://www.speedtest.net/apps/cli
$results = 1..10 | % { .\speedtest.exe -f json }
$results | % { $j = ConvertFrom-Json $_; @{download=$j.download.bandwidth; upload=$j.upload.bandwidth; ping=$j.ping.latency; jitter = $j.ping.jitter}} | ConvertTo-Csv
<#
.SYNOPSIS
Replaces a target file with a reference file if the reference file has a newer file version.
.DESCRIPTION
The function replaces a target file with a reference file if the reference file has a newer file version.
.PARAMETER ReferencePath
The path to the reference file. This file will be used to determine whether the target file should be replaced.