This file contains 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 | |
require "open3" # for reading stderr | |
# A dirt-simple script to merge a pull request from someone on github. | |
# Andre Lewis, 2009 | |
# | |
# Assumptions: | |
# 1. you're currently working on master | |
# 2. you've already reviewed the pull request and have decided to include it. |
This file contains 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
# Drop this file in config/initializers to run your Rails project on Ruby 1.9. | |
# This is three separate monkey patches -- see comments in code below for the source of each. | |
# None of them are original to me, I just put them in one file for easily dropping into my Rails projects. | |
# Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes | |
# that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's | |
# true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9. | |
# | |
# Andre Lewis 1/2010 | |
# encoding: utf-8 |
This file contains 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
# Quick and dirty applescript to determine batter life under very light load. This script just navigates Safari to a | |
# page every 10 seconds to simulate web browsing. | |
# | |
# You'll need to change the file output path (in the log method) for your machine. | |
# | |
# The test: | |
# * a freshly charged and calibrated battery | |
# * dim brightness to 50% | |
# * turn off bluetooth | |
# * set display to never go to sleep |
This file contains 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
# MySQL Statistics by Eric Lindvall <[email protected]> | |
# MySQLTuner integration by Andre Lewis <@[email protected]> | |
class MysqlQueryStatistics < Scout::Plugin | |
ENTRIES = %w(Com_insert Com_select Com_update Com_delete) | |
OPTIONS=<<-EOS | |
user: | |
name: MySQL username |
This file contains 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
>> 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) |
This file contains 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
require "rubygems" | |
require "nokogiri" | |
puts "starting" | |
html=<<-EOS | |
<div class="result"> | |
<div> | |
<h1> |
This file contains 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
# 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 |
This file contains 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
#!/bin/sh | |
# | |
# killspike2 | |
# Remove (presumably erroneous) peaks from RRD files | |
# | |
# Matt Zimmerman <[email protected]>, 05/2002 | |
# | |
set -e |
This file contains 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
# 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('/') |
This file contains 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
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". |
OlderNewer