Skip to content

Instantly share code, notes, and snippets.

View hugefiver's full-sized avatar
😴
Moing (🐟)

Hugefiver hugefiver

😴
Moing (🐟)
View GitHub Profile
@Anthony-Hoo
Anthony-Hoo / docstring_ast.py
Created June 13, 2024 09:53
Add docstrings to Python files using an OpenAI-compatible API
import ast
import requests
class FunctionExtractor(ast.NodeVisitor):
def __init__(self):
self.functions = []
self.function_calls = []
def visit_FunctionDef(self, node):
function_code = ast.unparse(node)
@sftblw
sftblw / fix_automatic111_merged_ckpt.md
Last active January 25, 2023 07:34
fix convert_original_stable_diffusion_to_diffusers.py for fixing merged models

fix convert_original_stable_diffusion_to_diffusers.py for fixing merged models

To fix broken model (mainly merged weights from AUTOMATIC111's no-licensed UI for Invoke AI ,

one can use CKPT -> HF/diffusers -> CKPT route.

Environment setup

@averad
averad / Stable_Diffusion.md
Last active June 6, 2024 08:42 — forked from harishanand95/Stable_Diffusion.md
Stable Diffusion on AMD GPUs on Windows using DirectML
@harishanand95
harishanand95 / Stable_Diffusion.md
Last active June 6, 2024 08:42
Stable Diffusion on AMD GPUs on Windows using DirectML
@mmozeiko
mmozeiko / !README.md
Last active June 13, 2024 03:16
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

This downloads standalone 64-bit MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for 64-bit native desktop app development.

Run python.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK - currently v14.32.17.2 and v10.0.22621.0.

You can list available versions with python.exe portable-msvc.py --show-versions and then pass versions you want with --msvc-version and --sdk-version arguments.

To use cl.exe/link.exe from output folder, first run setup.bat - after that PATH/INCLUDE/LIB env variables will be setup to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.

To use clang-cl.exe without running setup.bat, pass extra /winsysroot msvc argument (msvc is folder name where output is stored).

@journey-ad
journey-ad / oh-my-diana.user.js
Last active February 26, 2024 07:29
在哔站右下角添加嘉然小姐的live2d模型
// ==UserScript==
// @name #相亲相爱一嘉人#
// @description 在哔站右下角添加嘉然小姐的live2d模型
// @version 1.0.1
// @namespace https://github.com/journey-ad
// @author journey-ad
// @include /^https:\/\/(www|live|space|t)\.bilibili\.com\/.*$/
// @icon https://www.google.com/s2/favicons?domain=bilibili.com
// @license GPL v2
// @run-at document-end
/**
* MySQL Multi-Line Insert
* =======================
* See: https://gist.github.com/ProjectCleverWeb/d2362b082af1d7054ebfd464f202ec1b
*
* Notes:
* - I used a output buffer variable since in most languages variables are
* significantly faster than function calls and in this case the syntax for
* using a variable was both shorter and easier to read.
* - Table & column names are quoted to help improve compatibility, but in most
@Alfex4936
Alfex4936 / Python Sorting Algorithms.py
Last active October 27, 2022 13:39
Python Sorting Algorithms : (TimSort + Introspective Sort + bogo Sort + pancake Sort + Insertion Sort + Binary Insertion Sort + Count Sort + Merge Sort + Quick Sort + Bubble Sort)
import bisect
import heapq
import inspect
from random import randint, shuffle
from statistics import mean
from timeit import default_timer, repeat
import matplotlib.pyplot as plt
from bigO import bigO
from win10toast import ToastNotifier
@djfdyuruiry
djfdyuruiry / README.md
Last active April 28, 2024 08:34
WSL 2 - Enabling systemd

Enable systemd in WSL 2

NOTE: If you have Windows 11 there is now an official way to do this in WSL 2, use it if possible - see MS post here (WINDOWS 11 ONLY)

This guide will enable systemd to run as normal under WSL 2. This will enable services like microk8s, docker and many more to just work during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.

  • To enable systemd under WSL we require a tool called systemd-genie

  • Copy the contents of install-sg.sh to a new file /tmp/install-sg.sh: