Skip to content

Instantly share code, notes, and snippets.

View fundon's full-sized avatar
🎯
Focusing

Fangdun Tsai fundon

🎯
Focusing
View GitHub Profile
@fundon
fundon / ClosestPointOnEllipse.cs
Created June 17, 2024 00:43 — forked from JohannesMP/ClosestPointOnEllipse.cs
[C#, Unity3D] Quickly find the closest point on an ellipse centered on the origin.
using UnityEngine;
using Math = System.Math;
public static class NearestPointTo
{
/// <summary>
/// Find the closest point on an ellipse centered on the origin.
/// </summary>
/// Credit:
/// 2015-09 Original Paper by Luc. Maisonobe https://www.spaceroots.org/documents/distance/distance-to-ellipse.pdf
@fundon
fundon / README.md
Created August 6, 2021 14:25 — forked from ctsrc/README.md
How to run FreeBSD 13.0-BETA1 for ARM64 in QEMU on Apple Silicon Mac (MacBook Pro M1, etc)
@fundon
fundon / Documentation.md
Created July 5, 2017 08:13 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs

OpenVPN on Ubuntu 12.10 at DigitalOcean

Install OpenVPN

sudo apt-get install openvpn

Generate Server Certificates

sudo cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa2

cd /etc/openvpn/easy-rsa2

fj() {
pbpaste | python -mjson.tool | pygmentize -f terminal256 -l javascript -O style=native
}
@fundon
fundon / tmux-iterm2.rb
Last active December 15, 2015 00:39 — forked from halcyon/tmux-iterm2.rb
require 'formula'
class TmuxIterm2 < Formula
url 'http://iterm2.googlecode.com/files/iTerm2-1_0_0_20130310.zip'
sha1 '2f927c6b963820c4161306be1392391712d15464'
head 'git://tmux.git.sourceforge.net/gitroot/tmux/tmux'
depends_on 'pkg-config' => :build
depends_on 'libevent'
@fundon
fundon / rAF.js
Created March 12, 2013 13:53 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
# Add speex, for Red5
brew edit ffmpeg
args << "--enable-libspeex" if Formula.factory('speex').installed?
brew install --use-gcc ffmpeg
# H.264 / ACC
ffmpeg -i video.flv -acodec libfaac -ab 19k -ar 16000 -vsync 1 -async 1 -r 25.0 -b 193k -vcodec libx264 -s 420x340 video.mp4
# VP8 / Vorbis
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software.
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module
# This module "secure-link" helps you to protect links from stealing away.
#
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.2.tar.gz
$ tar xzvf ./nginx-1.2.2.tar.gz && rm -f ./nginx-1.2.2.tar.gz