Skip to content

Instantly share code, notes, and snippets.

View deckar01's full-sized avatar

Jared Deckard deckar01

View GitHub Profile
@deckar01
deckar01 / github-dark-colorblind-zen.css
Last active October 30, 2021 21:52
GitHub Dark Colorblind Zen
.blob-code-hunk {
/* background-color: var(--color-accent-subtle); */
border: 1px solid var(--color-btn-bg);
}
.blob-num-hunk, .blob-num-expandable {
/* background-color: var(--color-accent-muted); */
background-color: var(--color-btn-bg);
}
@deckar01
deckar01 / prusa_notify.py
Last active May 27, 2024 17:33
Send push notifications when a Prusa printer needs attention
import datetime
import requests
import time
from tqdm import tqdm
class PrintMonitor:
# !!! ADD CONFIGURATION !!! #
# See https://help.prusa3d.com/guide/wi-fi-and-prusalink-setup-xl-firmware-up-to-4-7-5_419630
@deckar01
deckar01 / ndxl.py
Created December 10, 2024 19:50
NitroDiffusion + One Step Refiner
import torch
from diffusers import LCMScheduler
from diffusers import DiffusionPipeline, UNet2DConditionModel
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
class TimestepShiftLCMScheduler(LCMScheduler):
def __init__(self, *args, shifted_timestep=250, **kwargs):
super().__init__(*args, **kwargs)
@deckar01
deckar01 / bit-depth-density.py
Created June 22, 2025 19:59
Graphing the density distribution of audio bit depth formats
import matplotlib.pyplot as plt
import numpy as np
def bits_to_unit(d, n):
sign = (n >> (d - 1)) & 1
mantissa = n & (2**(d - 1) - 1)
return ((-1) ** sign) * (mantissa / (2 ** (d - 1)))
def bits_to_float32(n):
@deckar01
deckar01 / continuous-float32.py
Created June 29, 2025 23:42
What if float32 had 31 exponent bits and no mantissa?
import matplotlib.pyplot as plt
import numpy as np
def bits_to_float32(n, E=8, M=23):
sign = (n >> (E + M)) & 1
exponent = ((n >> M) & (2 ** E - 1)) - (2 ** (E - 1) - 1)
exponent *= 2 ** (8 - E)
mantissa = n & (2 ** M - 1)
return ((-1) ** sign) * (1 + mantissa / (2 ** M)) * (2 ** exponent)