Skip to content

Instantly share code, notes, and snippets.

View patridge's full-sized avatar

Adam Patridge patridge

View GitHub Profile
@patridge
patridge / audio-cd-export-cd-text
Created September 15, 2026 21:23
[macOS] Analyze a music CD for CD-TEXT and export the Apple-allowed fields into a plist file for later use
#!/usr/bin/env bash
export LC_ALL=C
if (( $# > 1 )); then
printf 'Usage: %s [output-file]\n' "${0##*/}" >&2
exit 64
fi
if [[ "$(uname -s)" != "Darwin" ]]; then
@patridge
patridge / audio-cd-analyzer.sh
Last active September 15, 2026 21:22
[macOS] Analyze a music CD for CD-TEXT or additional enhanced CD content
#!/usr/bin/env bash
export LC_ALL=C
if [[ "$(uname -s)" != "Darwin" ]]; then
printf '%s\n' \
"cd_text=unknown" \
"cd_extra=unknown" \
"reason=Linux requires an MMC/ioctl-capable helper"
exit 2
@patridge
patridge / steps.md
Created November 12, 2025 19:16
Windows 11 - Fix Bluetooth crackle, especially on AirPods
  1. Open old-style Devices and Printers settings via Windows+R, shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}, find your Bluetooth headphones

    NOTE: Windows 11 makes it really hard to get to the old settings, and doesn't offer the same options from the new Settings app. You can also get to it from the Settings app with some digging: Settings > Bluetooth & devices > Scroll down to More devices and printer settings.

  2. Right-click to get to Properties

  3. Services tab

  4. Uncheck Handsfree Telephony

  5. Disconnect and reconnect headphones

@patridge
patridge / IWiFiNetworkAdapterExtensions.cs
Last active April 24, 2024 01:45
Meadow wifi helper to allow awaiting the wifi connection
using System;
using System.Threading;
using System.Threading.Tasks;
using Meadow.Hardware;
namespace MeadowHelpers {
public static class IWiFiNetworkAdapterExtensions {
public static async Task<NetworkConnectionEventArgs> WaitForNetworkConnection(this IWiFiNetworkAdapter wifiAdapter, string? ssid = null, string? password = null, TimeSpan timeout = default(TimeSpan), CancellationToken cancellationToken = default(CancellationToken))
{
var tcs = new TaskCompletionSource<NetworkConnectionEventArgs>();
@patridge
patridge / NetworkHelpers.cs
Created October 31, 2022 22:08
Meadow: Network helper methods (NTP, WiFi discovery, requests, etc.)
public static class NetworkHelpers
{
public static async Task GetWebPageViaHttpClient(string uri)
{
Console.WriteLine($"Requesting {uri} - {DateTime.Now}");
using (var client = new HttpClient())
{
try
{
@patridge
patridge / gopro-video-concat.ps1
Last active May 9, 2024 23:25
PowerShell script to combine multi-part GoPro recordings into a single file using FFmpeg
# When GoPro recordings fill a 4GB file, they continue into additional sequential files differentiatedby the second and third characters, such as "GH010136.MP4" to "GH040136.MP4" when recording "0136" spans four files (GH01, GH02, GH03, GH04).
# Group all MP4 files of that GH*.MP4 format by the recording number (last four numbers) and filter by any grouping that contains more than one file, indicating it spans multiple files.
# TODO: Edit for your own FFmpeg install location
$ffmpegLocation = "C:\ProgramData\chocolatey\bin\ffmpeg.exe" # Default Chocolatey install location
$outputCombinedVideoSuffix = "-combined"
# Get all appropriate GoPro video segments without getting any previously generated combined video files (`-Exclude`).
foreach ($group in (Get-ChildItem GH*.MP4 -Exclude GH*${outputCombinedVideoSuffix}.MP4 | Group-Object -Property { $_.Name.Substring($_.Name.Length - ".MP4".Length - 4, 4) } | ? { ($_.Group | Measure-Object).Count -gt 1 })) {
# The ffmpeg utility can concatenate a bunch of video
// e.g., inject something whenever iterating a list
const arr = [ 1, 2, 3 ];
arr[Symbol.iterator] = function () {
let i = 0;
let arr = this;
return {
next: function () {
if (i >= arr.length) {
return { done: true };
} else {
@patridge
patridge / samples.sh
Created May 4, 2020 16:48
Command line reference
# Command line calls that don't fit elsewhere (e.g., PowerShell Experiments: https://github.com/patridge/PowerShellExperiments)
# Check for global NPM packages with updates available
npm outdated -g --depth=0
#
@patridge
patridge / markdown.json
Created April 3, 2020 20:32
Microsoft Docs/Learn Markdown snippets
{
"Microsoft Docs image": {
"prefix": [ "image", "img" ],
"body": [
":::image source=\"$1\" alt-text=\"$0\":::"
],
"description": "Microsoft Docs-style image syntax (':::image …:::')."
},
"Microsoft Docs decorative/icon image": {
"prefix": [ "image", "img" ],
@patridge
patridge / .gitignore
Last active April 2, 2021 19:59
FlatRedBall .gitignore
# FlatRedBall (FRB) .gitignore
# https://gist.github.com/patridge/46a9e6f410499e47fdbfc6d81c7c92f0/
*.Generated.cs
*.csvSettings
*.cachefile
*.Generated.Event.cs
*.gvwx
*.aeproperties