Skip to content

Instantly share code, notes, and snippets.

View AndySum's full-sized avatar

AndySum

View GitHub Profile
@stravant
stravant / reloader.gd
Last active August 22, 2024 22:55
Simple plugin auto-reloader for Godot plugin development
################################################################################
## stravant's Godot plugin auto-reloader ##
## For ease of plugin development ##
## MIT licensed ##
## ##
## Call preload("./reloader.gd").new() in your EditorPlugin component's ##
## _enter_tree method to enable automatic reloading whenever you save changes ##
## to any of the plugin files for a tighter plugin rapid prototyping loop. ##
## ##
## Source: https://gist.github.com/stravant/7aec484bb5e34e3a6196faaa13159ac3 ##
'''
https://gist.github.com/kohya-ss/3f774da220df102548093a7abc8538ed
1. put this file in ComfyUI/custom_nodes
2. load node from <loaders>
'''
import torch
from comfy.ldm.modules.diffusionmodules.openaimodel import forward_timestep_embed, timestep_embedding, th
def apply_control(h, control, name):
@kaiokendev
kaiokendev / 4Bit Lora Trainer Notebook.ipynb
Last active October 16, 2023 17:26
4-bit LoRA Training Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@natrim
natrim / convert.sh
Last active June 18, 2024 15:13
Simple conversion script that converts Godot html5 export to gzipped version, with decompressing wasm and pck files using pako
#!/bin/bash
### usage ./convert.sh game
## where game is baseName of the export
if [ ! "$1" ]; then
read -p 'Game name: ' game
else
game="$1"
fi
@hasanbayatme
hasanbayatme / MinMax.cs
Last active November 23, 2020 16:00
Unity Min Max Slider Implementation
using System;
using UnityEngine;
[Serializable]
public struct MinMax
{
[SerializeField]
private float min;
[SerializeField]
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Extended: Simon "Draugor" Wagner (https://www.twitter.com/Draugor_/)
/// Latest Version: https://gist.github.com/Draugor/00f2a47e5f649945fe4466dea7697024
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2020-07-09: - Fixed a Bug with already inactive members getting Despawned again. thx AndySum (see: https://gist.github.com/Draugor/00f2a47e5f649945fe4466dea7697024#gistcomment-2642441)
/// 2020-06-30: - made the "parent" parameter avaible in the public API to spawn GameObjects as children
/// 2018-01-04: - Added Extension Method for Despawn on GameObjects
@gering
gering / Toolkit
Last active July 11, 2024 14:05
persitent data path handling in Unity with fallback
private static string[] _persistentDataPaths;
public static bool IsDirectoryWritable(string path) {
try {
if (!Directory.Exists(path)) return false;
string file = Path.Combine(path, Path.GetRandomFileName());
using (FileStream fs = File.Create(file, 1)) {}
File.Delete(file);
return true;
} catch {
@omgwtfgames
omgwtfgames / A set of Unity3D extension methods
Last active March 2, 2024 17:44
Some useful extension method for Unity3D
A collection of useful C# extension methods for the Unity engine.
@alienhaxor
alienhaxor / _formhelpers.py
Last active September 5, 2022 17:42 — forked from maximebf/gist:3986659
Jinja2 macro to render WTForms fields with Twitter Bootstrap. This fork renders the fields according to bootstrap 3.0.0
{% macro render_field(field) -%}
{% set with_label = kwargs.pop('with_label', False) %}
{% set placeholder = '' %}
{% if not with_label %}
{% set placeholder = field.label.text %}
{% endif %}
<div class="form-group {% if field.errors %}error{% endif %}">
{% if with_label %}
<label for="{{ field.id }}" class="control-label">
{{ field.label.text }}{% if field.flags.required %} *{% endif %}:
class Ladder(object):
def __init__(self):
self.hight = 20
class Table(object):
def __init__(self):
self.legs = 4
my_factory = {
"target1": Ladder,