Skip to content

Instantly share code, notes, and snippets.

def get_queue_stats(queue_metrics):
for queue in get_rabbit_stats():
queue_metrics[metric].labels(hostname, queue['name']).set(queue[metric])
def create_queue_metrics():
metrics = {}
metrics['consumers'] = Gauge('rabbit_consumers_count',
# redirect to a startup page when there is no pidfile yet
RewriteEngine On
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{REQUEST_URI} !^/thruk/startup.html
RewriteCond %{REQUEST_URI} !^/thruk/side.html
RewriteCond %{REQUEST_URI} !^/thruk/.*\.(css|png|js)
RewriteCond %{REQUEST_URI} ^/thruk
RewriteCond /var/cache/thruk/thruk.pid !-f
RewriteRule ^(.*)$ /thruk/startup.html?$1 [R=302,L,NE,QSA]
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
## Modified solution of: http://superuser.com/a/180149
## If it is not pointing at an active socket, make the link.
if test "$SSH_AUTH_SOCK" ; then
real_sock=$(readlink ~/.ssh/ssh_auth_sock)
if [ -z "$real_sock" -o ! -S "$real_sock" ]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
fi
class ECDF(object):
"""
One-dimensional empirical distribution function given a vector of
observations.
Parameters
----------
observations : array_like
An array of observations
(use-package guide-key
:ensure
:config
(progn
(setq guide-key/guide-key-sequence '("C-x r" "C-x v" "C-x 4" "C-x 8")
guide-key/popup-window-position 'bottom
guide-key/recursive-key-sequence-flag t)
(guide-key-mode 1))
(setq checkboxes '(("yesno" :options ("Yes" "No") :default "Yes")
("passfail" :options ("Pass" "Fail") :default "Pass")))
(defun create-checkboxes ()
(let ((choice-options (mapcar #'car checkboxes)))
(completing-read "Choices: " checkboxes nil t nil nil (first choice-options))))
(defun get-some-checkboxes ()
(let* ((choicekey (create-checkboxes))
(choicedefault (plist-get (cdr (assoc choicekey checkboxes)) :default))
;; Use % to match various kinds of brackets...
;; See: http://www.lifl.fr/~hodique/uploads/Perso/patches.el
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(let ((prev-char (char-to-string (preceding-char)))
(next-char (char-to-string (following-char))))
(cond ((string-match "[[{(<]" next-char) (forward-sexp 1))
((string-match "[\]})>]" prev-char) (backward-sexp 1))
(t (self-insert-command (or arg 1))))))
- job_name: node
consul_sd_configs:
- server: 'consul:8500'
services: ['node']
relabel_configs:
- <same stuff>
- job_name: rabbit
consul_sd_configs:
- server: 'consul:8500'