Skip to content

Instantly share code, notes, and snippets.

@shuax
shuax / decorator
Created July 2, 2014 06:07
lua decorator,类似python那样的装饰器
local function decorator(str)
local rebuild_str = {}
local rebuild_fun = "(\0)"
local state = 0
for line in str:gmatch('[^\r\n]+') do
if line:find("@") then
rebuild_fun = string.format("(%s"..rebuild_fun..")", line:sub(2))
state = 1
else
if state==0 or state==3 then
import os
import re
import zlib
import urllib.request
from struct import unpack
class QQWayIPSeekerUpdate():
@classmethod
def __download_meta(cls):
@shuax
shuax / windows 10
Last active August 29, 2015 14:07
windows 10
#include <windows.h>
#include <stdio.h>
int width = 0;
HWND TaskListHwnd = NULL;
BOOL CALLBACK SearchTrayButton(HWND hwnd, LPARAM lParam)
{
TCHAR buff[256];
if(GetClassName(hwnd, buff, 255))
import zlib
with open("3231.zl", "rb") as encrypted_file:
data = encrypted_file.read()
decrypted_text = zlib.decompress(data)
with open('3231.bin', 'wb') as decrypted_file:
decrypted_file.write(decrypted_text)
local function check_endless_loop()
local stat = {}
local function hook_line(e, line)
local source = debug.getinfo(2).source
if not stat[source] then
stat[source] = {}
end
if not stat[source][line] then
stat[source][line] = 0
import struct
_DELTA = 0x9E3779B9
def _long2str(v, w):
n = (len(v) - 1) << 2
if w:
m = v[-1]
if (m < n - 3) or (m > n): return ''
n = m
import zipfile
import xxtea
import re
import os
# setXXTEAKeyAndSign
apk = zipfile.ZipFile("xxxx.apk", "r")
probe_file = []
from array import array
with open("Assembly-CSharp.dll", "rb") as encrypted_file:
data = encrypted_file.read()
key = "*********"
S = list(range(256))
j = 0
out = []
import random
def shuffle_assign(total, num):
remain = total - num
assert remain >= 0
points = []
for i in range(1, num):
point = random.randint(0, remain)
points.append(point)
points.append(remain)
points.sort()
import math
import random
def PfromC(C):
if not isinstance(C, float):
C = float(C)
pProcOnN = 0.0
pProcByN = 0.0
sumNpProcOnN = 0.0