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 flask import request, Flask | |
| from cloudinary import uploader #pip install git+https://github.com/cloudinary/pycloudinary/ | |
| class Cloudinary(object): | |
| def __init__(self, app): | |
| config = app.config['CLOUDINARY_URL'].split('://')[1] | |
| config = config.replace("@", ":") | |
| self.api_key, self.api_secret, self.name = config.split(":") |
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
| data = '''\ | |
| A, B, C | |
| A, C, E | |
| E, F, D | |
| D, A, J | |
| E, D, J''' | |
| import itertools, collections | |
| print "\n".join([" "+", ".join(a + (str(b),)) for (a,b) in sorted(collections.Counter(sum([list(itertools.combinations(sorted(x.strip().split(', ')), 2)) for x in data.split('\n')], [])).items(), key=lambda t: t[0])]) | |
| #output: |
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 os | |
| from fnmatch import fnmatch | |
| def find(pat, root): | |
| for path, dirs, files in os.walk(root): | |
| for f in files: | |
| if fnmatch(f, pat): | |
| yield os.path.join(path, f) | |
| if __name__ == "__main__": |