I hereby claim:
- I am davidfeng on github.
- I am davidfeng (https://keybase.io/davidfeng) on keybase.
- I have a public key ASAVA-RbCz8YZU5tKQt1QuSu7y6cULUvX-fSutmFkKeI7Qo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
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
local print = print | |
local tconcat = table.concat | |
local tinsert = table.insert | |
local srep = string.rep | |
local type = type | |
local pairs = pairs | |
local tostring = tostring | |
local next = next |
import qualified Data.HashSet as HS | |
import Data.Hashable | |
-- 2014-07-25 20:27:29 | |
-- TODO custom HashSet with special ``insert`` ``fromListWith`` ... | |
data Test = A Int | B Double | C Char | D | |
deriving (Show) | |
instance Eq Test where |
import Data.Csv | |
import Control.Monad | |
import Control.Applicative | |
-- 2014-07-24 15:26:22 fail and mzero | |
data Test = A | B | C | |
deriving (Show, Read) | |
instance FromField Test where |
#!/bin/sh | |
# Shell script to install your public key on a remote machine | |
# Takes the remote machine name as an argument. | |
# Obviously, the remote machine must accept password authentication, | |
# or one of the other keys in your ssh-agent, for this to work. | |
ID_FILE="${HOME}/.ssh/id_rsa.pub" | |
if [ "-i" = "$1" ]; then |
{-# 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) |
################ Lispy: Scheme Interpreter in Python | |
## (c) Peter Norvig, 2010; See http://norvig.com/lispy.html | |
################ Symbol, Procedure, Env classes | |
from __future__ import division | |
Symbol = str | |