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 iAny(seq): | |
for item in seq: | |
if item: | |
return True | |
return False |
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
allNum = range(1000*1000) | |
random.shuffle(allNum) | |
for promoCodeNeverRepeat in allNum: | |
doSomethingWith(promoCodeNeverRepeat) | |
def getCode(): | |
result = allNum[getCode.usedNum] | |
getCode.usedNum += 1 | |
return result | |
getCode.usedNum = 0 |
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
class Fruit(object): | |
Apple = 0 | |
Pear = 1 | |
Banana = 2 | |
#________________________________ | |
#/ 其它的一些定義, \ | |
#\ 使Fruit類可以下標訪問. / | |
# -------------------------------- | |
# \ ^__^ | |
# \ (oo)\_______ |
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
#!/usr/bin/env python | |
import os | |
import shutil | |
count = 0 | |
for filename in os.listdir('.'): | |
if filename.endswith('.txt') and os.path.isfile(filename): | |
destDir = 'AAA%d' % (count / 500 + 1) |
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
#!/bin/sh | |
count=0 | |
IFS=$'\n' | |
for filename in `find *.txt` | |
do | |
destDir="AAA$((count / 500 + 1))" | |
if (($count % 500 == 0 )) | |
then | |
echo mkdir $destDir |
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
#!/usr/bin/env python | |
from flask import Flask | |
from time import sleep | |
application = Flask(__name__) | |
application.debug = True | |
@application.route('/a') | |
@application.route('/b') |
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
/* ======================================================================== | |
* Copyright 2012 new013231@gmail.com | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/* ======================================================================== | |
* Copyright 2012 new013231@gmail.com | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
# Copyright 2012 new013231@gmail.com | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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 itertools | |
def simNames(name): | |
elements = [] | |
for ch in name: | |
if ch == '0' or ch == 'o': | |
elements.append(['0', 'o']) | |
elif ch == '1' or ch == 'i' or ch == 'l': | |
elements.append(['1', 'i', 'l']) | |
else: |