This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :prevent_brainfart_apocalypse do | |
raise "You're running in production" if Rails.env.production? | |
end | |
protect_me_from_myself_tasks = %W(db:setup) | |
protect_me_from_myself_tasks.each do |task_name| | |
Rake::Task[task_name].prerequisites << 'prevent_brainfart_apocalypse' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# 1. Install the gem. | |
# | |
# 2. Test by attaching a stompcat[1] client and running this: | |
# | |
# /path/to/notify-service-by-stomp.rb mq.example.com \ | |
# /topic/xeriom.nagios.services.checks service-host.example.com \ | |
# "FSCK" WARNING HARD 86492 6 6 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# Run me like this: | |
# | |
# ./stompcat.rb mq.example.com /topic/foo.bar.baz.quux | |
# | |
require 'rubygems' | |
require 'smqueue' | |
require 'json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Talk to IRC from Ruby via IRCCat. | |
require 'socket' | |
class IRC | |
def self.say(message) | |
command = "#xeriom [#{process_name}]: #{message}\n" | |
socket.send(command, 0) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SUDOERS: xm list --long [a-z0-9\-\.]+ | |
CRITICAL_UPTIME_BOUNDARY=3600 # 1 hour | |
WARNING_UPTIME_BOUNDARY=86400 # 1 day | |
if [ -d /var/vm ]; then | |
VM=`echo $1 |sed 's/\.vm\.xeriom\.net//'` | |
else | |
VM=$1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cat /usr/local/sbin/irccat | |
#! /usr/bin/env ruby | |
require 'socket' | |
message = "#xeriom #{STDIN.read}" | |
socket = TCPSocket.new('monitor.xeriom.net', 12345) | |
socket.send(message, 0) | |
socket.close |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
CRITICAL_USE=90 | |
WARNING_USE=80 | |
if [ -d /var/vm ]; then | |
VM_DEVICE_DIR="/var/vm/store" | |
VM=`echo $1 |sed 's/\.vm\.xeriom\.net//'` | |
VM_DEVICE="${VM_DEVICE_DIR}/$VM.img" | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm not sure how to remove it safely, but you can see the feeds it'll query here: | |
$ cd ~/Library/PubSub/Database | |
$ sqlite3 ./Database.sqlite3 | |
# sqlite> select * from Feeds; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run like this: | |
# sudo ruby -rubygems what_connects.rb 3000 | |
# | |
require 'socket' | |
serv = TCPServer.new(ARGV[0].to_i) | |
begin | |
sock = serv.accept_nonblock | |
rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR | |
IO.select([serv]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Nagios service check skeleton. | |
# | |
# Note that you can put more than one line of output in the message, | |
# and you can include check performance data if you'd like. | |
# | |
# Technical details here: | |
# http://nagios.sourceforge.net/docs/3_0/pluginapi.html | |
# | |
if okay? |