Skip to content

Instantly share code, notes, and snippets.

View maxmanders's full-sized avatar

Max Manders maxmanders

View GitHub Profile
common_packages = %w(python-setuptools python-dev)
case node['platform']
when "centos", "redhat", "amazon"
(common_packages + ['gcc']).each do |pkg|
package pkg do
action :install
end
end
when "debian", "ubuntu"
(common_packages + ['build-essential']).each do |pkg|
@maxmanders
maxmanders / config
Created January 22, 2014 17:49
Example per-user SSH Config
Host *
# Forward remote X11 connections to run a remote GUI app locally
forwardx11 yes
# Only offer up keys defined with IdentityFile below, rather than all keys
identitiesonly yes
cipher arcfour
compression yes
# If using ssh-agent, forward that to remote jump host to avoid copying private keys
forwardagent yes
# Don't kill connetions too quickly
sheet_number = if spreadsheet.worksheets.length == 1
0
else
sheet_number = spreadsheet.worksheets.length - 1
end
filter = unless @filters.empty?
"AND (" + @filters.map { |x| %Q(pb.ProductCode LIKE '%#{x}%') }.join(" OR ") + ")"
end || ''
filter = ''
unless @filters.empty?
filter = "AND (" + filters.map { |filter| %Q(pb.ProductCode LIKE '%#{filter}%') }.join(" OR ") + ")"
end
# Use Zookeeper to add/remove from the cluster as required.
require 'zk'
zookeeper_node = search(:node, "role:zookeeper AND chef_environment:#{node.chef_environment}")[0]
listen_ip = zookeeper_node[:ipaddress]
zk = ZK.new("#{listen_ip}:2181")
# Cluster members reported by Zookeeper.
active_cluster_members = zk.children(node[:zk_watcher][:zk_node_path]).collect { |x| x.split(':')[0] }
# Cluster members reported by the node.
node_cluster_members = eval %x[rabbitmqctl cluster_status -q | grep running_nodes | grep -o "\[.*\]"]
╭─maxmanders@hedgehog ~ ‹ruby-1.9.3›
╰─$ 1=act
╭─maxmanders@hedgehog ~ ‹ruby-1.9.3›
╰─$ 2=ual
╭─maxmanders@hedgehog ~ ‹ruby-1.9.3›
╰─$ actualvariable=100
╭─maxmanders@hedgehog ~ ‹ruby-1.9.3›
╰─$ echo ${actualvariable}
100
╭─maxmanders@hedgehog ~ ‹ruby-1.9.3›
@maxmanders
maxmanders / Vagrantfile
Last active December 8, 2016 14:12
Vagrant 1.1 with host-only and bridged networking
Vagrant.configure("2") do |config|
ip_address = "192.168.56.1"
config.vm.box = "ubuntu-12.04.2-server-amd64"
config.vm.hostname = "chef-server.local"
config.ssh.timeout = 30
config.vm.provider :virtualbox do |vbox|
vbox.customize [ "modifyvm", :id, "--memory", 1024 ]
@maxmanders
maxmanders / gist:4952315
Created February 14, 2013 11:51
Zenoss ZenPack Debug
/usr/local/zenoss/common/libexec/check_http_by_hostname.py -H www.some_host_that_resolves.com -p 80 -t 60 -u / -f follow
Exit status is 1 which I had expected to raise an event, with the stdout of the command being the event message
zencommand run -d <device> -v10
...
2013-02-14 11:44:36,515 DEBUG zen.zencommand: running '/usr/local/zenoss/common/libexec/check_http_by_hostname.py -H www.some_host_that_resolves.com -p 80 -t 60 -u / -f follow'
2013-02-14 11:44:36,515 DEBUG zen.zencommand: cmd line: '/bin/sh -c exec /usr/local/zenoss/common/libexec/check_http_by_hostname.py -H www.some_host_that_resolves.com -p 80 -t 60 -u / -f follow'
2013-02-14 11:44:36,540 DEBUG zen.zencommand: Process check_http_by_hostname.py -H www.some_host_that_resolves.com -p 80 -t 60 -u / -f follow started
2013-02-14 11:45:08,918 DEBUG zen.zencommand: Received exit code: 1
2013-02-14 11:45:08,918 DEBUG zen.zencommand: Command: '/bin/sh -c exec /usr/local/zenoss/common/libexec/check_http_by_hostname.py -H www.some_host_that_resolves.c
factory_type_information = (
{
'immediate_view' : 'editHttpResolvingMonitorDataSource',
'actions' :
(
{ 'id' : 'edit',
'name' : 'Data Source',
'action' : 'editHttpResolvingMonitorDataSource',
'permissions' : ( Permissions.view, ),
},