Skip to content

Instantly share code, notes, and snippets.

@jpmens
jpmens / graphite_pip_uwsgi_recipe.sh
Created August 10, 2012 11:36 — forked from bfritz/graphite_pip_uwsgi_recipe.sh
installing graphite-web with pip and running under uwsgi
# graphite-web install is hardcoded in setup.cfg to /opt/graphite
sudo mkdir /opt/graphite
sudo chown brad.users /opt/graphite
# run under python2.7 virtualenv
virtualenv --python=python2.7 ~/ve/graphite
source ~/ve/graphite/bin/activate
# install the necessary python packages (simplejson is for flot graphs)
pip install graphite-web carbon whisper django django-tagging uwsgi simplejson
@jpmens
jpmens / RESULTS.md
Created September 21, 2012 07:54 — forked from jordansissel/RESULTS.md
screenshot + code showing how to query logstash/elasticsearch with a graphite function.

logstash queries graphed with graphite.

Operation: Decouple whisper from graphite.

Method: Create a graphite function that does a date histogram facet query against elasticsearch for a given query string for the time period viewed in the current graph.

Reason: graphite has some awesome math functions. Wouldn't it be cool if we could use those on logstash results?

The screenshot below is using logstash to watch the twitter stream of keywords "iphone" "apple" and "samsung" - then I graph them each, so we get an idea of popularity. As a bonus, I also do a movingAverage() on the iphone curve to show you why this is awesome.

@jpmens
jpmens / gist:3775078
Created September 24, 2012 09:14 — forked from solj/gist:1172389
diff --git a/src/lib/krb5/os/changepw.c b/src/lib/krb5/os/changepw.c
index 4ad8f32..bcea591 100644
--- a/src/lib/krb5/os/changepw.c
+++ b/src/lib/krb5/os/changepw.c
@@ -223,7 +223,7 @@ change_set_password(krb5_context context,
{
krb5_data chpw_rep;
krb5_address remote_kaddr;
- krb5_boolean use_tcp = 0;
+ krb5_boolean use_tcp = 1;
@jpmens
jpmens / rss-subscribers.sh
Created October 4, 2012 16:47 — forked from khalillechelt/rss-subscribers.sh
Bash script to parse Apache log on your Uberspace account for a count of RSS subscribers and email it to you
#!/bin/bash
# Schedule this to run once a day with cron. Doesn't matter what time since it parses yesterday's hits (by default).
# I only tested this on the Marco.org server, which runs CentOS (RHEL). No idea how it'll work on other distributions, but it's pretty basic.
# Required variables:
RSS_URI="/rss"
MAIL_TO="your@email.com"
LOG_FILE="/home/[UBERSPACE_USERNAME]/logs/access_log"
@jpmens
jpmens / copy-rtf
Created October 19, 2012 07:31 — forked from cormacrelf/copy-rtf
#!/bin/zsh
# Usage: copy-rtf [file]
#
# Copies Pygmentize's RTF output of a source file to the clipboard after making it 36pt Monaco.
#
# Copy straight into an "Auto-Shrink" text box in Keynote for efficient code highlighting in a Coding presentation.
# Depends on [Pygments](http://pygments.org/) being installed in your $PATH...
# try `gem install pygmentize` for a standalone Ruby installation.
@jpmens
jpmens / a.txt
Created November 7, 2012 18:56 — forked from anonymous/a.txt
version.bind of public DNS resolvers
" Why query me?Your IP had been logged!"
" unknown "
"( prasina aloga )"
"( surely you must be joking :) )"
"(get out - secure)"
"-"
"-=[NiN]=-"
"."
"... baubau :)"
"..:: blink-bind ::.."
@jpmens
jpmens / ssh.py
Created November 30, 2012 18:13 — forked from abourget/ssh.py
Ansible helper to connect to remote nodes via ssh, using the Ansible inventory
#!/usr/bin/env python
#
# This is a script we use at Tenscores, and it is specific only in the sense that we use IP addresses
# and use the variable `hostname` to find the correct nodes. Also, it connect to user `ubuntu` by
# default.. that could be checked up in the vars too.
#
# Our hosts file looks like:
#
#[appservers]
.ASIA @registryasia
.BIZ @Neustar
.CAT @dotcatdomain @puntcat
.COM .NET .NAME @VERISIGN
.COOP @dotCoop
.INFO @Afilias
.MOBI @dotMobiOfficial
.ORG @ORGBuzz
.PRO @RegistryPro
.TEL @dottel @TelnicLimited
.AR @nicargentina
.AU @auda
.BE @DNSbe
.CA @CIRANEWS
.CL @NICChile
.CO @dotco
.CR @CR_NIC
.CZ @CZ_NIC
.DE @denic_de
.EE @Eesti_Internet

My ansible approach

Per service playbooks

Playbooks are written per service : a playbook is a collection of tasks, and eventually associated handers, templates, and files, that are required to properly install and setup a service.

Each playbook has a setup.yml entry point, which is responsible of including various necessary tasks to get the service up and running. Typically, this