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/python | |
| # coding=utf-8 | |
| # usage: `python adjust_srt.py Departures.2008.chs.srt -1` | |
| import sys | |
| from datetime import datetime, timedelta | |
| if sys.argv.__len__() < 3: | |
| sys.exit(-1) | |
| zm = sys.argv[1] |
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 | |
| # 有人邀请A,B,C,D,E,F6个人参加一项会议,这6个人有些奇怪,因为他们有很多要求,已知: | |
| # 1.A,B两人至少有1人参加会议。 | |
| # 2.A,E,F3人中有2人参加会议。 | |
| # 3.B和C两人一致决定,要么两人都去,要么两人都不去。 | |
| # 4.A,D两人中只1人参加会议。 | |
| # 5.C,D两人中也只要1人参加会议。 | |
| # 6.如果D不去,那么E也决定不去。 |
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 java.security.InvalidKeyException; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.security.SignatureException; | |
| import java.util.Formatter; | |
| import javax.crypto.Mac; | |
| import javax.crypto.spec.SecretKeySpec; | |
| /** |
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/questions/1140358/how-to-initialize-log4j-properly | |
| ; @Arash | |
| (org.apache.log4j.PropertyConfigurator/configure "location/log4j.properties") | |
| ; deploy dir tree. | |
| ; ├── app-standalone.jar | |
| ; ├── location | |
| ; │ ├── log4j.properties | |
| ; │ └── others.properties |
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
| [global] | |
| timeout = 60 | |
| index-url = http://pypi.douban.com/simple |
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 | |
| from fabric.api import run, env, local | |
| from fabric.decorators import parallel | |
| from fabric.tasks import execute | |
| @parallel | |
| def deploy_ftp(): | |
| dest = '/pro/game/com/ftp' | |
| run('rm -rf %s' % dest) |
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: utf8 -*- | |
| from fabric.api import run, cd, env | |
| from datetime import datetime as dt, timedelta | |
| from fabric.decorators import with_settings, parallel | |
| from fabric.tasks import execute | |
| @parallel |
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 | |
| def my_fun(tu): | |
| for i in tu: | |
| m = yield i | |
| print 'Rst: ', m | |
| if __name__ == '__main__': |
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 threading | |
| import time | |
| c = [0, 0, 0] | |
| def incr(): | |
| time.sleep(2) | |
| c[1] += 1 | |
| print threading.current_thread().getName(), c |
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 | |
| def err(): | |
| a = [0] | |
| try: | |
| # return a[0] | |
| return a[10] | |
| except Exception as e: | |
| print e | |
| return 10 | |
| finally: |
NewerOlder