Skip to content

Instantly share code, notes, and snippets.

View green-s's full-sized avatar

Sam Green green-s

View GitHub Profile
@IcedMango
IcedMango / vhost.conf
Created November 18, 2021 10:02
Resilio Sync with nginx reverse proxy - v2.7.2(1375) OK
location /btsync/ {
proxy_pass http://127.0.0.1:8888/gui/;
sub_filter '/gui/token.html' 'token.html';
sub_filter '/gui/' '';
sub_filter_types text/javascript
sub_filter_once off;
proxy_set_header Cookie $http_cookie;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@krzys-h
krzys-h / Hyper-V GPU-PV with Linux guest.md
Last active September 16, 2026 02:52
Ubuntu 21.04 VM with GPU acceleration under Hyper-V...?

Ubuntu 21.04 VM with GPU acceleration under Hyper-V...?

Modern versions of Windows support GPU paravirtualization in Hyper-V with normal consumer graphics cards. This is used e.g. for graphics acceleration in Windows Sandbox, as well as WSLg. In some cases, it may be useful to create a normal VM with GPU acceleration using this feature, but this is not officially supported. People already figured out how to do it with Windows guests though, so why not do the same with Linux? It should be easy given that WSLg is open source and reasonably well documented, right?

Well... not quite. I managed to get it to run... but not well.

How to do it?

  1. Verify driver support
@str4d
str4d / DemangleRust.py
Last active March 19, 2025 02:27
Ghidra script for demangling Rust symbols
# Attempts to demangle all mangled symbols in the current program using the Rust
# mangling schemes, and replace the default symbol and function signature
# (if applicable) with the demangled symbol.
#
# License: MIT OR Apache-2.0
#@author Jack Grigg <thestr4d@gmail.com>
#@category Symbol
import string
/*=============================================================================
ReShade 5 effect file
github.com/martymcmodding
Author: Pascal Gilcher / Marty McFly
ReShade Motion Estimation Shader for dense 2D UV-space motion vectors
Based on ReShade Motion Estimation by Jakob Wapenhensch
(https://github.com/JakobPCoder/ReshadeMotionEstimation)
@karpathy
karpathy / stablediffusionwalk.py
Last active September 8, 2026 00:00
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@harishanand95
harishanand95 / Stable_Diffusion.md
Last active August 28, 2026 05:09
Stable Diffusion on AMD GPUs on Windows using DirectML
@trygvebw
trygvebw / generate.py
Last active July 29, 2023 20:01
My Stable Diffusion image generation function. Abbreviated – will not run because of a few missing utility functions and classes.
def normalize_latent(x, max_val, quantile_val):
x = x.detach().clone()
for i in range(x.shape[0]):
if x[[i], :].std() > 1.0:
x[[i], :] = x[[i], :] / x[[i], :].std()
s = torch.quantile(torch.abs(x[[i], :]), quantile_val)
s = torch.maximum(s, torch.ones_like(s) * max_val)
x[[i], :] = x[[i], :] / (s / max_val)
return x
@amishmm
amishmm / ArchOracleCloud.md
Last active September 5, 2026 11:52
Install Arch Linux on Oracle Cloud (Free Tier)

Requirement

  • Console / Cloud Shell access (via https://cloud.oracle.com)
  • Go to the instance page and under Resources -> Console connection -> Launch Cloud Shell connection

Steps

  1. In Ubuntu OR any other Free tier Linux OS
# Download Alpine Linux and install it on disk
cd /
wget https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-virt-3.16.2-x86_64.iso
@lmmx
lmmx / diarise.py
Last active April 2, 2025 02:27
Python commands to create speaker diarisation
# ffmpeg -i foo.m4a foo.wav
from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization")
diarization = pipeline("foo.wav")
# RTTM format https://catalog.ldc.upenn.edu/docs/LDC2004T12/RTTM-format-v13.pdf
with open("foo.rttm", "w") as rttm:
diarization.write_rttm(rttm)
# 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