Skip to content

Instantly share code, notes, and snippets.

View zzilch's full-sized avatar

Zeyu Huang zzilch

View GitHub Profile
@zzilch
zzilch / update-gcc.md
Created September 21, 2023 12:00 — forked from cobaohieu/update-gcc.md
update-alternatives for gcc on Ubuntu

Run the following commands as root or user with sudo access to update the packages list and install the prerequisites: To install the Development Tools packages, run the following command as root or user with sudo privileges :

$ sudo apt update
$ sudo apt-get upgrade -y
$ sudo apt-get dist-upgrade -y
$ sudo apt-get install build-essential software-properties-common manpages-dev -y
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
$ sudo apt-get update -y
@zzilch
zzilch / ScreenRecorder.cs
Created November 23, 2021 02:33 — forked from DashW/ScreenRecorder.cs
ScreenRecorder - High Performance Unity Video Capture Script
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
class BitmapEncoder
{
public static void WriteBitmap(Stream stream, int width, int height, byte[] imageData)
@zzilch
zzilch / ConcaveHull.py
Created January 12, 2021 12:27 — forked from AndreLester/ConcaveHull.py
Fast concave hull implementation in Python.
'''
Copyright (C) 2018 Andre Lester Kruger
ConcaveHull.py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
ConcaveHull.py is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@zzilch
zzilch / robot.js
Created August 29, 2020 09:48
Siggraph 2020 Technical Paper Robot
// https://s2020.siggraph.org/conference/program-events/technical-papers/
host = window.location.host
sessions = []
sRows = jQuery('.presentation-row')
sRows.each(function(idx,row){
areas = []
keywords = []
jRow = jQuery(row)
@zzilch
zzilch / headless-nvidia.md
Last active October 21, 2023 09:03
headless-nvidia

Headless Rendering

1. 使用 X11-Forwarding + VirtualGL 转发图形界面

Virtual GL 介绍:当我们使用 ssh X11 forward 时,本地需要安装 X Server 如 Window 的 XMing(MobaXterm自带),服务器作为 X Client 发送渲染指令到本地的 X Server,本地 X Server 调用本地的 OpenGL 库渲染图像。该方法使用的是本地 GPU,并且仅有限支持 opengl,当运行图形功能较为复杂的软件时效率较低。 Virual GL 则能作为一个代理使用服务器的 OpenGL 在服务器端进行渲染,然后将渲染结果转发到本地 X Server。安装 Virtual GL 后运行 vglserver_config 配置 Virtual GL 代理,然后在 ssh -X 的环境下使用 vglrun xxx 进行服务端渲染。 但如果要运行图形软件,Virtual GL需要将每帧传输到比本地,需要较好的网络环境。

2. 使用 GPU 加速的 Headless Rendering 建立虚拟桌面环境

  1. 安装lightdm和mate-desktop

这一步的目的是安装一个和N卡驱动的OpenGL库不冲突的桌面管理器和桌面环境 推荐使用Mate(在Ubuntu 20.04/18.04/16.04均通过测试)

@zzilch
zzilch / Remote Desktop.sh
Last active August 3, 2020 12:52
Remote Desktop
####################
1. Install Xrdp
####################
# x remote desktop protocol: for rdp connection
sudo apt install xrdp
# now try connect to the server using rdp tools like windows mstsc or mobaxterm
# then xrdp will create xrdp.ini and sesman.ini in /etc/xrdp
# when we login we will get a blank desktop
@zzilch
zzilch / grid_sample.py
Last active July 24, 2023 07:26
torch.nn.function.grid_sample
import torch
input = torch.tensor([1,2,3,4]).view(1,1,2,2).float()
"""
Array:A[row,col]=p: H x W -> C
Image:I(x,y)=p: W x H -> C
or [0,1]^2 -> C
or [-1,1]^2 -> C
0.....W
.|1|2|
.|3|4|
@zzilch
zzilch / Windows-Terminal-Settings.md
Last active September 28, 2019 07:09
Windows-Terminal-Settings

Windows-Terminal-Settings

Regedit Import:

Create %USERPROFILE%\\AppData\\Local\\terminal\\wt.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="Windows terminal here"
"Icon"="%USERPROFILE%\\AppData\\Local\\terminal\\wt_32.ico"
@zzilch
zzilch / free-ss-parser.js
Last active September 18, 2019 12:01
free-ss-parser
// ==UserScript==
// @name free-ss-parser
// @namespace https://gist.github.com/zzilch/f55210e96b659d90cd1b9165ca5c9a8d
// @version 0.1
// @description parse free-ss server to ss-link
// @author zzilch
// @match http://free-ss.site/*
// @grant GM_setClipboard
// @run-at context-menu
// ==/UserScript==