Skip to content

Instantly share code, notes, and snippets.

View sesopenko's full-sized avatar

Sean Esopenko sesopenko

  • Benevity, Inc.
  • Calgary, Canada
View GitHub Profile
@sesopenko
sesopenko / ratios.py
Last active January 2, 2024 22:18
Group images by aspect ratio and list images which belong to an aspect ratio with 12 or fewer images. Useful for Kohya SS
from PIL import Image
import os
def get_aspect_ratio(image_path):
with Image.open(image_path) as img:
width, height = img.size
aspect_ratio = round(width / height, 1)
return aspect_ratio
@sesopenko
sesopenko / gist:fc73822b0fab60fdcec1aba25365e55f
Created January 2, 2024 22:16
Group images by aspect ratio and list images which belong to an aspect ratio with 12 or fewer images
from PIL import Image
import os
def get_aspect_ratio(image_path):
with Image.open(image_path) as img:
width, height = img.size
aspect_ratio = round(width / height, 1)
return aspect_ratio
@sesopenko
sesopenko / mainline.yml
Created October 5, 2022 21:19
.github/workflows/mainline.yml for Godot publishing to itch.io
# Whenever a tag push matching pattern "v*" then run the job
on:
push:
tags:
- "v*"
jobs:
# job id, can be anything
export_game:
# Always use ubuntu-latest for this action
@sesopenko
sesopenko / Makefile
Last active May 8, 2021 22:20
Automated, complete dev environment setup for building Phoenix web apps in Ubuntu 20.10 with Docker and MariaDB
LSB_RELEASE := $(shell lsb_release -cs)
WHOAMI := $(shell whoami)
SYSTEM := $(shell uname -s)
ARCH := $(shell uname -m)
NODE_VERSION := 14
PHOENIX_VERSION := 1.5.8
install-nodejs:
cd /tmp/
curl -sL https://deb.nodesource.com/setup_$(NODE_VERSION).x -o nodesource_setup.sh
@sesopenko
sesopenko / toasty_warm.sh
Created January 30, 2017 22:22
Bash script to make your laptop nice & toasty warm while using PHPStorm.
#!/bin/bash
for i in $( ls ); do
echo $(( ( RANDOM % 10 ) + 1 )) > force_phpstorm_synchronize.php
done
@sesopenko
sesopenko / Html5Upload.js
Last active December 11, 2015 10:38
Example code for an ajax file upload with jQuery and HTML5.
if(window.FormData){
var formData = new FormData($('form#uppic', $('div#upload'))[0]);
$.ajax({
url:'/upload/'+gUUID,
type:'POST',
xhr:function(){
var myXhr = $.ajaxSettings.xhr();
if(myXhr.upload){//check if upload property exists
myXhr.upload.addEventListener('progress', sendpic.progressHandle);
}