Skip to content

Instantly share code, notes, and snippets.

from supervisor import childutils
import sys
import graypy
import logging
class GraylogNotifier(object):
def __init__(self, graylog_server):
self.logger = logging.getLogger('supervisord')
self.logger.addHandler(graypy.GELFHandler(graylog_server, 12201))
@reshefm
reshefm / supervisor-pagerduty.py
Last active December 14, 2015 00:08
Pagerduty notifications for supervisord process crashes
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
# Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@reshefm
reshefm / Week of year in clojure
Created February 1, 2013 13:27
Get week of year of a date in Clojure
(require '[clj-time.core :as tm])
(import '(java.util Calendar))
(defn week-of-year
[date]
(let [cal (Calendar/getInstance)]
(.setTime cal (.toDate date))
(.get cal Calendar/WEEK_OF_YEAR)))
@reshefm
reshefm / getviewsfromcouch.py
Created November 28, 2011 17:48
Get the views from couchdb to the file system in a directory structure that fits couchdbkit
import urllib2
import optparse
import json
import os
def main():
def chdir_safe(path):
if not os.path.exists(path):