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 threading import Thread | |
| import Queue | |
| import time | |
| class TaskQueue(Queue.Queue): | |
| def __init__(self, num_workers=1): | |
| Queue.Queue.__init__(self) | |
| self.num_workers = num_workers | |
| self.start_workers() |
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, request, redirect, url_for, make_response, abort | |
| from werkzeug import secure_filename | |
| from pymongo import Connection | |
| from pymongo.objectid import ObjectId | |
| from gridfs import GridFS | |
| from gridfs.errors import NoFile | |
| ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) | |
| DB = Connection().gridfs_server_test | |
| FS = GridFS(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
| __author__ = "Mark Allan B. Meriales" | |
| # based from http://www.pythoncentral.io/watermark-images-python-2x/ | |
| # mine uses a picture as a watermark | |
| from PIL import Image, ImageEnhance | |
| def add_watermark(image_file, logo_file, opacity=1): | |
| img = Image.open(image_file).convert('RGB') | |
| logo = Image.open(logo_file) |
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
| package aliyuncms | |
| import ( | |
| "encoding/json" | |
| "reflect" | |
| "strconv" | |
| "strings" | |
| "sync" | |
| "time" |
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
| package aliyuncms | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "strconv" | |
| "strings" | |
| "sync" | |
| "time" |
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
| #!/bin/bash | |
| # bash functions to autenticate and assume roles in aws federated accounts | |
| # required tools on $PATH - aws, date, curl, jq, libxml2-utils | |
| # requried environment variables: | |
| export AWS_CLI=`which aws` | |
| # optional environment variable, to automatically assume a specific role when calling assume() | |
| # AWS_ASSUME_ROLE=arn:aws:iam::369407384105:role/cross-account-federated-role |
OlderNewer