Skip to content

Instantly share code, notes, and snippets.

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

Hugefiver hugefiver

😴
Moing (🐟)
  • CSUST
  • China
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 January 26, 2025 16:37 — 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 April 26, 2025 16:59
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

This downloads standalone 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 native desktop app development.

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

You can list available versions with py.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 first run setup_TARGET.bat - after that PATH/INCLUDE/LIB env variables will be updated 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).

@nitred
nitred / optimal_mtu.md
Last active April 24, 2025 19:08
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@journey-ad
journey-ad / oh-my-diana.user.js
Last active January 20, 2025 22:36
在哔站右下角添加嘉然小姐的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