db.votes.aggregate([{
$lookup: {
from: "users",
localField: "createdBy",
foreignField: "_id",
| #!/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 |
| def measure_memory_usage(target_call, target_args, log_filename=None, memory_denominator=1024.0**2, memory_usage_refresh=0.005): | |
| """ | |
| measure the memory usage of a function call in python.\n | |
| Note: one may have to restart python to get accurate results.\n | |
| :param target_call: function to be tested\n | |
| :param target_args: arguments of the function in a tuple\n | |
| :param memory_usage_refresh: how frequent the memory is measured, default to 0.005 seconds\n | |
| :return: max memory usage in kB (on Linux/Ubuntu 14.04), may depend on OS | |
| """ | |
| import time |
| #!/usr/bin/env python | |
| # http://www.rabbitmq.com/tutorials/tutorial-two-python.html | |
| import pika | |
| import sys | |
| connection = pika.BlockingConnection(pika.ConnectionParameters( | |
| host='localhost')) | |
| channel = connection.channel() | |
| message = ' '.join(sys.argv[1:]) or "Hello World!" |
| #!/usr/bin/env python | |
| # http://www.rabbitmq.com/tutorials/tutorial-two-python.html | |
| import pika | |
| import sys | |
| connection = pika.BlockingConnection(pika.ConnectionParameters( | |
| host='localhost')) | |
| channel = connection.channel() | |
| message = ' '.join(sys.argv[1:]) or "Hello World!" |
Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.
You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.
These are my notes basically. At first i created this gist just as a reminder for myself. But feel free to use this for your project as a starting point. If you have questions you can find me on twitter @thomasf https://twitter.com/thomasf This is how i used it on a Debian Wheezy testing (https://www.debian.org/releases/testing/)
Discuss, ask questions, etc. here https://news.ycombinator.com/item?id=7445545
| <?php | |
| /** | |
| * @name Connect to Hbase Stargate server with PHP | |
| * @author Mr.Ping (Jonathan) | |
| */ | |
| class hbase_stargate { |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import urllib2 | |
| gh_url = 'https://api.github.com' | |
| req = urllib2.Request(gh_url) | |
| password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |