Skip to content

Instantly share code, notes, and snippets.

View earthbound19's full-sized avatar
🚀
creative coding, aiming for Art Blocks

Alex Hall earthbound19

🚀
creative coding, aiming for Art Blocks
View GitHub Profile
@dfaker
dfaker / alternate_sampler_noise_schedules.py
Last active April 3, 2024 09:16
Alternate sampler noise schedules for stable-diffusion-webui
import inspect
from modules.processing import Processed, process_images
import gradio as gr
import modules.scripts as scripts
import k_diffusion.sampling
import torch
class Script(scripts.Script):
@mattdesl
mattdesl / cli.js
Created September 13, 2022 10:37
colour palette from text prompt using Stable Diffusion https://twitter.com/mattdesl/status/1569457645182152705
/**
* General-purpose NodeJS CLI/API wrapping the Stable-Diffusion python scripts.
*
* Note that this uses an older fork of stable-diffusion
* with the 'txt2img.py' script, and that script was modified to
* support the --outfile command.
*/
var { spawn, exec } = require("child_process");
var path = require("path");
@trygvebw
trygvebw / find_noise.py
Last active March 11, 2024 12:50
A "reverse" version of the k_euler sampler for Stable Diffusion, which finds the noise that will reconstruct the supplied image
import torch
import numpy as np
import k_diffusion as K
from PIL import Image
from torch import autocast
from einops import rearrange, repeat
def pil_img_to_torch(pil_img, half=False):
image = np.array(pil_img).astype(np.float32) / 255.0

Note: this content is reposted from my old Google Plus blog, which disappeared when Google took Plus down. It was originally published on 2016-05-18. My views and the way I express them may have evolved in the meantime. If you like this gist, though, take a look at Leprechauns of Software Engineering. (I have edited minor parts of this post for accuracy after having a few mistakes pointed out in the comments.)

Degrees of intellectual dishonesty

In the previous post, I said something along the lines of wanting to crawl into a hole when I encounter bullshit masquerading as empirical support for a claim, such as "defects cost more to fix the later you fix them".

It's a fair question to wonder why I should feel shame for my profession. It's a fair question who I feel ashamed for. So let's drill a little deeper, and dig into cases.

Before we do that, a disclaimer: I am not in the habit of judging people. In what follows, I only mean to condemn behaviours. Also, I gath

@mattdesl
mattdesl / README.md
Last active November 18, 2021 13:14
seedable PRNG from hash
@rdixon22
rdixon22 / artblocks_page_template.html
Last active March 14, 2021 04:14
Here's a simple web page template to use for testing an artblocks.io project. It generates a random hash and token ID each time the page reloads. It assumes a p5.js project (pulling that from a CDN to limit dependencies). Your project code goes in myproject.js.
<!DOCTYPE html>
<html lang="en">
<head>
<script>
// Generates a random hash and token id each time you reload, in the following format
//let tokenData = {"hash":"0xd9134c11cd5ed9798ea0811364d63bd850c69c5d13383c9983ade39847e9ea86","tokenId":"99000000"};
function genTokenData(projectNum)
{
let data = {};
@rogerallen
rogerallen / 0_tweegeemee.txt
Last active August 21, 2021 16:06
tweegeemee archive 10/19/2019
Archive of the code for images posted to https://twitter.com/tweegeemee
Started October 19, 2019
:clisk-random-seed 191019
Learn more at https://github.com/rogerallen/tweegeemee
@tobias93
tobias93 / gist:3f9b516bc2e67eea1e0fa255cf99b824
Created October 28, 2016 12:29
Simple Slither.io bot
// ==UserScript==
// @name Slither Bot
// @namespace http://slither.io/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://slither.io/
// @grant none
// ==/UserScript==
@morgyface
morgyface / functions_crop-images.php
Last active January 31, 2024 10:29
WordPress | Create checkboxes on Settings > Media which crop medium and large image sizes.
// Add crop options for medium and large images to dashboard > settings > media.
function crop_settings_api_init() {
// Add the section to media settings
add_settings_section(
'crop_settings_section',
'Crop images',
'crop_settings_callback_function',
'media'
);
// Add the fields to the new section