This file contains hidden or 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
#!/usr/bin/env python | |
# coding:utf-8 | |
import sys | |
import os | |
import fcntl | |
import gevent.hub | |
import gevent.socket | |
class _socketobject: |
This file contains hidden or 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
#coding:utf-8 | |
''' | |
python图片处理 | |
@author:fc_lamp | |
@blog:http://fc-lamp.blog.163.com/ | |
''' | |
import Image as image | |
#等比例压缩图片 | |
def resizeImg(**args): |
This file contains hidden or 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
-module(libmis). | |
-export([perms/1]). | |
perms([]) -> [[]]; | |
perms(L) -> [ [H|T] || H <- L, T <- perms(L--[H])]. | |
This file contains hidden or 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
.列表操作 | |
lists:foreach (fun(X) -> io:format("E=~p~n",[X]) end, [1,2,3]). | |
lists:duplicate (10, 16#f). % [15,15,15,15,15,15,15,15,15,15] | |
"abc-123" -> "abc" | |
no_vsn(Name) -> lists:takewhile (fun($-)->false;(_)-> true end,Name). |
This file contains hidden or 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
-module(erichash). | |
-export([start/2, getTargetInfo/1]). | |
-define(HOST_LIST_ETS_NAME , hostlist). | |
-define(PROCESS_LIST_NAME , pl). | |
start(HostList , Num) when is_list(HostList), is_integer(Num) -> | |
erase(?PROCESS_LIST_NAME), | |
targets(HostList, Num), | |
self(). |
This file contains hidden or 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 中实现 OO 的一种方案: | |
local _class={} | |
function class(super) | |
local class_type={} | |
class_type.ctor=false | |
class_type.super=super | |
class_type.new=function(...) | |
local obj={} |