Skip to content

Instantly share code, notes, and snippets.

@zhangjun
zhangjun / gpu_compiler.m
Created December 9, 2021 03:13 — forked from marysaka/gpu_compiler.m
Simple program to compile a given Metal file into a device specific dynamic Metal library (GPU code)
// clang gpu_compiler.m -fobjc-arc -fmodules -mmacosx-version-min=11.0 -framework Foundation -framework CoreGraphics -o gpu_compiler
#import <Foundation/Foundation.h>
#import <Metal/Metal.h>
void compile_to_gpu_code(id<MTLDevice> device, NSString *programString, NSString *destinationPath) {
NSError *error;
MTLCompileOptions *options = [MTLCompileOptions new];
options.libraryType = MTLLibraryTypeDynamic;
options.installName = [NSString stringWithFormat:@"@executable_path/userCreatedDylib.metallib"];
@zhangjun
zhangjun / how-to-install-latest-gcc-on-ubuntu-lts.txt
Created December 19, 2021 03:53 — forked from application2000/how-to-install-latest-gcc-on-ubuntu-lts.txt
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@zhangjun
zhangjun / py2_SimpleHTTPServerWithUpload.py
Created June 2, 2022 07:27 — forked from sparkydogX/py2_SimpleHTTPServerWithUpload.py
在SimpleHTTPServer中加入上传功能
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.2"
__all__ = ["SimpleHTTPRequestHandler"]
@zhangjun
zhangjun / best.md
Created February 21, 2024 03:40 — forked from AshtakaOOf/best.md
Best Anime SD Models SDv1/SDXL

My current favorite SD models

Warning

To access the discord post links please join the TouhouAI (24k members) discord server.

WIP