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
# mongoinsert.py | |
from pymongo import MongoClient | |
client = MongoClient('mongodb://localhost:27017/') | |
# data base name : 'mongodb-1' | |
db = client['mongodb-1'] | |
import datetime |
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
# instance.py | |
#!/bin/python | |
import argparse | |
import sys | |
import boto.ec2 | |
def check_arg(args=None): | |
parser = argparse.ArgumentParser(description='args : start/start, instance-id') | |
parser.add_argument('-o', '--op', | |
help='operation type', |
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 pika | |
connection = pika.BlockingConnection(pika.ConnectionParameters( | |
'localhost')) | |
channel = connection.channel() | |
channel.queue_declare(queue='queuename') | |
channel.basic_publish(exchange='', |
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 pika | |
connection = pika.BlockingConnection(pika.ConnectionParameters( | |
host='localhost')) | |
channel = connection.channel() | |
channel.queue_declare(queue='queuename') | |
def callback(ch, method, properties, body): |
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 | |
#Step 1 pip install dockerpty | |
import docker | |
import dockerpty | |
client = docker.Client() | |
container = client.create_container( | |
image='busybox:latest', | |
stdin_open=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
from flask import Flask | |
import os | |
app = Flask(__name__) | |
port = int(os.getenv("PORT", 9099)) | |
@app.route('/') | |
def starter_app(): | |
return 'CF App ' + str(os.getenv("CF_INSTANCE_INDEX", 0)) |