Skip to content

Instantly share code, notes, and snippets.

# coding: utf-8
import web
urls = (
'/hello/(.*)', 'Hello',
'/upload', 'Upload',
'/list', 'List',
'/getimage/(.*)', 'GetImage',
)
filedir = './upload'
#!/bin/sh
LUA_PATH="/usr/local/share/lua/5.1//?.lua;/usr/local/share/lua/5.1//?/init.lua;/root/.luarocks/share/lua/5.1//?.lua;/root/.luarocks/share/lua/5.1//?/init.lua;/usr/local/share/lua/5.1//?.lua;/usr/local/share/lua/5.1//?/init.lua;/usr/local/share/lua/5.1//?.lua;/usr/local/share/lua/5.1//?/init.lua;./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua;$LUA_PATH"
LUA_CPATH="/usr/local/lib/lua/5.1//?.so;/root/.luarocks/lib/lua/5.1//?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;$LUA_CPATH"
export LUA_PATH LUA_CPATH
exec "/usr/bin/lua" -lluarocks.loader "/usr/local/lib/luarocks/rocks/wsapi-xavante/1.4-1/bin/wsapi" "$@"
module(..., package.seeall)
-- Source: http://keplerproject.github.com/wsapi/manual.html
function run(wsapi_env)
local headers = { ["Content-type"] = "text/html" }
local function hello_text()
local testStr = "aabb"
local testStr2 = "ccdd"
@saga
saga / gist:748095
Created December 20, 2010 06:36
stack calling conversion
#include <stdio.h>
int main (int argc, char *argv[])
{
int a = 99;
int b = a;
int* pLocala = NULL;
int* pLocalb = NULL;
int d = 1;
@saga
saga / gist:748098
Created December 20, 2010 06:38
local variable address
#include <stdio.h>
int main (int argc, char *argv[])
{
int a = 99;
int b = a;
int* pLocala = NULL;
int* pLocalb = NULL;
int d = 1;
; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01
TITLE C:\Documents and Settings\sun\my documents\visual studio 2010\Projects\aabb\aabb\aabb.cpp
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES
// public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
class CFromList : List<int>{}
// public class ArrayList : IList, ICollection, IEnumerable, ICloneable
class CFromArrayList : ArrayList{}
public partial class Form1 : Form
{
private void button1_Click(object sender, EventArgs e)
{
using System;
using System.Runtime.InteropServices;
class HighResolutionTimer
{
private bool isPerfCounterSupported = false;
private Int64 frequency = 0;
// Windows CE native library with QueryPerformanceCounter().
[DllImport("kernel32.dll", SetLastError = true)]
@saga
saga / Reactive Extension 学习
Created May 16, 2011 05:19
Reactive Extension 学习
http://blogs.msdn.com/b/rxteam/
http://www.codeproject.com/KB/Parallel_Programming/RxByExample.aspx
http://msdn.microsoft.com/en-us/data/gg577609
http://stackoverflow.com/questions/1969036/reactive-extensions-rx-and-asynchronous-class
Using dotnet4.0 needs some modifications !! Follow me.
1,Observer模式
http://msdn.microsoft.com/en-us/library/dd990377(VS.100).aspx
@saga
saga / gist:1064999
Created July 5, 2011 14:57
wcf client using WSHttpBinding and Channel
public string HelloWorld()
{
// workable
WSHttpBinding binding = new WSHttpBinding();
EndpointAddress address = new EndpointAddress("http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/");
IService1 proxy = ChannelFactory<IService1>.CreateChannel(binding, address);
using (proxy as IDisposable)
{
proxy.GetData(99);
}