copy/cut多个文本,可以通过 C-y 粘贴,之后通过多次 M-y 逐个选择
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
| import logging | |
| class Stack: | |
| def __init__(self): | |
| self.__space = [] | |
| self.cur = -1 | |
| def pop(self): | |
| if self.cur == -1: | |
| logging.warn("pop an empty stack") | |
| return None |
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
| class QueueItem: | |
| def __init__(self, data): | |
| self.data = data | |
| self.next = None | |
| def __repr__(self): | |
| string = "Data: {}".format(str(self.data)) | |
| return string | |
| class LinkedQueue: | |
| def __init__(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
| #Credit: http://stackoverflow.com/a/4642213/668223 | |
| FILE=test | |
| while read CMD; do | |
| echo "$CMD" | |
| done < "$FILE" |
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
| adb shell screencap -p | sed 's/\r$//' > screen.png |
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
| def start_thread_wrapper(target_func,name='thread-', thread_number=1,daemon=True, args=()): | |
| assert target_func != None and hasattr(target_func, '__call__') | |
| for i in xrange(thread_number): | |
| t = threading.Thread(target=target_func,name=name+str(i), args=args) | |
| t.daemon = daemon | |
| t.start() |
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
| # http://stackoverflow.com/a/707001/668223 | |
| import os | |
| from subprocess import Popen, PIPE | |
| process = Popen(["ls", "-la", "."], stdout=PIPE) | |
| exit_code = os.waitpid(process.pid, 0) | |
| output = process.communicate()[0] | |
| # 更好的做法应该是 | |
| # http://docs.python.org/2/library/subprocess.html |
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
| http://blog.csdn.net/qiaoliang328/article/details/4722377 | |
| http://alas.matf.bg.ac.rs/manuals/lspe/snode=38.html |
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
| #define LOGE(fmt,args...) fprintf(stderr, fmt, ##args) | |
| #define LOGD(fmt,args...) fprintf(stderr, fmt, ##args) | |
| #define LOGW(fmt,args...) fprintf(stderr, fmt, ##args) | |
| #include <errno.h> | |
| #include <string.h> | |
| #define PLOGE(fmt,args...) LOGE(fmt " failed with %d: %s", ##args, errno, strerror(errno)) | |
| #define PLOGEV(fmt,err,args...) LOGE(fmt " failed with %d: %s", ##args, err, strerror(err)) |
deploy时需要解决的问题就是moduler的依赖问题。比如使用BeautifulSoup开发
- python wiki: http://wiki.python.org/moin/deployment
- pyinstaller: http://www.pyinstaller.org/wiki
- cx_freezer: http://cx-freeze.sourceforge.net/