Skip to content

Instantly share code, notes, and snippets.

View chaiyujin's full-sized avatar
🐼
Focusing

Yuki-Chai chaiyujin

🐼
Focusing
  • Zhejiang University
  • Hangzhou, Zhejiang, China
View GitHub Profile

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Math.md
Last active April 15, 2024 20:34
GLSL Math functions

Trigonometry

const float PI = 3.1415926535897932384626433832795;
const float PI_2 = 1.57079632679489661923;
const float PI_4 = 0.785398163397448309616;

float PHI = (1.0+sqrtf(5.0))/2.0;
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Lights.md
Last active November 16, 2022 01:46
GLSL Shaders Lights Funtions
@galek
galek / pbr.glsl
Created November 4, 2015 11:10
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position
@zhanwenchen
zhanwenchen / Install NVIDIA Driver and CUDA.md
Last active March 13, 2024 23:42 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 9.0 on Ubuntu 16.04.4 LTS
@pachadotdev
pachadotdev / 00-install-intel-mkl-64bit
Last active February 4, 2021 07:59
Install Intel MKL (64 bit) on Ubuntu 17.10
# Option 1: Use apt-get
# keys taken from https://software.intel.com/en-us/articles/installing-intel-free-libs-and-python-apt-repo
cd ~/GitHub/r-with-intel-mkl/
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
sudo apt-get update && sudo apt-get install intel-mkl-64bit
@xeekworx
xeekworx / sdl_nanovg_example.cpp
Last active April 11, 2024 14:34
SDL + GLAD + OpenGL + NanoVG Example in C++
#include <SDL.h>
#include <glad\glad.h>
#include <nanovg.h>
#define NANOVG_GL3_IMPLEMENTATION
#include <nanovg_gl.h>
#include <nanovg_gl_utils.h> // For framebuffer utilities not shown in this code
#include <string>
#include <iostream>
#include <iomanip> // for setw
@chaiyujin
chaiyujin / Install NVIDIA Driver and CUDA.md
Created June 3, 2018 01:52 — forked from zhanwenchen/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 9.0 on Ubuntu 16.04.4 LTS
@rxwei
rxwei / autograd.md
Last active November 26, 2022 10:48
Autograd in Swift

Make Swift AD support all numpy functions via Autograd/JAX

In the Python module:

let autograd = Python.import("jax.grad")

extension PythonObject {
  @differentiable(wrt: args, vjp: _vjpDynamicallyCall)
  @discardableResult
@mkocabas
mkocabas / batch_procrustes_pytorch.py
Created October 9, 2019 12:31
Pytorch batch procrustes implementation
import numpy as np
import torch
def compute_similarity_transform(S1, S2):
'''
Computes a similarity transform (sR, t) that takes
a set of 3D points S1 (3 x N) closest to a set of 3D points S2,
where R is an 3x3 rotation matrix, t 3x1 translation, s scale.
i.e. solves the orthogonal Procrutes problem.
'''