This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This relies on the latest stash having untracked files | |
# Always create stash with: | |
# | |
# git stash -u | |
# | |
# Always apply your stash with: | |
# | |
# git stash apply | |
# | |
# Never do `git stash pop`! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy-screenshot.ts | |
var COMMAND_NAME = "screenshot-to-clipboard"; | |
var path = mp.utils.get_user_path("~/AppData/Local/Temp/mpv-screenshot-clipboard.png"); | |
function main() { | |
print("Saving screenshot to " + path); | |
mp.commandv("osd-msg", "screenshot-to-file", path, "video"); | |
mp.commandv("run", "cb", "cp", path); | |
} | |
mp.add_key_binding(undefined, COMMAND_NAME, main); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get a logger, put this in the beginning of every file: | |
import logging | |
log = logging.getLogger(__name__) | |
del logging | |
# Function to set up logging | |
def setup_logging(): | |
import datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import math | |
def delete_object_if_exists(name): | |
if name in bpy.data.objects: | |
bpy.data.objects.remove(bpy.data.objects[name], do_unlink=True) | |
def get_or_create_empty(name): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def open_image(path): | |
from PIL import Image | |
import numpy as np | |
img = Image.open(path) | |
return np.asarray(img) | |
# Using PIL and IPython | |
def show_img(img): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gen_buckets( | |
min_dim: int = 256, | |
base_res: tuple[int, int] = (512, 512), | |
max_size: tuple[int, int] = (768, 512), | |
dim_limit: int = 1024, | |
divisible=64, | |
): | |
""" | |
Adapted from: | |
https://github.com/NovelAI/novelai-aspect-ratio-bucketing/blob/main/bucketmanager.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import substance_painter.resource as res | |
import substance_painter.ui | |
from PySide2 import QtWidgets | |
def now(): | |
return datetime.datetime.now().timestamp() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, NamedTuple | |
import bpy | |
class ModifierSpec(NamedTuple): | |
name: str | |
type: str | |
properties: dict[str, Any] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model: | |
base_learning_rate: 5.0e-03 | |
target: ldm.models.diffusion.ddpm.LatentDiffusion | |
params: | |
linear_start: 0.00085 | |
linear_end: 0.0120 | |
num_timesteps_cond: 1 | |
log_every_t: 200 | |
timesteps: 1000 | |
first_stage_key: image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"samples_save": true, | |
"samples_format": "png", | |
"samples_filename_pattern": "", | |
"save_images_add_number": true, | |
"grid_save": true, | |
"grid_format": "png", | |
"grid_extended_filename": false, | |
"grid_only_if_multiple": true, | |
"grid_prevent_empty_spots": false, |
NewerOlder