Skip to content

Instantly share code, notes, and snippets.

@harlanbarnes
harlanbarnes / motd.erb
Created January 17, 2012 21:37
motd.erb
<% if @banner -%><%= @banner -%><% end -%>
+----------------------------------------
|
| Host name: <%= node[:hostname] %>
| FQDN: <%= node[:fqdn] %>
| Distro / Arch: <%= node[:platform] %> <%= node[:platform_version] %> <%= node.kernel.machine %>
<% if node.attribute?('applogic') -%>
| App name: <%= node[:applogic][:APP_NAME] %>
| Comp name: <%= node[:applogic][:COMP_NAME] %>
<% end -%>
@harlanbarnes
harlanbarnes / Vagrantfile
Created January 17, 2012 22:54
Vagrantfile
user = ENV['OPSCODE_USER'] || ENV['USER']
base_box = ENV['VAGRANT_BOX'] || 'centos-5.5-x86_64'
Vagrant::Config.run do |config|
config.vm.box = base_box
config.ssh.timeout = 600
config.vm.provision :chef_client do |chef|
@harlanbarnes
harlanbarnes / Vagrantfile
Created January 17, 2012 23:34
Vagrantfile Multi VM
user = ENV['OPSCODE_USER'] || ENV['USER']
base_box = ENV['VAGRANT_BOX'] || 'centos-5.5-x86_64'
Vagrant::Config.run do |config|
config.vm.define :web do |web_config|
web_config.vm.box = base_box
web_config.vm.forward_port("http", 80, 8080)
web_config.vm.provision :chef_client do |chef|
@harlanbarnes
harlanbarnes / knife_cookbook_site_install.sh
Created February 4, 2012 19:57
svn version of knife cookbook site install
#!/bin/bash
cookbook="$1"
if [ -z "$cookbook" ];
then
echo "ERROR: script needs a cookbook as an arg"
exit 1
fi
SVN_REPO='https://svn-host/svn-repo'
@harlanbarnes
harlanbarnes / agent.conf
Created March 28, 2012 17:31
XML filter for Logstash
input {
stdin {
debug => true
type => default
add_field => [ "xml", "%{@message}" ]
}
}
filter {
xml {
@harlanbarnes
harlanbarnes / gist:2560083
Created April 30, 2012 17:12
rpmbuild-md5 error
[makerpm@localhost ~]$ rpmbuild-md5 -bs ~/rpmbuild/SPECS/zabbix.spec
error: Failed build dependencies:
mysql-devel is needed by zabbix-1.8.12-1.x86_64
postgresql-devel is needed by zabbix-1.8.12-1.x86_64
net-snmp-devel is needed by zabbix-1.8.12-1.x86_64
openldap-devel is needed by zabbix-1.8.12-1.x86_64
gnutls-devel is needed by zabbix-1.8.12-1.x86_64
iksemel-devel is needed by zabbix-1.8.12-1.x86_64
unixODBC-devel is needed by zabbix-1.8.12-1.x86_64
curl-devel >= 7.13.1 is needed by zabbix-1.8.12-1.x86_64
<html>
<head>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="550" border="0" cellpadding="25" cellspacing="0" bgcolor="#b4b4b4">
<tbody>
<tr>
<td>
<div style="background-color:#b4b4b4; width:471px; margin:20px auto; padding:10px 30px">
<table id="shell" width="471" border="0" cellpadding="0" cellspacing="0">
@harlanbarnes
harlanbarnes / gist:5752227
Created June 10, 2013 20:57
oracle java jdk tar/gunzip unexpected EOF
mkdir("/tmp/d20130610-1497-jyjm25", 0700) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
pipe([8, 9]) = 0
fstat(8, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
fstat(9, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
fcntl(8, F_GETFL) = 0 (flags O_RDONLY)
fstat(8, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffef44a540) = -1 EINVAL (Invalid argument)
fcntl(9, F_GETFL) = 0x1 (flags O_WRONLY)
fstat(9, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
site :opscode
metadata
cookbook 'pgirepo', chef_api: :config
group :integration do
cookbook "minitest-handler"
end
@harlanbarnes
harlanbarnes / homework.rb
Created September 26, 2013 00:04
Homework
#!/usr/bin/ruby
# our dictionary file
WORDS = 'english.txt'
# build the letter-to-point map
letters = Hash.new
count = 0
('a'..'z').to_a.each do |x|
count += 1