Skip to content

Instantly share code, notes, and snippets.

View CamWiseOwl's full-sized avatar

Cameron WiseOwl CamWiseOwl

View GitHub Profile
@CamWiseOwl
CamWiseOwl / webp_convert.py
Last active March 30, 2024 21:52
Python script to convert animated WebP to video. Created as ffmpeg still lacking support and Image Magick struggles with offsets/frame blends. Probably better alternatives.
import shutil
import subprocess
import os
import tempfile
from PIL import Image
from pathlib import Path
import argparse
import re
# Requires FFMPEG, and the WebPMux tools from:
@CamWiseOwl
CamWiseOwl / Space Saving FFMPEG Conversion.ps1
Last active September 27, 2023 07:11
Needed to compress and convert some video only footage that was a mix of formats, codecs and resolutions. Just create a video_files.txt with the full filepath to each file to compress on each line.
$files = Get-Content ".\video_files.txt"
foreach ($file in $files) {
$name = ( Get-Item $file ).BaseName
$dir = ( Get-Item $file ).DirectoryName
$output = $dir + "\" + $name + " 1080p h265 crf28 no-audio.mp4"
if (Test-Path $output) {
Write-Host "Output file already exists: $output"
continue
}
@CamWiseOwl
CamWiseOwl / font-report.js
Created August 10, 2023 10:25
Quick console utility to report the font families used on the page with counts. Also an object containing the list of elements that use said font family.
var fontFamilies = {};
var fontFamilyObj = {};
document.querySelectorAll('*').forEach(e => {
var cs = window.getComputedStyle(e);
let ff = cs.getPropertyValue('font-family');
if (!fontFamilies[ff]) {
fontFamilies[ff] = 0;
}
if (!fontFamilyObj[ff]) {
fontFamilyObj[ff] = [];
@CamWiseOwl
CamWiseOwl / automatic1111-CFGDenoiser-and-script_callbacks-mod-for-SAG.patch
Created May 3, 2023 08:27
Updated patch for ashen-sensored/sd_webui_SAG for the recent changes in AUTOMATIC1111/stable-diffusion-webui
diff --git a/modules/script_callbacks.py b/modules/script_callbacks.py
index 17109732..6a93bd49 100644
--- a/modules/script_callbacks.py
+++ b/modules/script_callbacks.py
@@ -53,6 +53,21 @@ class CFGDenoiserParams:
class CFGDenoisedParams:
+ def __init__(self, x, sampling_step, total_sampling_steps, inner_model):
+ self.x = x
@CamWiseOwl
CamWiseOwl / reportFontFamilies.js
Created November 15, 2022 11:41
List all font families used on page and which elements.
(function reportFontFamilies() {
var fontFamilies = {};
var skip = [ 'link', 'script', 'style' ];
document.body.querySelectorAll('*').forEach(elem => {
if (skip.includes(elem.tagName.toLowerCase())) return;
var cs = getComputedStyle(elem);
var ff = cs.getPropertyValue('font-family');
if (!fontFamilies[ff]) fontFamilies[ff] = [];
fontFamilies[ff].push(elem);
});
@CamWiseOwl
CamWiseOwl / conway.html
Last active February 3, 2021 22:27
Conway's Game of Life, Code Golfed for JS / Canvas to 358 characters.
<canvas/><script>b=document.all[3].getContext("2d");s=50;z=s*s;m=[];n=[];g=(x,y)=>m[x*s+y%s];for(i=z;--i;m[i]=new Date&1);setInterval(()=>{for(i=z;--i;)x=i/s|0,x=g(x,i-1)+g(x+1,i-1)+g(x+1,i)+g(x+1,i+1)+g(x,i+1)+g(x-1,i+1)+g(x-1,i)+g(x-1,i-1),n[i]=3==x||m[i]&&2==x;for(i=z;--i;)b.fillStyle=(m[i]=n[i])?'red':'tan',b.fillRect(i/s*10,i%s*10,10,10)},s)</script>
@CamWiseOwl
CamWiseOwl / shiftdecode.js
Created August 18, 2016 11:58
Shifts characters by n-place. Returns an array of all shifted characters up to shift count (defaults to alphabet size).
function ShiftDecoder() {
var chars = "abcdefghijklmnopqrstuvwxyz".split("");
function iterate(str, shift) {
var str2 = "";
for (var i = 0; i < str.length; ++i) {
var char = str[i];
var inof = chars.indexOf(char);
if (inof == -1) {
str2 += char;