Skip to content

Instantly share code, notes, and snippets.

@griggheo
griggheo / compare_env.go
Created August 28, 2014 21:04
Inspect differences between Chef environments on Chef server vs local filesystem
package main
import (
"fmt"
"log"
"bytes"
"strings"
"flag"
"sort"
"os/exec"
@griggheo
griggheo / compare_env_v2.go
Created August 29, 2014 00:26
Version 2 of compare_env.go
package main
import (
"fmt"
"log"
"bytes"
"strings"
"flag"
"sort"
"os/exec"
{
"network": {
"servers": [ "{{logstash_elasticsearch_host }}:{{ logstash_listen_port_tcp }}" ],
"ssl ca": "{{ logstash_forwarder_etc_dir }}/{{ ssl_cert }}", "timeout": 15
},
"files": [
{
"paths": [
"/var/log/syslog",
"/var/log/*.log"
input {
lumberjack {
port => 5000
type => "logs"
ssl_certificate => "/etc/pki/logstash/my_wildcard.crt"
ssl_key => "/etc/pki/logstash/my_wildcard.key"
}
}
filter {
if ([message] =~ /ping/) {
filter {
grok {
add_tag => [ "valid" ]
match => { "message" => "%{APPLOGLINE}" }
}
json {
source => "payload"
}
if "valid" not in [tags] {
drop { }
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
$ 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 <jfs@debian.org>
#
# 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 <jfs@debian.org>
#
# 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"