Skip to content

Instantly share code, notes, and snippets.

View arreyder's full-sized avatar

Christopher Rhodes arreyder

View GitHub Profile
all_env = search(:node, "chef_environment:#{node.chef_environment}").map do |n|
unless n[:network][:ipaddress_eth0] == local_ip
n[:network][:ipaddress_eth0]
end
end.compact
@arreyder
arreyder / gist:2785092
Created May 25, 2012 00:36
Scribe Decode using tshark
#!/usr/bin/perl
# run me like so:
# tshark -i eth0 -n port 1465 -T fields -eframe.time -edata.data | ./scribe_decode2.pl
use MIME::Base64;
use Term::ANSIColor qw(:constants);
while (<>){ ($ts,$hex) = split(/\t/,$_,);
$hex=~s/://g;
while ($hex =~ /(.{2})/sg) { $hexstring .= chr (hex($1)); };
$hexstring =~ s/[^[:print:]]+/ /g;
@arreyder
arreyder / gist:2785078
Created May 25, 2012 00:32
Scribe Decode using perl modules for capture.
#!/usr/bin/perl
# scribe_decode.pl <dev> <port>
use Net::Pcap;
use NetPacket::Ethernet;
use NetPacket::IP;
use NetPacket::TCP;
use MIME::Base64;
use Term::ANSIColor qw(:constants);
use strict;
A guy gets a flat tire in front of a mental hospital.
As he's putting on the spare, the four nuts for securing the tire to the car accidentally fall down a storm grate. He's distraught because he doesn't know what to do.
A mental patient watching the whole episode from behind a fence says: "Why don't you just take one nut off each of the other three tires and put the spare on with those? That should hold you until you get to a service station."
The man is amazed. What a great idea!
Then he says, "But you're a mental patient. How'd you think of something so clever?"
The patient says, "I'm just crazy, not stupid."
if node[:hostname] =~ /-api0/
targets = ""
search(:node, "name:*-maas-#{node[:ele][:env]}-api*") do |n|
unless node[:ele][:datacenter] == n[:ele][:datacenter]
targets << " #{n[:hostname]}"
end
end
cron "cross_dc_latency_check" do
minute "*/2"
node[:network][:interfaces][:eth0][:addresses].find do |addr, addr_info|
addr_info[:family] == "inet"
end
@arreyder
arreyder / gist:1672193
Last active September 29, 2015 21:37
Technologies Used
https://github.com/facebook/scribe We move messages and logs around with this.
http://nodejs.org/ Messenger, Inserter, API and the cli are written in Node.js
http://www.opscode.com/chef/ Configuration management.
http://git-scm.com/ What we use for source and config management.
http://esper.codehaus.org/ The CEP service uses this engine for event correlation.
{ "run_list": ["recipe[ckdev::distcache]", "role[base]", "recipe[ele-base::dev]","recipe[ele-api::dev]", "recipe[ele-messenger::dev]", "recipe[ele-inserter::dev]", "recipe[ele-cep::dev]", "recipe[ele-ingestor::dev]", "recipe[reconnoiter-noit::dev]","recipe[reconnoiter-stratcon::dev]", "recipe[scribe::dev]", "recipe[zookeeper::dev]", "recipe[cassandra::binary]"] }
Some helium floats into a bar. The bartender says, "Get out! We don't serve any noble gases in this bar." Helium doesn't react.
A neutrino walks into a bar. The bartender says, "Get out! We don't serve any neutrinos in this bar." The neutrino says, "Don't mind me; I'm just passing through."
A room temperature superconductor walks into a bar. The bartender says, "Get out! There are no superconductors allowed in this bar." The room temperature superconductor leaves without putting up any resistance.
Two bacteria walk into a bar. The bartender says, "Get out! We don't serve any bacteria in this bar. The two bacteria say, "Hey, but we work here. We're staff."
Schrödinger's cat walks into a bar... and doesn't.
A parasite walks into a bar. The bartender says, "Get out! No parasite are welcome in this bar." The parasite says, "Well, you're not a very good host."
nodes = []
search(:node,"name:*maas-stage* AND chef_environment:Staging").each do |n|
unless n.rackspace.public_ip == node.rackspace.public_ip
nodes << n.rackspace.public_ip
end
end
iptables_rule "all_environment" do
variables(
:nodes => nodes
)