Skip to content

Instantly share code, notes, and snippets.

View KrisYu's full-sized avatar

Xue Yu KrisYu

View GitHub Profile
@scivision
scivision / CMakeLists.txt
Last active April 30, 2024 01:31
OpenMP with CMake
cmake_minimum_required(VERSION 3.19)
project(OpenMPdemo LANGUAGES C)
find_package(OpenMP COMPONENTS C REQUIRED)
add_executable(hello hello_openmp.c)
target_link_libraries(hello PRIVATE OpenMP::OpenMP_C)
@rogue6800
rogue6800 / CameraOrbit.cs
Last active January 7, 2024 23:13
Smooth Mouse Orbit Camera
//Adapted from: https://wiki.unity3d.com/index.php/MouseOrbitImproved
//License: Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
//https://creativecommons.org/licenses/by-sa/3.0/
//Link to demo: https://youtu.be/I_7PyyzziTY
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraOrbit : MonoBehaviour
@rfong
rfong / compile_tags.py
Created May 17, 2021 22:51
Automatic tag-page generator for all post tags on a Jekyll site. See https://rfong.github.io/rflog/2020/02/28/jekyll-tags/
# Filename: __plugins/compile_tags.py
'''
This script generates tag pages for all your post tags for a
Jekyll site. It is invoked from a plugin after post_write.
Run it from the project root if testing.
Convention expected here for tag names is r/[-\w\d]+/
'''
import glob
@rubyandcoffee
rubyandcoffee / Ruby with chruby
Last active February 23, 2024 11:34
chruby - Installing and managing Ruby versions
To install chruby and ruby-install:
brew install chruby ruby-install
To install Ruby using ruby-install:
ruby-install ruby 2.7.1
NOTE: You can find latest stable version of Ruby here: https://www.ruby-lang.org/en/downloads/
If you have issues installing Ruby then try the following:
brew install openssl@3
ruby-install 3.2.2 -- --with-openssl-dir=$(brew --prefix openssl@3)
@caseywatts
caseywatts / 0-self-publishing.md
Last active May 14, 2024 02:03
Self-Publishing via Markdown
@scottgarner
scottgarner / WebSocketBridge.cs
Created April 18, 2019 04:59
Unity WebSocket Bridge using System.Net.WebSockets
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Net.WebSockets;
using UnityEngine;
@jeasinema
jeasinema / delaunay.py
Last active August 21, 2020 05:36
A python implementation of delaunay algorithm
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
# File Name : face_morphing.py
# Creation Date : 04-04-2018
# Created By : Jeasine Ma [jeasinema[at]gmail[dot]com]
import cv2
import json
import numpy as np
@akey7
akey7 / numpy_array_to_wav_file.py
Created March 31, 2018 02:55
Generate a .wav sound file from a NumPy array.
import numpy as np
from scipy.io.wavfile import write
# Samples per second
sps = 44100
# Frequency / pitch of the sine wave
freq_hz = 440.0
# Duration
@hashaam
hashaam / get-filename-without-extension.swift
Last active March 22, 2019 10:11
Get filename without extension
// https://hashaam.com/2017/09/02/get-filename-without-extension
let path = "hls_a128_v4.m3u8"
let url = URL(string: path)
let filename = url?.deletingPathExtension().lastPathComponent
print(filename) // hls_a128_v4
let fileExtension = url?.pathExtension