#Google Cloud
####Nice sources
| [ | |
| { "keys": ["alt+m"], "command": "markdown_preview", "args": {"target": "browser", "parser":"markdown"} } | |
| ] |
| pip freeze | grep pymongo |
| #source: http://nbviewer.ipython.org/github/mwaskom/seaborn/blob/master/examples/plotting_distributions.ipynb | |
| import seaborn as sns | |
| sns.set_palette("deep", desat=.6) | |
| sns.set_context(rc={"figure.figsize": (8, 4)}) |
| def isfloat(x): | |
| try: | |
| a = float(x) | |
| except ValueError: | |
| return False | |
| else: | |
| return True | |
| def isint(x): | |
| try: |
| #source: https://www.udacity.com/course/viewer#!/c-cs253/l-48299958/e-48381418/m-48721320 | |
| MYLIST=['a','b','c','d'] | |
| n =-1 | |
| def looping(): | |
| global n | |
| n+=1 | |
| return MYLIST[n % len(MYLIST)] |
#MongoDB
####PYMONGO a=grades.find({'type': 'homework'}).sort('student', pymongo.ASCENDING).sort('score', pymongo.ASCENDING) doc=foo.find(query).hint([('c', pymongo.ASCENDING)]).explain()#arrays of tuples db.cities.save(newdoc) #create or replace the newdoc into db
####PYMONGO AND UDACITY EXAMPLES
#WEB DEVELOPMENT
##Some Links
nice icons: http://fontawesome.io/icons/
| #Make sure that your script is in UTF-8. It is not the really a solution, but it is a quick fix | |
| #source: http://stackoverflow.com/questions/5040532/python-ascii-codec-cant-decode-byte | |
| import sys | |
| reload(sys) | |
| sys.setdefaultencoding('utf-8') |