- 什么是自旋锁 spin lock? 什么是互斥锁? 各有什么特点,应用在何种场景?
- compare and swap (cas)是什么? 原子操作, 编译器(gcc) 固有指令
- 读写锁 (锁定读, 锁定写, 未加锁 3种状态) 共享-独占锁
- 仿射变换 齐次坐标空间
- 贝塞儿曲线 二次/三次 特点 应用 true type, 矢量图, 曲面
| #include <lua.h> | |
| #include <lauxlib.h> | |
| #include <ltable.h> | |
| #include <lstate.h> | |
| #include <lobject.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #define MAGIC_VECTOR 1.23456789 |
| -- copy.lua | |
| -- | |
| -- Lua functions of varying complexity to deep copy tables. | |
| -- | |
| -- 1. The Problem. | |
| -- | |
| -- Here's an example to see why deep copies are useful. Let's | |
| -- say function f receives a table parameter t, and it wants to |
| {-# LANGUAGE DeriveDataTypeable #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE RecordWildCards #-} | |
| import Network.Wai | |
| import Control.Exception (Exception, throwIO, assert) | |
| import Control.Applicative ((<$>)) | |
| import Control.Monad (when, forever, unless) | |
| import Data.Typeable (Typeable) | |
| import Network.HTTP.Types (status200, status404) | |
| import Network.Wai.Handler.Warp (run) |
The following Lua program generates a Lua bytecode program called ignore-unsigned-sga.fnt, which in turn loads a DLL from within an extremely locked down Lua 5.1 sandbox in a program called RelicCOH2.exe. The remainder of this document attempts to explain how this program works by a whirlwind tour of relevent bits of the Lua 5.1 virtual machine.
if string.dump(function()end):sub(1, 12) ~= "\27Lua\81\0\1\4\4\4\8\0" then
error("This generator requires a 32-bit version of Lua 5.1")
end
local function outer()
local magic -- In bytecode, the stack slot corresponding to this local is changed| "also my gist test | |
| "get words count of current line | |
| echo "current line words count : ".len(split(getline("."))) | |
| "Double Pinyin Schema | |
| let s:yunmu={ "iu": "q", "ia": "w", "ua": "w", "e": "e", "uan": "r", "er": "r", "ue": "t", | |
| \ "uai": "y", "v": "y", "u": "u", "i": "i", "uo": "o","o":"o", "un": "p", | |
| \ "a":"a","ong":"s","iong":"s","uang":"d","iang":"d","en": "f","eng":"g", | |
| \ "ang": "h", "an": "j", "ao": "k", "ai":"l", "ing":";", |