Skip to content

Instantly share code, notes, and snippets.

@zhaozg
zhaozg / Makefile
Created September 2, 2014 01:40
detect lua lib in Makefile
exist = $(shell pkg-config --exists luajit; if [ $?=0 ]; then echo "exist"; else echo "notexist"; fi;)
ifeq ($(exist), exist)
override CFLAGS += $(shell pkg-config luajit --cflags)
override LFLAGS += $(shell pkg-config luajit --libs)
else
exist = $(shell pkg-config --exists lua; if [ $?=0 ]; then echo "exist"; else echo "notexist"; fi;)
ifeq ($(exist), exist)
override CFLAGS += $(shell pkg-config lua --cflags)
override LFLAGS += $(shell pkg-config lua --libs)
endif
@zhaozg
zhaozg / template_ldoc.lua
Last active August 29, 2015 14:07
template with ldco.lua
------------
-- Title module.
-- Description can continue after simple tags, if you
-- like - but to keep backwards compatibility, say 'not_luadoc=true'
-- @module four
-- @author bob, james
-- @license MIT
-- @copyright InfoReich 2013
-- @usage
@zhaozg
zhaozg / test_srv.lua
Created October 11, 2014 07:58
luv_test_srv.lua
local uv = require'luv'
local os, string = os, string
local print = print
io.read()
local host = arg[1] or '127.0.0.1'
local port = arg[2] and tonumber(arg[2]) or 8080
local bps, concurrent, count, total_bytes = 0, 0, 0, 0
@zhaozg
zhaozg / test_cli.lua
Created October 11, 2014 08:00
luv_test_cli.lua
local uv = require('luv')
local os = os
local print = print
---timer----------
local function time_tick(ms, on_timer)
uv.timer_start(uv.new_timer(), ms, ms, on_timer)
end
@zhaozg
zhaozg / lpegxml.lua
Last active August 29, 2015 14:12 — forked from aperezdc/lpegxml.lua
--
-- LPeg-based XML parser.
--
-- * Grammar term names are the same as in the XML 1.1
-- specification: http://www.w3.org/TR/xml11/
-- * Action functions are missing.
--
-- Copyright (C) 2012 Adrian Perez <aperez@igalia.com>
-- Distribute under terms of the MIT license.
--
@zhaozg
zhaozg / indent.Makefile
Created January 28, 2015 09:24
build gnu ident with mingw on windows
#
# Simple makefile to make indent on win32 systems.
# Requires:
# - gcc (mingw32)
# - Unixlike make (preferably gmake)
#
# Sudhi Herle (sherle@sta.samsung.com)
#
@zhaozg
zhaozg / pfx.java
Created March 31, 2015 01:54
java privatekey certificate pfx
/**
* @(#)文本1.java
*
*
* @author
* @version 1.00 2015/3/31
*/
import java.security.PrivateKey;
import java.io.*;
import java.security.*;
@zhaozg
zhaozg / nasm.props
Created April 29, 2015 03:45
nasm.props for visualstudio 2012
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup
Condition="'$(NASMBeforeTargets)' == '' and '$(NASMAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
<NASMBeforeTargets>Midl</NASMBeforeTargets>
<NASMAfterTargets>CustomBuild</NASMAfterTargets>
</PropertyGroup>
<ItemDefinitionGroup>
<NASM>
<OutputFormat>$(IntDir)%(FileName).obj</OutputFormat>
@zhaozg
zhaozg / nasm.targets
Created April 29, 2015 03:46
nasm.targets for visualstudio 2012
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema
Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName Include="NASM">
<Targets>_NASM</Targets>
</AvailableItemName>
</ItemGroup>
<PropertyGroup>
@zhaozg
zhaozg / nasm.xml
Created April 29, 2015 03:47
nasm.xml for visualstudio 2012
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib">
<Rule
Name="NASM"
PageTemplate="tool"
DisplayName="Netwide Assembler"
Order="200">
<Rule.DataSource>
<DataSource
Persistence="ProjectFile"