This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from subprocess import PIPE, Popen, STDOUT | |
args = sys.argv[1:] | |
process = Popen(args, stdout=PIPE, shell=True, stderr=STDOUT) | |
count = 0 | |
while True: | |
buff = process.stdout.readline() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def status_worker(body, last_modify): | |
try: | |
expire = time.time() + 10 | |
while time.time() < expire: | |
mtime = os.path.getmtime(STATUS_FILE) | |
if mtime > last_modify: | |
break | |
time.sleep(1) | |
if not os.path.exists(STATUS_FILE): | |
body.put(json.dumps({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
os.execute("gnome-settings-daemon &") | |
os.execute("gnome-keyring-daemon --start --components keyring,pkcs11,secrets,ssh,gpg &") | |
os.execute("gnome-power-manager &") | |
os.execute("nm-applet --sm-disable &") | |
-- 解决搜狗拼音的黑块问题 | |
-- 需要先 apt-get install compton | |
os.execute("compton --config /dev/null &") | |
-- 启动搜狗拼音输入法, 需要先从官网下载 deb 包安装 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
def get_file_md5(filename): | |
md5 = hashlib.md5() | |
with open(filename,'rb') as f: | |
for chunk in iter(lambda: f.read(128*md5.block_size), b''): | |
md5.update(chunk) | |
return md5.hexdigest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local _cache = {} | |
local function is_array(t) | |
local count = #t | |
if count == 0 then | |
return false | |
end | |
for i=1,count do | |
local v = t[i] | |
if v == nil then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct { | |
lua_State *L; | |
ZIO *Z; | |
Mbuffer *b; | |
const char *name; | |
lu_byte load_size_t_size; | |
lu_byte load_size_t_offset; | |
} LoadState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wchar_t* | |
fromUTF8( | |
const char* src, | |
size_t src_length, /* = 0 */ | |
size_t* out_length /* = NULL */ | |
) | |
{ | |
if(!src) | |
{ return NULL; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local M = {} | |
function M.test(...) | |
print(...) | |
end | |
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"LUA REQUIRE JUMPER { | |
function! JumpRequire() | |
let line=getline('.') | |
if line =~ "\\<require\\>\\s*(\\?\\s*['\"][^'\"]\\+['\"]\\s*)\\?\\s*$" | |
let path = substitute(line, "^.*\\<require\\>\\s*(\\?\\s*['\"]\\([^'\"]\\+\\)['\"]\\s*)\\?\\s*$", '\1', 'g') | |
let target = substitute(path, '\.', '/', 'g') . '.lua' | |
if &mod['ified'] | |
execute "vs " . target | |
else | |
execute "e " . target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"LUA REQUIRE JUMPER { | |
function! JumpRequire() | |
let kws = ["require", "g_class", "show_ui", "notify_ui", "hide_ui", "get_ui", "call_ui"] | |
let prefix="\\(\\<" . join(kws, "\\>\\|\\<") . "\\>\\)" | |
let line=getline('.') | |
if line =~ prefix . "\\s*(\\?\\s*['\"][^'\"]\\+['\"]" | |
let path = substitute(line, "^.*" . prefix . "\\s*(\\?\\s*['\"]\\([^'\"]\\+\\)['\"].*$", '\2', 'g') | |
let target = substitute(path, '\.', '/', 'g') . '.lua' | |
if &mod['ified'] | |
execute "vs " . target |
OlderNewer