Skip to content

Instantly share code, notes, and snippets.

@riemers
riemers / .profile
Last active August 29, 2015 14:16
Ansible: Make a new server ready for consumption. Since not everybody uses amazon or api related services for their setup. This assumes you have a new server (just the root password and can still ssh in with it) and want to add it to your pool of servers (read addserver.yml what it does). Just add below .profile to your current homedir where you…
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
@gschueler
gschueler / basic-app.json
Last active November 5, 2020 18:46
Basic Rundeck aclpolicy, allows access to one project for one group
{
"description": "MyGroup allowed access to MyProject only",
"context": {
"application": "rundeck"
},
"for": {
"project": [
{
"match": {
"name": "MyProject"
@gerardorochin
gerardorochin / php_error_logstash.conf
Created June 2, 2014 15:39
php error logging into logstash + elasticsearch and trace errors on single line and root path hidden
input {
file {
type => "php-error"
path => "/var/www/error_log"
sincedb_path => "/opt/logstash/sincedb-access"
}
}
@gschueler
gschueler / success-template.html
Created May 2, 2014 20:21
Example email templates for rundeck notifications
<div>Execution ${execution.id} was <b>${execution.status}</b></div>
<ul>
<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>
</ul>
<p>
</p>
@ashrithr
ashrithr / graphite.md
Last active September 27, 2020 20:10
Installing graphite 0.10, collectd and grafana on centos 6

Installing Graphite:

Graphite does two things:

  1. Store numeric time-series data
  2. Render graphs of this data on demand

What Graphite does not do is collect data for you, however there are some tools out there that know

@kaiserama
kaiserama / DataTables.py
Last active March 16, 2022 14:52
Jquery DataTables class implementation in Flask with MySQL. There was an example of using DataTables with MongoDB + Flask, but nothing for using MySQL + Flask. Be sure you install Flask-MySQL extension first!
from MySQLdb import cursors
from flask import request
class DataTablesServer(object):
def __init__( self, request, columns, index, table, cursor):
self.columns = columns
self.index = index
self.table = table
# values specified by the datatable for filtering, sorting, paging
@illerucis
illerucis / gist:4586359
Last active September 2, 2022 19:01
Server-side Python + MongoDB + Flask implementation for DataTables
from collections import namedtuple
from pymongo import MongoClient
from flask import request
from core.web.site import app
from core.web.site.views_master import *
import json
'''
$('#companies').dataTable( {
"bProcessing": true,
@amitsaha
amitsaha / disks_lshw.py
Last active May 17, 2018 12:16
Use lshw -xml to find the disk details
#!/usr/bin/env python
# Parse disk:* from lshw -xml
"""
Sample Output:
ATA Disk Hitachi HDS72105 /dev/sda
Disk Space: 500107862016
Sector size: 512
'''
Demonstration of using `splice` with non-blocking IO
Lots of code is similar to 'splice.py', take a look at that module for more
documentation.
'''
import os
import os.path
import errno
@artisonian
artisonian / simple_gridfs_server.py
Created July 27, 2010 19:24
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)