Skip to content

Instantly share code, notes, and snippets.

View x5lcfd's full-sized avatar
:octocat:
coding.

x5lcfd x5lcfd

:octocat:
coding.
View GitHub Profile
@x5lcfd
x5lcfd / gist:68a8fefc666a4f2d63a7e50c5424e453
Created June 1, 2016 02:31 — forked from BastienClement/gist:b34f14dd93381498a7a1
The CASC (Content Addressable Storage Container) Filesystem
---------------------------------------------------------------------
| The CASC (Content Addressable Storage Container) Filesystem |
| Warlords of Draenor Alpha, Build 6.0.1.18125 |
| Written April 14th, 2014 by Caali |
| Version 1.2 |
---------------------------------------------------------------------
Distribution and reproduction of this specification are allowed without
limitation, as long as it is not altered. Quotation in other works is
freely allowed, as long as the source and author of the quote are stated.
@x5lcfd
x5lcfd / NGUIParticleRenderQueue.cs
Last active October 17, 2016 02:00
NGUIRenderQueue
/*
* This code snippet can adjust the gameobject's renderqueue in NGUI.
*/
using UnityEngine;
[ExecuteInEditMode]
class NGUIParticleRenderQueue : MonoBehaviour
{
public UIPanel panel;
@x5lcfd
x5lcfd / ConvertToChinese.cs
Last active May 3, 2022 20:30
NumberToCn
public static String ConvertToChinese( Decimal number )
{
var s = number.ToString( "#L#E#D#C#K#E#D#C#J#E#D#C#I#E#D#C#H#E#D#C#G#E#D#C#F#E#D#C#.0B0A" );
var d = Regex.Replace( s, @"((?<=-|^)[^1-9]*)|((?'z'0)[0A-E]*((?=[1-9])|(?'-z'(?=[F-L\.]|$))))|((?'b'[F-L])(?'z'0)[0A-L]*((?=[1-9])|(?'-z'(?=[\.]|$))))", "${b}${z}" );
var r = Regex.Replace( d, ".", m => "负元空零壹贰叁肆伍陆柒捌玖空空空空空空空分角拾佰仟万亿兆京垓秭穰"[m.Value[0] - '-'].ToString() );
return r;
}
@x5lcfd
x5lcfd / pure.vim
Last active October 17, 2016 01:59
vim-pure-theme
" from vim.ink
hi clear
syntax reset
let g:colors_name = "pure"
if &background == "light"
hi Boolean gui=bold guifg=#8c8c8c guibg=NONE
hi ColorColumn gui=NONE guifg=NONE guibg=#ffffff
hi Comment gui=italic guifg=#bdbdbd guibg=NONE
hi Conceal gui=NONE guifg=#8c8c8c guibg=NONE
hi Conditional gui=bold guifg=#5c5c5c guibg=NONE
@x5lcfd
x5lcfd / ChangeCoding.py
Last active October 17, 2016 01:59
转换汉字八进制表示方式
# 作者:猴子猴z
# 链接:https://www.zhihu.com/question/26902926/answer/3459777
def ChangeCoding(s):
''' 处理中文文件名的编码 '''
#s='"\\346\\226\\260\\345\\273\\272\\346\\226\\207\\344\\273\\266\\345\\244\\271/\\345\\226\\260\\345\\273\\272\\346\\226\\207\\344\\273\\266\\345\\244\\271/\\346\\226\\260\\345\\273\\272\\346\\226\\207\\346\\234\\254\\346\\226\\207\\346\\241\\243.txt"'
#pattern=re.compile(r'^".*?((\\\d\d\d){3,})(/(?P<s>(\\\d\d\d){3,}))*.+"$')
#match=pattern.match(a)
p=re.compile(r'(?P<s>(\\\d\d\d){3,})')
@x5lcfd
x5lcfd / lua_snippet.json
Last active November 16, 2016 09:39
Lua Snippet for VSCode.
{
"Define a Component": {
"prefix": "defcomp",
"body":[
"local $1 = Lplus.Extend(require \"game/JOWBaseComponent\",\"$1\")",
"local def = $1.define",
"\n",
"def.override().OnInit = function (self)",
"end",
"\n",
@x5lcfd
x5lcfd / MemoryPool.cs
Created November 16, 2016 09:38
简单的内存池
namespace Utils
{
/// <summary>
/// 单线程内存池,请确保在内存池中存储完全可替换的对象,例如如果存储byte[],则长度需完全相同
/// </summary>
/// <typeparam name="T"></typeparam>
public class MemoryPool<T> where T:class
{
public MemoryPool(int maxSize = 10)
{
@x5lcfd
x5lcfd / gpugems.css
Created December 22, 2016 16:53
GPU GEMS Dark Style
/*
url prefix: https://developer.nvidia.com/gpugems/
*/
.white-background {
background-color: #000;
}
.row > .col-md-8 > p {
color: white;
@x5lcfd
x5lcfd / latency.txt
Created February 1, 2017 03:17 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD

ADD_SUBDIRECTORY 用于向当前工程添加存放源文件的子目录,并可以指定中间二进制和目标二进制存放的位置.

换个地方保存目标二进制

不论是 SUBDIRS 还是 ADD_SUBDIRECTORY 指令(不论是否指定编译输出目录),我们均可以通过 SET 指令重新定义 EXECUTABLE_OUTPUT_PATHLIBRARY_OUTPUT_PATH 变量来指定最终的目标二进制位置.

SET (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)