Skip to content

Instantly share code, notes, and snippets.

View RupertAvery's full-sized avatar

David Khristepher Santos RupertAvery

View GitHub Profile
@RupertAvery
RupertAvery / backup.py
Created May 2, 2025 22:37
Script to download Checkpoint (model/LORA) metadata from CivitAI based on the models in your local machine
import os
import hashlib
import requests
import json
import argparse
# Config
BASE_URL = "https://civitai.com/api/v1"
EXTENSION = ".safetensors"
@RupertAvery
RupertAvery / ColorConverter.cs
Last active December 4, 2024 19:07
Color Conversion RGB to/from HSL
public class ColorConverter
{
public static (int hue, int saturation, int luminance) RGBToHSL(int red, int green, int blue)
{
float r = (red / 255.0f);
float g = (green / 255.0f);
float b = (blue / 255.0f);
float min = Math.Min(Math.Min(r, g), b);

GBA

  • Legend of Zelda: The Minish Cap
  • Final Fantasy Tactics Advance
  • Mario & Luigi Superstar Saga
  • Wario Land
  • Megaman Zero 1-4

SNES

@RupertAvery
RupertAvery / Vector3Extensions.cs
Last active July 5, 2024 17:52
Vector3Extensions: Angle and Rotate
public static class Vector3Extensions {
public static double Angle(this Vector3 a, Vector3 b) {
var norm = 1.0f / (Normalize(a) * Normalize(b));
var dot = Vector3.Dot(a, b) * norm;
if (dot > 1.0f)
return 0.0f;
else if (dot < -1.0f)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace MappingUtil.Common
{
/// <summary>
/// Implements a MappingProvider
@RupertAvery
RupertAvery / Job.cs
Last active February 4, 2025 22:25
A wrapper class using Channels to asynchonously process a queue that can be added to at any time
public class Job
{
private static int lastId;
public int Id { get; private set; }
public int Duration { get; private set; }
public Job(int value)
{
Id = lastId + 1;
@RupertAvery
RupertAvery / AudioDevice.cs
Last active September 8, 2022 20:56
AudioDeviceManager
namespace MyAudio
{
public class AudioDevice
{
public string Name { get; set; }
public string Direction { get; set; }
public bool IsEnabled { get; set; }
public string DeviceId { get; set; }
}
}
@RupertAvery
RupertAvery / BaseNotifyModel.cs
Last active September 4, 2022 02:45
WPF ListView Binding
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace WPFSample
{
public class BaseNotifyModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string name = null)
@RupertAvery
RupertAvery / FastMethodInfo.cs
Last active April 13, 2022 01:53
FastMethodInfo with Generics
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Bite.Runtime.Functions.ForeignInterface
{
public class FastMethodInfo
{
private delegate object ReturnValueDelegate(object instance, object[] arguments);
@RupertAvery
RupertAvery / Program.cs
Last active December 11, 2021 00:42
Trimmed INSERT Parser for ANTLR
using Antlr4.Runtime;
using Antlr4.Runtime.Tree;
using System;
namespace TSQLParser
{
class Program
{
static void Main(string[] args)
{