Skip to content

Instantly share code, notes, and snippets.

View shaneturner's full-sized avatar
🤔

Shane Turner shaneturner

🤔
View GitHub Profile
@shaneturner
shaneturner / calc_ratios.py
Created November 9, 2023 20:40
Calculate common screen rations from a given user input dimension. Scripts in both Bash .sh and Python .py
#!/usr/bin/env python3
def calculate_dimension(base_dimension, ratio):
calculated_dimension = int(base_dimension * ratio)
return calculated_dimension
def main():
dimension_choice = input("Enter 'w' for width or 'h' for height: ")
input_dimension = int(input("Enter the base dimension (as an integer): "))
print(f"\n")
@shaneturner
shaneturner / dl_models.py
Created November 9, 2023 00:19
Download contronet models for a1111. Place in and run from the [base a1111 directory]/extensions/sd-webui-controlnet/models
import os
import requests
from tqdm import tqdm
from urllib.parse import unquote, urlparse
# File URLs for Controlnet Models from Huggingface
file_urls = ['https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p.pth?download=true', 'https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle.pth?download=true', 'https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile.pth?download=true', 'https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth.pth?download=true', 'https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny.pth?download=true', 'https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint.pth?download=true', 'https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart.pth?download=true', 'https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd.pth?download=true
@shaneturner
shaneturner / checker.py
Created October 8, 2023 21:03
Check python torch CUDA
import torch
print(torch.version.cuda)
print(torch.cuda.is_available)
@shaneturner
shaneturner / uuid.js
Created July 15, 2020 20:44
Generates randon hex string for use as UUID. Quick-n-dirty.
/* Generates randon hex string for use as UUID. Quick-n-dirty. */
Math.random().toString(16).slice(2)
@shaneturner
shaneturner / gist:98712b3ebb5943509dff98e00e81ed63
Created November 11, 2019 02:16
Linux list directories into file
for i in $(ls -d */); do echo ${i%%/}; done > dirlist
@shaneturner
shaneturner / site-backup
Last active November 9, 2023 21:25
Make website backup copy using WGET
wget -R _H -k -K -p --random-wait -e robots=off -U mozilla ***URL_HERE***
sudo -- sh -c 'apt update && apt upgrade -o Dpkg::Options::="--force-confold" --force-yes -y && apt autoremove -o Dpkg::Options::="--force-confold" --force-yes -y && apt autoclean -o Dpkg::Options::="--force-confold" --force-yes -y'
@shaneturner
shaneturner / rm_node_modules.sh
Created August 31, 2018 01:03
Remove node_modules from git repo
#!/bin/sh
git rm -r --cached node_modules
git commit -m 'Remove node_modules directory'
git push origin master
@shaneturner
shaneturner / set-permissions.sh
Created June 14, 2018 23:49
Set normal permissions on files and directories
#!/bin/bash
# Sets 644 for files and 755 to directories in current directory and sub directories
find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;