Skip to content

Instantly share code, notes, and snippets.

View spin6lock's full-sized avatar

John Luk spin6lock

View GitHub Profile
View main.lua
local list = {}
local v_map = {}
local count = 20
local function gen_data()
for i=1,count do
local r = math.random(1, 100)
list[i] = {objid=r}
v_map[r] = r
spin6lock / xls2lua_pool.diff
Created August 13, 2018 09:16
View xls2lua_pool.diff
diff !10017
< from multiprocessing import Pool
< from functools import partial
< def wrap_conv_xls(args, file_names_):
< convet_xls_file(args[0], args[1], file_names_=file_names_)
< p = Pool(8)
spin6lock / xml_diff.lua
Created November 20, 2017 08:31 — forked from luxuia/xml_diff.lua
View xml_diff.lua
#! /usr/bin/env lua
--1. git config diff.xml_diff.textconv xml_diff.lua
---- file: .git/config
---- [diff "xml_diff"]
---- textconv = xml_diff.lua
--2. file: .gitattributes]
---- *.xml diff=xml_diff
spin6lock / gist:62fa67397ba5049b78bb
Created September 1, 2014 11:50
A simple echo server
View gist:62fa67397ba5049b78bb
#!/usr/bin/env python
A simple echo server
import socket
host = ''
port = 50000
spin6lock / xcode_compile_error.log
Created May 29, 2013 02:40
quick-cocos2dx LuaHostMac compile error
View xcode_compile_error.log
This file has been truncated, but you can view the full file.
Build Preparation
Dependency cycle for target 'LuaHostMac' detected: LuaHostMac -> LuaHostMac
Build target libquickcocos2dx
ProcessPCH /Users/MobileGame/Library/Developer/Xcode/DerivedData/LuaHostMac-certifysiadpjhbqxeskvaiuofpk/Build/Intermediates/PrecompiledHeaders/libquickcocos2dx-ambgnlepjrpfnzgpszalouayuxqz/libquickcocos2dx.pch.pth libquickcocos2dx.pch normal i386 c
cd /Users/MobileGame/Work/quick-cocos2d-x/lib/proj.mac
spin6lock / compile_error.log
Created May 27, 2013 09:16
compile error on native code integrating
View compile_error.log
/Users/mobileGame/Work/quick-cocos2d-x/lib/ In function 'int tolua_Cocos2d_CCTMXMapInfo_getTileProperties00(lua_State*)':
/Users/mobileGame/Work/quick-cocos2d-x/lib/ error: invalid conversion from 'void*' to 'int' [-fpermissive]
/Users/mobileGame/Work/quick-cocos2d-x/lib/ error: cannot convert 'char const*' to 'int*' for argument '3' to 'int toluafix_pushusertype_ccobject(lua_State*, int, int*, void*, char const*)'
/Users/mobileGame/Work/quick-cocos2d-x/lib/ In function 'int tolua_Cocos2d_CCTMXMapInfo_formatWithTMXFile00(lua_State*)':
/Users/mobileGame/Work/quick-cocos2d-x/lib/ error: invalid conversion from 'void*' to 'int' [-fp
spin6lock / gdb_bt.log
Created May 10, 2013 07:09
cocos-2dx HelloLua demo core dump
View gdb_bt.log
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/".
Core was generated by `./HelloLua'.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007fea6fbc5c82 in cocos2d::CCGLProgram::initWithVertexShaderByteArray (this=0x21e9900,
vShaderByteArray=0x7fea6fce18f8 '\t' <repeats 13 times>, "\nattribute vec4 a_position;\t\t\t\t\t\t\t\nattribute vec2 a_texCoord;\t\t\t\t\t\t\t\nattribute vec4 a_color;\t\t\t\t\t\t\t\t\n", '\t' <repeats 13 times>, "\n#ifdef GL_ES\t\t\t\t\t\t\t\t\t\t\nvarying lowp vec4 v_fragmentColor;\t\t\t\t\t\nvarying m"...,
fShaderByteArray=0x7fea6fce1b00 '\t' <repeats 11 times>, "\n#ifdef GL_ES\t\t\t\t\t\t\t\t\nprecision lowp float;\t\t\t\t\t\t\n#endif\t\t\t\t\t\t\t\t\t\t\n", '\t' <repeats 11 times>, "\nvarying vec4 v_fragmentColor;\t\t\t\t\nvarying vec2 v_texCoord;\t\t\t\t\t\nuniform sampler2D CC_Texture0;\t\t\t\t\n", '\t' <repeats 11 time
spin6lock /
Last active October 14, 2015 01:08
a simple tool to gen report from two OBJ_DUMP snapshot
def analyze(filename):
statics = {}
with open(filename) as fh:
for line in fh:
infos = line.split()
obj_name, obj_size, _, refs = infos[0:4]
statics[obj_name] = [int(refs), int(obj_size)]
return statics
spin6lock / psd_hater.txt
Created November 8, 2012 02:38
why PSD is a bad format[by Xee] translated to Chinese[working on it]
View psd_hater.txt
// At this point, I'd like to take a moment to speak to you about the Adobe PSD format.
// PSD is not a good format. PSD is not even a bad format. Calling it such would be an
// insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having
// worked on this code for several weeks now, my hate for PSD has grown to a raging fire
// that burns with the fierce passion of a million suns.
spin6lock /
Created August 10, 2012 07:01
python update
# -*- coding: utf-8 -*-
def update(module_name):
import types, gc, re
def test_and_process_list(obj, old, new):
if not isinstance(obj, list): return
# find the references in list
refs = [ index for index, item in enumerate(obj) if item is old ]
# update the list