Skip to content

Instantly share code, notes, and snippets.

View terbo's full-sized avatar
💭
everybody must get annointed

CB terbo

💭
everybody must get annointed
View GitHub Profile
@zer0TF
zer0TF / convert_to_safe.py
Created November 28, 2022 04:53
Convert all CKPT files to SAFETENSOR files in a directory
# Got a bunch of .ckpt files to convert?
# Here's a handy script to take care of all that for you!
# Original .ckpt files are not touched!
# Make sure you have enough disk space! You are going to DOUBLE the size of your models folder!
#
# First, run:
# pip install torch torchsde==0.2.5 safetensors==0.2.5
#
# Place this file in the **SAME DIRECTORY** as all of your .ckpt files, open a command prompt for that folder, and run:
# python convert_to_safe.py
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint.
# *Only* converts the UNet, VAE, and Text Encoder.
# Does not convert optimizer state or any other thing.
# Written by jachiam
import argparse
import os.path as osp
import torch
@Anubhav1603
Anubhav1603 / examples.md
Last active October 22, 2023 03:02
Code examples of discord.py rewrite

discord.py code examples

Preface

Introduction

I am making this gist to show some examples of stuff you can do with discord.py, and also because the amount of up-to-date examples online is rather limited.

This will not be a guide for learning how to use the basics of the wrapper, but merely showing some code to get a better understanding of some of the things discord.py can do. I will therefore assume that anybody looking at this will understand the basics of both python and the wrapper in question.

I will also assume that asyncio, discord.ext commands and discord are installed and imported, and that the commands.Bot instance is stored in the variable bot.

@kfish
kfish / cherrypy-websockets-monitor.py
Last active March 8, 2019 23:37
A cherrypy websockets server to broadcast, eg. for system monitoring
# To use this, you need to implement some class with a read() method, eg.
#
# class MyReader(object):
# def __init__(self, path):
# self.path = path
#
# def read(self):
# with open(self.path, 'r') as f:
# return f.read()
# ...
@mbostock
mbostock / .block
Last active January 3, 2022 06:02
Sleep Cycles
license: gpl-3.0
@mbostock
mbostock / .block
Created March 29, 2016 20:47
Voronoi Spirals III
height: 960
license: gpl-3.0
@mbostock
mbostock / .block
Created March 29, 2016 17:49
Voronoi Spirals II
height: 960
license: gpl-3.0
@mbostock
mbostock / .block
Last active March 10, 2019 23:18
Voronoi Spirals
height: 960
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/voronoi-spirals
@mbostock
mbostock / .block
Last active April 23, 2020 23:35
Rainbow Pack
license: gpl-3.0
height: 960
redirect: https://observablehq.com/@mbostock/rainbow-pack
@iMilnb
iMilnb / getmonit.py
Last active February 11, 2022 08:24
Fetch monit XML status URL content, transform it to JSON and display a status report
#!/usr/bin/env python
import requests
import xmltodict
import json
import os
import sys
with open('{0}/.getmonitrc'.format(os.path.expanduser('~'))) as f:
cf = json.loads(f.read())