Skip to content

Instantly share code, notes, and snippets.

View DraconicDragon's full-sized avatar
💭
meow?

Drac DraconicDragon

💭
meow?
View GitHub Profile
@DraconicDragon
DraconicDragon / launch.py
Created September 3, 2024 15:19
Stable Diffusion Webui (/Forge) custom colored console output. paste this somewhere at the top of launch.py
import sys
import re
class GreenOutput:
# regex pattern to match URLs, IP and ports
url_pattern = re.compile(
r'((http|https|ftp|ftps):\/\/' # protocol
r'(\d{1,3}\.){3}\d{1,3}' # ip
r'(?::\d+)?' # port number if existing
r'(?:[\/\w.,@?^=%&:/~+#-]*)?' # rest of URL
r'|' # OR
@DraconicDragon
DraconicDragon / png_with_exif2jpg.py
Last active May 15, 2024 19:47
A PNG to JPG converter that preserves the EXIF metadata (mainly to convert AI generated images to save storage space)
import os
import tkinter as tk
from tkinter import filedialog
import piexif
import piexif.helper
from PIL import Image
class PNGtoJPGConverterApp:
@DraconicDragon
DraconicDragon / doodle.css
Created January 29, 2024 18:51
Discord Custom CSS with collapsable SideBars
:root {
--sidebar-w-collapsed: 36px; /*used for collapsable sidebar*/
--sidebar-h-extended: 240px;
--memberlist-collapsed: 62px;
--memberlist-expanded: 240px;
--memberlist-transition: 0.35s ease-in-out;
}
/*vc text is correct with channel sidebar and main chat margin*/
.chat_f8f70f { margin-left: 0px !important; }
@DraconicDragon
DraconicDragon / XAML_Chessboard.md
Last active October 8, 2023 14:08
XAML Chessboard with Gridview, ItemsPanel, ItemsTemplate

XAML Chessboard with Gridview, ItemsPanel, ItemsTemplate

XAML

<GridView
    Width="Auto"
    Height="Auto"
    ItemsSource="{x:Bind Chessboard}">
    <GridView.ItemsPanel>
        <ItemsPanelTemplate>
            <ItemsWrapGrid MaximumRowsOrColumns="8" Orientation="Horizontal" />
@DraconicDragon
DraconicDragon / PNG_SD_prompt_reader.dart
Created September 1, 2023 22:53
Dart script for reading EXIF metadata from AI generated images (prompt info, model, seed, etc.)
// https://dev.exiv2.org/projects/exiv2/wiki/The_Metadata_in_PNG_files
// tEXt chunk: text that can be represented in ISO/IEC 8859-1.
// use exif package instead for jpeg, etc
import 'dart:io';
import 'dart:typed_data';
import 'package:png_chunks_extract/png_chunks_extract.dart' as pngExtract; // i thank that this exists.
void main() {
File file = File('path/to/image.png');
final data = file.readAsBytesSync();
@DraconicDragon
DraconicDragon / FfmpegPostprocess.py
Last active August 8, 2023 00:24 — forked from miabrahams/FfmpegPostprocess.py
FFmpeg auto post-processing OBS script
import datetime
import os
import re
import subprocess
import obspython as obs
# Info for potential OBS Python hackers!
# Tip 1 - Read the "OBS Studio Backend Design" documentation page. Read the documentation table of contents.
# Tip 2 - be sure to add obspython.py to your script path to enable completion.
@DraconicDragon
DraconicDragon / firefox-msedge-scrolling.md
Created June 30, 2023 20:21
Enable Microsoft Edge like scrolling in firefox

change the following values in FireFox's about:config

For snappier faster scrolling

  • general.smoothScroll.currentVelocityWeighting: 0.1
  • general.smoothScroll.stopDecelerationWeighting: 0.75
  • mousewheel.min_line_scroll_amount: 18

For basically edge feel

(sluggish-smoothness when fast scrolling up and down like in edge)

  • mousewheel.min_line_scroll_amount: 24
  • general.smoothScroll.msdPhysics.enabled: true
@DraconicDragon
DraconicDragon / rpi-quick-setup.sh
Created June 19, 2023 10:39
script to install stuff quickly on my pi
#!/bin/bash
echo "Do you want to install dotnet? (y/n)"
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
curl -SL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm64.tar.gz
sudo mkdir -p /usr/share/dotnet
sudo tar -zxf dotnet.tar.gz -C /usr/share/dotnet
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
@DraconicDragon
DraconicDragon / userChrome.css
Last active March 2, 2023 17:23 — forked from wataf1/userChrome.css
Custom Firefox css (TreeStyle Tabs, compact mode)
/* Please forgive my shitty css, I'm not a web dev
Links:
https://www.reddit.com/r/FirefoxCSS/
For live debug: ctrl+alt+shift+i, grant remote permission, StyleEditor > userChrome.css
https://www.reddit.com/r/FirefoxCSS/comments/73dvty/tutorial_how_to_create_and_livedebug_userchromecss/
https://github.com/Timvde/UserChrome-Tweaks/blob/master/tabs/hide-tabs-windows.css
https://www.howtogeek.com/334716/how-to-customize-firefoxs-user-interface-with-userchrome.css/
http://kb.mozillazine.org/index.php?title=UserChrome.css&printable=yes
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Tutorial/Modifying_the_Default_Skin#Customize_with_userChrome.css
https://github.com/piroor/treestyletab/wiki/Code-snippets-for-custom-style-rules#for-version-2x