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 unittest | |
| def bobble_sort(values): | |
| """ | |
| Sorting list algorithm type of BobbleSort. | |
| Time O(n**2 - n) | |
| Space O(n + 3) | |
| :author sham vinicius fiorin | |
| :param values: List of comparable objects |
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
| class Mapper: | |
| def convertValue(self, data, obj): | |
| """ | |
| Mapper from dict to class, covering it's chieldrens but the key on dict must be mapping the chield with . | |
| Exemple: data = { | |
| "x": 0, | |
| "y": 1, | |
| "chield.a": "Sham Vinicius", | |
| "chield.b": "Fiorin", | |
| "chield.layer.c": "xxx", |
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 | |
| import subprocess | |
| print("---------------------------------------------------") | |
| print("Automatic Watched Set Up of Github in Python") | |
| print("-----------by Sham Vinicius Fiorin-----------------") | |
| print("---------------------------------------------------") | |
| config = input("Set up configurations[N/s]?") | |
| if('s' in config.lower()): | |
| subprocess.run(["git", "init"]) |
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
| /* | |
| Simple Node.js Utility module to enable easy creation of models using node-mongodb-native | |
| Useage:- | |
| var dao = require('./mongodb-dao'); | |
| exports.NewClient = function(clientId, plan){ | |
| return { | |
| clientId: clientId, | |
| plan: plan, |
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
| var mongo = require('mongodb'), | |
| EventEmitter = require('events').EventEmitter; | |
| function Connector(settings) { | |
| settings.port = settings.port || mongo.Connection.DEFAULT_PORT; | |
| this.settings = settings; | |
| this.server = new mongo.Server(settings.host, settings.port); | |
| this.db = new mongo.Db(settings.database, this.server, {native_parser: true}); | |
| } |
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
| const functions = require('firebase-functions'); | |
| const gcs = require('@google-cloud/storage')(); | |
| const sharp = require('sharp') | |
| const _ = require('lodash'); | |
| const path = require('path'); | |
| const os = require('os'); | |
| exports.generateThumbnail = functions.storage.object('uploads/{imageId}').onChange(event => { | |
| const object = event.data; // The Storage object. |
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
| // $sum | |
| db.zips.aggregate([ | |
| { $group: | |
| { | |
| "_id": { | |
| "state": "$state" | |
| }, | |
| "population": { "$sum": "$pop" } | |
| } | |
| } |
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 pymongo | |
| import sys | |
| def main(): | |
| connection = pymongo.MongoClient("mongodb://localhost") | |
| db = connection.m101 | |
| people = db.people | |
| person = {'name': 'Barack Obama', 'role':'President', | |
| 'address':{'address1':'The White House', | |
| 'street': '1600 Pensylvania Avenue', |
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 datetime import datetime | |
| from pymongo import MongoClient | |
| connection = MongoClient("mongodb://localhost") | |
| db = connection.test | |
| post = {"title": "My Blog Post", | |
| "content": "Here's my blog post.", | |
| "date": datetime.utcnow()} |
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
| Oficina MongoDB e Python - FISL | |
| Resumo university.mongodb.com/courses/M101P/about | |
| Install python 2.7 (provavelmente vc já tem) | |
| https://www.python.org/downloads/ | |
| para testar python -V | |
| Install mongoDB 3.4 | |
| https://www.mongodb.org/downloads | |
| criar diretório \data\db com as permissões necessárias para testar bin\mongod (servidor) |