Skip to content

Instantly share code, notes, and snippets.


Matthew Miner mminer

View GitHub Profile
mminer / Pathfinding.cs
Created Mar 19, 2021
A* pathfinding implementation.
View Pathfinding.cs
using System;
using System.Linq;
using System.Collections.Generic;
public static class Pathfinding
/// <summary>
/// A* implementation. Finds a path from start to goal.
/// </summary>
/// <param name="start">Where to begin.</param>
mminer / VerticallyFlipRenderTexture.cs
Created Feb 18, 2021
Unity function to vertically flip a render texture.
View VerticallyFlipRenderTexture.cs
/// <summary>
/// Vertically flips a render texture in-place.
/// </summary>
/// <param name="target">Render texture to flip.</param>
public static void VerticallyFlipRenderTexture(RenderTexture target)
var temp = RenderTexture.GetTemporary(target.descriptor);
Graphics.Blit(target, temp, new Vector2(1, -1), new Vector2(0, 1));
Graphics.Blit(temp, target);
mminer / YouTubePlayerResponse.cs
Created Jan 28, 2021
YouTube video player for Unity.
View YouTubePlayerResponse.cs
using System;
using System.Text.RegularExpressions;
using UnityEngine;
/// <summary>
/// Holds the result of parsing the ytInitialPlayerResponse JSON from a YouTube page.
/// </summary>
/// <remarks>
/// This is an incomplete list of fields in ytInitialPlayerResponse.
/// The full object contains many more, but we only care about a few.
mminer / KeepWindowsSessionAlive.ps1
Created Oct 2, 2020
PowerShell script to keep Windows session alive by repeatedly toggling numlock.
View KeepWindowsSessionAlive.ps1
$wshell = New-Object -ComObject WScript.Shell
while ($true) {
Write-Output "$(Get-Date) Toggling numlock"
Start-Sleep -Seconds 10
mminer /
Created Aug 10, 2020
Converts .mov files to image sequences using FFmpeg.
#!/usr/bin/env bash
for filename in "$@"; do
base=$(basename "$filename" .mov)
mkdir "$base"
ffmpeg -i "$filename" "$base/$base-%03d.png"
mminer /
Created Aug 7, 2020
Gets the "minimal" paths that comprise a directory's contents while excluding a set of child paths.
def get_minimal_paths(root_directory, paths_to_exclude=None, paths_to_include=None):
Gets the "minimal" paths that comprise a directory's contents while excluding a set of child paths.
For example, given this directory hierarchy:
mminer / GetHost.cpp
Created Jul 21, 2020
Unreal Engine utility function to get the host's IP address.
View GetHost.cpp
// Include "Sockets" in the `PrivateDependencyModuleNames` list in the Build.cs file.
#include "SocketSubsystem.h"
FString GetHost()
bool bCanBindAll;
return ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->GetLocalHostAddr(*GLog, bCanBindAll)->ToString(false);
mminer / storageArray.ts
Created Mar 9, 2020
Utility class to read and write arrays in localStorage / sessionStorage.
View storageArray.ts
class StorageArray {
private storage: Storage;
constructor(storage: Storage) { = storage;
get(key: string): string[] | null {
const jsonString =;
mminer / VerticalCollapse.tsx
Created Jan 2, 2020
React component for expanding and collapsing container with dynamic height.
View VerticalCollapse.tsx
import React, {forwardRef, useImperativeHandle, useRef} from 'react';
interface Props {
children: React.ReactNode;
className?: string;
collapsedHeight: number;
isCollapsed: boolean;
transitionDuration?: string;
mminer /
Created Dec 10, 2019
Basic Bash script to test equality of two inputs with coloured output.
#!/usr/bin/env bash
RESET='\033[0m' # No Color