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
# !/bin/python | |
""" | |
The script is rewritten C as Python. | |
==================================================== | |
""" | |
for i in range(NPATH+1): | |
cash_flow[i]=payoff(stock[i][tmax], pexe) |
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
# !/bin/python | |
from __future__ import division | |
import sys | |
import random | |
""" | |
The script is rewritten JavaScript as Python. | |
==================================================== | |
<script type="text/javascript"> | |
<!-- |
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Sections: | |
" -> General | |
" -> VIM user interface | |
" -> Colors and Fonts | |
" -> Files and backups | |
" -> Text, tab and indent related | |
" -> Visual mode related | |
" -> Moving around, tabs and buffers | |
" -> Status line |
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 CallbackBase: | |
def __init__(self): | |
self.__callbackMap = {} | |
for k in (getattr(self, x) for x in dir(self)): | |
if hasattr(k, "bind_to_event"): | |
self.__callbackMap.setdefault(k.bind_to_event, []).append(k) | |
elif hasattr(k, "bind_to_event_list"): | |
for j in k.bind_to_event_list: | |
self.__callbackMap.setdefault(j, []).append(k) | |
## staticmethod is only used to create a namespace |
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
## 代码段A | |
try: | |
statement_A | |
except ...: | |
... | |
else: | |
statement_B | |
## 代码段B |
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 python2.7 | |
#encoding:utf-8 | |
#@description:一个python守护进程的例子 | |
#@tags:python,daemon | |
import sys | |
import os | |
import time | |
import atexit | |
from signal import SIGTERM | |
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
from Queue import Queue | |
from threading import Thread | |
import time | |
import feedparser | |
num_fetch_threads = 2 | |
enclosure_queue = Queue() |
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
body { | |
padding: 0px; | |
margin: 0px; | |
font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", Tahoma, "STHeiti", "Monaco"; | |
background-color: #D6D4D2; | |
background-image: url("/static/img/bg.png"); | |
min-width: 900px; |
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
body { | |
padding: 0px; | |
margin: 0px; | |
font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", Tahoma, "STHeiti", "Monaco"; | |
background-color: #D6D5D2; | |
background-image: url("/static/img/bg.png"); | |
min-width: 900px; |
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
body { | |
padding: 0px; | |
margin: 0px; | |
font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", Tahoma, "STHeiti", "Monaco"; | |
background-color: #D6D5D2; | |
background-image: url("/static/img/bg.png"); | |
min-width: 900px; |