Skip to content

Instantly share code, notes, and snippets.

#
### Cookbook Name:: haproxy
### Recipe:: default
### Author:: Joe Williams <[email protected]>
###
### Copyright 2008, Joe Williams
###
### Licensed under the Apache License, Version 2.0 (the "License");
### you may not use this file except in compliance with the License.
### You may obtain a copy of the License at
#!/bin/sh
### BEGIN INIT INFO
# Provides: haproxy
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: fast and reliable load balancing reverse proxy
# Description: This file should be used to start and stop haproxy.
### END INIT INFO
@denniskong
denniskong / check_memcache.rb
Created November 1, 2009 12:32
Nagios plugin to check memcached written in ruby
#!/usr/bin/env ruby
# check_memcached.rb [email protected] 20091101 v0.1
# Copyright 2009, Dennis Kong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
package main
import (
"fmt"
"time"
)
// SlowShepherd is for making sure that a func used in a tight loop
// does not cause a thundering herd problem. If the function
// thunderingHerdFunc returns quicker than the sleepInterval given,
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
[alias]
# git browse
# Opens origin in web browser
#
# Ex:
# [email protected]:my/repo.git => http://myhostname.com/my/repo
# git://myhostname.com/my/repo.git => http://myhostname.com/my/repo
# http[s]://myhostname.com/my/repo.git => http://myhostname.com/my/repo
browse = !open $( \
echo \"`git config remote.origin.url`\" | \
@dupleix
dupleix / pyTunes.py
Created July 4, 2010 14:18
Synchronize an itunes playlist with any mp3 player
from appscript import *
import re, os
from shutil import copy
MY_PLAYLIST = u'walkman'
DEST = '/Volumes/WALKMAN/MUSIC'
iTunes = app('iTunes')
playlist = None
from flask import Module, request, redirect, url_for, render_template, abort
from formalchemy import FieldSet
from example import db
from example import Service, User, Forum, Category, Topic, Post
mod = Module(__name__)
models = {
import time
class Retry(object):
default_exceptions = (Exception)
def __init__(self, tries, exceptions=None, delay=0):
"""
Decorator for retrying function if exception occurs
tries -- num tries
exceptions -- exceptions to catch
# Poll interval of 2 minutes
set daemon 120
set logfile /var/log/monit.log
set mail-format {
from: [email protected]
subject: [monit] $SERVICE - $EVENT
}
# Global notify list