db.votes.aggregate([{
$lookup: {
from: "users",
localField: "createdBy",
foreignField: "_id",
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
| sudo apt install alien -y | |
| sudo alien --scripts bluejeans_1.28.9-2_amd64.rpm # or whatever is the file you downloaded from the bluejeans website | |
| sudo dpkg -i bluejeans_1.28.9-2_amd64.deb | |
| cd /lib/x86_64-linux-gnu | |
| sudo ln -s libudev.so libudev.so.0 | |
| # now you can launch bluejeans | |
| /opt/bluejeans/bluejeans-bin |
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
| # -*- coding: utf-8 -*- | |
| from app.services.mongo import mdb | |
| from flask import Blueprint | |
| blueprint = Blueprint("module_a", __name__, url_prefix="/module_a") | |
| @blueprint.route("/abc") | |
| def something(): | |
| # do something with mdb |
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 Flask | |
| app = Flask("proxapp") | |
| @app.route('/') | |
| def hello_world(): | |
| return 'Hello World!' |
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 view decorator for flask and mongoengine/pymongo to auto-retry with delay on | |
| pymongo.errors.AutoReconnect exception. | |
| """ | |
| from functools import wraps | |
| import time | |
| from pymongo.errors import AutoReconnect | |
| import flask |
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 AWS = require('aws-sdk'), | |
| fs = require('fs'); | |
| // For dev purposes only | |
| AWS.config.update({ accessKeyId: '...', secretAccessKey: '...' }); | |
| // Read in the file, convert it to base64, store to S3 | |
| fs.readFile('del.txt', function (err, data) { | |
| if (err) { throw err; } |
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/env python | |
| import ssl | |
| import json | |
| import socket | |
| import struct | |
| import binascii | |
| def send_push_message(token, payload): | |
| # the certificate file generated from Provisioning Portal |
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 pymongo import Connection | |
| class MongoCon(object): | |
| __db = None | |
| @classmethod | |
| def get_connection(cls): | |
| if cls.__db is None: | |
| cls.__db = Connection() | |
| return cls.__db |
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
| function encrypt(text){ | |
| var cipher = crypto.createCipher('aes-256-cbc','d6F3Efeq') | |
| var crypted = cipher.update(text,'utf8','hex') | |
| crypted += cipher.final('hex'); | |
| return crypted; | |
| } | |
| function decrypt(text){ | |
| var decipher = crypto.createDecipher('aes-256-cbc','d6F3Efeq') | |
| var dec = decipher.update(text,'hex','utf8') |