Skip to content

Instantly share code, notes, and snippets.

View lost-theory's full-sized avatar

Steven Kryskalla lost-theory

View GitHub Profile
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(":")
@lost-theory
lost-theory / gist:2576645
Created May 2, 2012 13:50 — forked from isa/gist:2571012
Convert in less than 30 lines
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:
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__":