This file contains 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 |
This file contains 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 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 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 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 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 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
PBLOC=~/projects/somewhere/addserver.yml | |
addserver() { | |
if [[ -z "$1" ]]; then | |
echo "[e] You need to give an IP for this to work. Dont use ssh-agent, since it will have precedence" | |
else | |
echo "[i] Running setup for new server, be ready to type in your root password" | |
echo "[i] Removing and re-adding the known_hosts file" | |
ssh-keygen -f "${HOME}/.ssh/known_hosts" -R $1 | |
ssh-keyscan -t rsa -H $1 >> ~/.ssh/known_hosts | |
ansible-playbook ${PBLOC} -u root -i "newserver," --extra-vars="hosts=newserver ansible_ssh_host=$1" -k |
This file contains 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
loglevel.default = "DEBUG" | |
rdeck.base = "/var/lib/rundeck" | |
rss.enabled = true | |
dataSource { | |
dbCreate = "update" | |
url = "jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;MVCC=true" | |
} | |
This file contains 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 -e | |
#set to correct path to xmlstarlet | |
XMLSTARLET=/usr/local/bin/xml | |
# xmlstarlet select xpath | |
# usage: xmlsel XPATH file | |
xmlsel(){ | |
xpath=$1 | |
shift | |
$XMLSTARLET sel -T -t -v "$xpath" $* |
This file contains 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
[ | |
{ | |
id: "locahost", | |
description: "Rundeck server node", | |
hostname: "localhost", | |
osArch: "x86_64", | |
osFamily: "unix", | |
osName: "Mac OS X", | |
osVersion: "10.6.6", | |
tags: '' |
NewerOlder