Skip to content

Instantly share code, notes, and snippets.

View fireyang's full-sized avatar

FireYang fireyang

View GitHub Profile
@fireyang
fireyang / Bezier3D.js
Created November 22, 2018 02:13 — forked from sketchpunk/Bezier3D.js
Bezier Spline and Arc Length
import Vec3 from "/fungi/maths/Vec3.js";
class Bezier{
static get(p0, p1, p2, p3, t, out){
let i = 1 - t,
ii = i * i,
iii = ii * i,
tt = t * t,
ttt = tt * t,
iit3 = 3 * ii * t,
@fireyang
fireyang / _service.md
Created September 27, 2017 03:20 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@fireyang
fireyang / xml_parsing_test.exs
Created July 4, 2016 17:55 — forked from developerworks/xml_parsing_test.exs
在Elixir中解析XML文档
defmodule XmlParsingTest do
@moduledoc """
从xmerl模块头文件中提取XML元素记录
我们要提取的两个记录在xmerl.hrl中的定义分别为
- xmlElement
```
-record(xmlElement,{
name, % atom()
expanded_name = [], % string() | {URI,Local} | {"xmlns",Local}
nsinfo = [], % {Prefix, Local} | []
@fireyang
fireyang / install-tmux
Last active April 23, 2016 09:31 — forked from rothgar/install-tmux
Install tmux 1.9 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
@fireyang
fireyang / install.sh
Created November 25, 2015 04:01 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@fireyang
fireyang / auth.go
Last active August 29, 2015 14:25 — forked from landaire/auth.go
package controllers
import (
"encoding/base64"
"errors"
"github.com/robfig/revel"
"net/http"
"strings"
)
[Names]
count=1
name0=Solarized Dark
[Solarized Dark]
text(bold)=839496
magenta(bold)=6c71c4
text=00ff40
white(bold)=fdf6e3
green=859900
red(bold)=cb4b16
apt-get install devscripts build-essential
apt-get build-dep golang-go
wget http://ftp.us.debian.org/debian/pool/main/g/golang/golang_1.3.1-1.dsc
wget http://ftp.us.debian.org/debian/pool/main/g/golang/golang_1.3.1.orig.tar.gz
wget http://ftp.us.debian.org/debian/pool/main/g/golang/golang_1.3.1-1.debian.tar.xz
dpkg-source -x golang_1.3.1-1.dsc
cd golang-1.3.1/
debuild -us -uc
@fireyang
fireyang / D.cs
Last active August 29, 2015 14:08 — forked from onevcat/D.cs
#define DEBUG_LEVEL_LOG
#define DEBUG_LEVEL_WARN
#define DEBUG_LEVEL_ERROR
using UnityEngine;
using System.Collections;
// setting the conditional to the platform of choice will only compile the method for that platform
//Workaround for Unity game slowing in iPhone4 + 7.1
//Write in main.mm
#include <pthread.h>
#include <dlfcn.h>
typedef int (*pthread_create_f)(pthread_t * __restrict, const pthread_attr_t * __restrict, void *(*)(void *), void * __restrict);
static pthread_create_f real_create = NULL;
extern "C" int pthread_create(pthread_t * __restrict thread, const pthread_attr_t * __restrict attr, void *(*start)(void *), void * __restrict arg)