Skip to content

Instantly share code, notes, and snippets.

$ 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
# 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"
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