Skip to content

Instantly share code, notes, and snippets.

function connect_server()
for i = 1, #proxy.global.backends do
local s = proxy.global.backends[i]
if s.state ~= proxy.BACKEND_STATE_DOWN then
proxy.connection.backend_ndx = i
-- print ("connecting to " .. i)
return
end
end
#!/bin/sh
# Startup script for a supervisor instance
#
# chkconfig: 2345 80 20
# description: supervisord
supervisorctl="/usr/local/bin/supervisorctl"
supervisord="/usr/local/bin/supervisord"
pid="/var/run/supervisord.pid"
name="supervisord"
$ cat templatize.py
def templatize(*args):
"""A small utility function for printing values in columns of fixed width
* the width is hardcoded as 20 in this case"""
format_string = ""
i = 0
for arg in args:
format_string += "{%d:>20}" % i
i += 1
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
[xcache-common]
extension = xcache.so
[xcache.admin]
xcache.admin.user = "xc"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = ""
[xcache]
; ini only settings, all the values here is default unless explained
; select low level shm/allocator scheme implemenation
xcache.shm_scheme = "mmap"
TEMPL = """
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable(%(json)s,0.6);
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
#!/bin/bash -ex
# Add chef master hostname
cat <<EOL > /etc/hosts
127.0.0.1 localhost.localdomain localhost
10.2.170.5 chefmaster
10.22.162.3 mysite.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
#! /bin/sh
### BEGIN INIT INFO
# Provides: chef-client
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start a chef-client.
### END INIT INFO
#
#!/bin/bash -ex
# Add chef master hostname
cat <<EOL > /etc/hosts
127.0.0.1 localhost.localdomain localhost
10.2.170.5 chef.mycloud.com
10.22.162.3 mysite.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback