Skip to content

Instantly share code, notes, and snippets.

mason ri0day

Block or report user

Report or block ri0day

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
__author__ = "Mark Allan B. Meriales"
# based from
# mine uses a picture as a watermark
from PIL import Image, ImageEnhance
def add_watermark(image_file, logo_file, opacity=1):
img ='RGB')
logo =
ri0day /
Created Dec 23, 2015 — forked from artisonian/
A simple GridFS server built with Flask
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)
from threading import Thread
import Queue
import time
class TaskQueue(Queue.Queue):
def __init__(self, num_workers=1):
self.num_workers = num_workers
View .profile
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"
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
View rundeck-config.groovy
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"
#!/bin/bash -e
#set to correct path to xmlstarlet
# xmlstarlet select xpath
# usage: xmlsel XPATH file
$XMLSTARLET sel -T -t -v "$xpath" $*
View resources.json
id: "locahost",
description: "Rundeck server node",
hostname: "localhost",
osArch: "x86_64",
osFamily: "unix",
osName: "Mac OS X",
osVersion: "10.6.6",
tags: ''
View project api resty

resty example, copy project config to a new project:

resty http://localhost:4440/api/11 -H 'x-rundeck-auth-token: ...'


GET /project/NAME.json | jq '{ "name": ("NEWNAME"), config:.config }' | POST /projects -H 'content-type:application/json'


View gist:597f2c2c0eb9d18cbae3
dignan:rundeck greg$ curl -O -J -H 'x-rundeck-auth-token:Do4d3NUD5DKk21DR4sNK755RcPk618vn' http://localhost:4440/api/11/project/ABC/export
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 237k 0 237k 0 0 71132 0 --:--:-- 0:00:03 --:--:-- 71138
curl: Saved to filename 'ABC-20140225-181150.rdproject.jar'
dignan:rundeck greg$
View success-template.html
<div>Execution ${} was <b>${execution.status}</b></div>
<li><a href="${execution.href}">Execution result</a></li>
<li><a href="${job.href}">Job</a></li>
<li><a href="${execution.projectHref}">Project: ${execution.project}</a></li>
<li><a href="${rundeck.href}">Rundeck</a></li>
You can’t perform that action at this time.