Skip to content

Instantly share code, notes, and snippets.

View mikerochip's full-sized avatar

Mike Schweitzer mikerochip

View GitHub Profile
@mikerochip
mikerochip / github-delete-workflow-runs.sh
Last active July 3, 2025 23:44
Delete all runs of a GitHub workflow to remove it from the Actions UI
#!/bin/bash -e
command -v gh > /dev/null 2>&1 || { echo >&2 "\n'gh' was not found on your path. Install the GitHub CLI at https://github.com/cli/cli#installation\n"; exit 2; }
# Prompt for inputs
if [[ -z $OWNER ]]; then
read -rp "GitHub Owner (set OWNER to skip this): " OWNER
if [[ -z $OWNER ]]; then
echo "Missing OWNER"
exit 1
@mikerochip
mikerochip / github-normalize-to-crlf.sh
Last active July 3, 2025 23:39
Clone a repo and normalize line endings to CRLF (for GitBash on Windows)
#!/bin/bash -e
# Prompt for inputs
if [[ -z $OWNER ]]; then
read -rp "GitHub Owner (set OWNER to skip this): " OWNER
if [[ -z $OWNER ]]; then
echo "Missing OWNER"
exit 1
fi
fi
@mikerochip
mikerochip / github-aws-iam.tf
Last active July 3, 2025 23:45
Terraform: enable GitHub Actions OIDC for AWS with sample ECR push IAM Policy
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 6.0"
}
}
}
data "aws_caller_identity" "current" {}
@mikerochip
mikerochip / LruCache.cs
Last active December 3, 2024 00:54
LRU Cache C# Data Structure
public class LruCache<TKey, TValue> where TKey : IEquatable<TKey>
{
#region Private Types
private struct Entry
{
public TKey Key { get; set; }
public TValue Value { get; set; }
}
#endregion
@mikerochip
mikerochip / SerializedPropertyExtensions.cs
Last active May 10, 2024 01:59
Unity SerializedProperty extensions and utilities
using System;
using System.Collections;
using UnityEditor;
namespace MikeSchweitzer
{
public static class SerializedPropertyExtensions
{
public static T[] GetAllValues<T>(this SerializedProperty property)
{
@mikerochip
mikerochip / PluginSuppressor.cs
Last active November 5, 2023 23:09
Unity Editor code to suppress annoying issues with commonly-used plugins
using HutongGames.PlayMakerEditor;
using UnityEditor;
namespace OrgName.ProjectName.Unity.Editor.AnnoyingStuff
{
public class PluginSuppressor : AssetPostprocessor
{
[InitializeOnLoadMethod]
private static void Initialize()
{
@mikerochip
mikerochip / .dockerignore
Last active March 19, 2023 22:34
ASP.NET 7 Docker
# directories
**/bin/
**/obj/
**/out/
# files
Dockerfile*
**/*.md
@mikerochip
mikerochip / LeanContractResolver.cs
Last active June 29, 2025 06:30
Json.NET boilerplate to ignore serializing empty values and "read only" properties
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Company.Project.Serialization
{
public class LeanContractResolver : DefaultContractResolver
@mikerochip
mikerochip / MikesAddressablesTrainingManual.md
Last active May 23, 2021 17:16
Mike's Addressables Training Manual