Skip to content

Instantly share code, notes, and snippets.

View andre's full-sized avatar

Andre Lewis andre

View GitHub Profile
@andre
andre / postfix_queue_plugin.rb
Created June 20, 2012 18:26
Postfix plugins for Scout (untested)
class PostfixQeueuePlugin < Scout::Plugin
def build_report
queue_status = `/usr/sbin/postqueue -p`
lines=queue_status.split("\n")
reasons=Hash.new(0)
lines.each do |line|
if line =~ /\s(.*)/
if line.match(/:25: (.*)\)/)
reason=$1.downcase.gsub(" ","_")
{
"completed_in": 0.062,
"max_id": 204603591661596672,
"max_id_str": "204603591661596672",
"next_page": "?page=2&max_id=204603591661596672&q=blue%20angels&rpp=5&include_entities=1&result_type=mixed",
"page": 1,
"query": "blue+angels",
"refresh_url": "?since_id=204603591661596672&q=blue%20angels&result_type=mixed&include_entities=1",
"results": [{
"created_at": "Mon, 21 May 2012 16:04:32 +0000",
mysql-slow.log.2:# Time: 120428 6:32:15
mysql-slow.log.2:# Time: 120428 6:37:14
mysql-slow.log.2:# Time: 120428 6:42:15
mysql-slow.log.2:# Time: 120428 6:47:15
mysql-slow.log.2:# Time: 120428 6:52:15
mysql-slow.log.2:# Time: 120428 6:57:15
mysql-slow.log.2:# Time: 120428 7:02:16
mysql-slow.log.2:# Time: 120428 7:06:20
mysql-slow.log.2:# Time: 120428 7:07:16
mysql-slow.log.2:# Time: 120428 7:12:17
Apache Server Status for localhost
Server Version: Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with
Suhosin-Patch Phusion_Passenger/2.2.15
Server Built: Apr 13 2010 19:28:27
__________________________________________________________________
Current Time: Friday, 20-May-2011 11:46:05 PDT
Restart Time: Friday, 25-Mar-2011 17:38:18 PDT
warning: Could not find object file "/Users/lrz/src/macruby-0.10/ext/openssl/openssl_missing.o" - no debug information available for "openssl_missing.c".
warning: Could not find object file "/Users/lrz/src/macruby-0.10/ext/openssl/ossl.o" - no debug information available for "ossl.c".
warning: Could not find object file "/Users/lrz/src/macruby-0.10/ext/openssl/ossl_asn1.o" - no debug information available for "ossl_asn1.c".
warning: Could not find object file "/Users/lrz/src/macruby-0.10/ext/openssl/ossl_bio.o" - no debug information available for "ossl_bio.c".
warning: Could not find object file "/Users/lrz/src/macruby-0.10/ext/openssl/ossl_bn.o" - no debug information available for "ossl_bn.c".
# Multiple, concurrent HTTP (non-SSL) requests
#
# Works in macuruby
require 'net/http';
def do_https
http=Net::HTTP.new('www.yahoo.com', 80)
http.start() {|http|
req = Net::HTTP::Get.new('/')
#!/bin/sh
#
# killspike2
# Remove (presumably erroneous) peaks from RRD files
#
# Matt Zimmerman <[email protected]>, 05/2002
#
set -e
# Takes an IP or hostname. Reports 1 if it can ping the host, 0 if it can't
class Ping < Scout::Plugin
OPTIONS=<<-EOS
host:
name: Host
notes: the IP address or hostname to ping
EOS
def build_report
@andre
andre / nokogiri_test.rb
Created January 26, 2011 20:11
This will crash macruby inconsistently with "incorrect checksum for freed object - object was probably modified after being freed."
require "rubygems"
require "nokogiri"
puts "starting"
html=<<-EOS
<div class="result">
<div>
<h1>
>> MySQLTuner 1.0.1 - Major Hayden
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.41-3ubuntu12.3
[OK] Operating on 32-bit architecture with less than 2GB RAM
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in InnoDB tables: 267M (Tables: 9)