Skip to content

Instantly share code, notes, and snippets.

f = File.open('sinatra.log', 'r')
hashes = []
str = ""
toggle = false
f.each_line do |line|
if line.match(/ \{.*/)
toggle = true
end
module HoptoadNotifier
def logger
if defined?(Rails.logger)
Rails.logger
elsif defined?(RAILS_DEFAULT_LOGGER)
RAILS_DEFAULT_LOGGER
else
Logger.new(STDOUT)
end
end
@gmcinnes
gmcinnes / install_leopard_tamer.sh
Created October 26, 2010 19:01
Installs LeopardTamer to your machine
#!/bin/bash
# Use the system ruby for now, if rvm is installed
if [ `which rvm` != "" ]; then
rvm use system
fi
# Install chef
sudo gem install chef
@gmcinnes
gmcinnes / install_lion_tamer.sh
Created October 26, 2010 19:50
Installs LionTamer to your machine
echo ""
echo "TAMING YOUR LION"
echo "This may take a while. Don't panic"
echo ""
# Use the system ruby for now, if rvm is installed
if [ "`which rvm`" != "" ]; then
rvm use system
fi
@gmcinnes
gmcinnes / gist:1282978
Created October 12, 2011 23:52
Output of "brew install -vd cmake"
Grant-McInnes-MaRS-Corp:~/Developer/Library/Formula(master) gmcinnes$ brew install -vd cmake
==> Downloading http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
File already downloaded in /Users/gmcinnes/Library/Caches/Homebrew
/usr/bin/tar xf /Users/gmcinnes/Library/Caches/Homebrew/cmake-2.8.6.tar.gz
==> ./bootstrap --prefix=/Users/gmcinnes/Developer/Cellar/cmake/2.8.6 --system-libs --no-system-libarchive --datadir=/share/cmake --docdir=/share/doc/cmake --mandir=/share/man
./bootstrap --prefix=/Users/gmcinnes/Developer/Cellar/cmake/2.8.6 --system-libs --no-system-libarchive --datadir=/share/cmake --docdir=/share/doc/cmake --mandir=/share/man
---------------------------------------------
CMake 2.8.6, Copyright 2000-2009 Kitware, Inc.
C compiler on this system is: /usr/bin/llvm-gcc -O3 -march=core2 -w -pipe
C++ compiler on this system is: /usr/bin/llvm-g++ -O3 -march=core2 -w -pipe
@gmcinnes
gmcinnes / chef-client debug output
Created November 1, 2011 14:59
chef-client template update issue
root@jeos:/var/cache/chef/cookbooks/nagios/templates/default# chef-client -l debug
[Tue, 01 Nov 2011 10:09:45 -0400] INFO: *** Chef 0.10.4 ***
[Tue, 01 Nov 2011 10:09:45 -0400] DEBUG: Loading plugin os
[Tue, 01 Nov 2011 10:09:45 -0400] DEBUG: Loading plugin kernel
[Tue, 01 Nov 2011 10:09:45 -0400] DEBUG: Loading plugin ruby
[Tue, 01 Nov 2011 10:09:45 -0400] DEBUG: Loading plugin languages
[Tue, 01 Nov 2011 10:09:45 -0400] DEBUG: ---- Begin ruby -e "require 'rbconfig'; puts %Q(release_date=#{RUBY_RELEASE_DATE},ruby_bin=#{::File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])},target_cpu=#{::Config::CONFIG['target_cpu']},host_os=#{::Config::CONFIG['host_os']},target_vendor=#{::Config::CONFIG['target_vendor']},target_os=#{::Config::CONFIG['target_os']},platform=#{RUBY_PLATFORM},host=#{::Config::CONFIG['host']},host_cpu=#{::Config::CONFIG['host_cpu']},target=#{::Config::CONFIG['target']},version=#{RUBY_VERSION},bin_dir=#{::Config::CONFIG['bindir']},host_vendor=#{::Config::CONFIG['host_vend
@gmcinnes
gmcinnes / chef-client -ldebug
Created November 11, 2011 18:49
Chef client bug
root@jeos:~# cat output.txt
[Fri, 11 Nov 2011 13:35:04 -0500] INFO: *** Chef 0.10.6.beta.3 ***
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: Loading plugin os
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: Loading plugin kernel
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: Loading plugin ruby
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: Loading plugin languages
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: ---- Begin ruby -e "require 'rbconfig'; puts %Q(ruby_bin=#{::File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])},target_cpu=#{::Config::CONFIG['target_cpu']},host_os=#{::Config::CONFIG['host_os']},target_vendor=#{::Config::CONFIG['target_vendor']},target_os=#{::Config::CONFIG['target_os']},platform=#{RUBY_PLATFORM},host_cpu=#{::Config::CONFIG['host_cpu']},host=#{::Config::CONFIG['host']},target=#{::Config::CONFIG['target']},version=#{RUBY_VERSION},bin_dir=#{::Config::CONFIG['bindir']},host_vendor=#{::Config::CONFIG['host_vendor']},release_date=#{RUBY_RELEASE_DATE},)" STDOUT ----
[Fri, 11 Nov 2011 13:35:04
@gmcinnes
gmcinnes / gist:1561356
Created January 4, 2012 18:28
default_unless broken example?
# /backups/attributes/client.rb
# Jankily set a random time between midnight and 6am
hours = rand(6)
minutes = rand(59)
minutes = "0#{minutes}" if minutes < 10
random_time = "0#{hours}:#{minutes}"
default_unless['backups']['start_time'] = "everyday at #{random_time}"
default['backups']['extra_includes'] = []
default['backups']['extra_excludes'] = []
default['backups']['external_backup_user'] = 'external-backup'
Grant-McInnes-MaRS-Corp:~/chef-repo/tasks(master) gmcinnes$ knife bootstrap 10.101.1.223 --distro=centos5-gems --ssh-user=root --ssh-password=password
Bootstrapping Chef on 10.101.1.223
10.101.1.223 --2012-01-11 11:50:17-- http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
10.101.1.223 Resolving download.fedora.redhat.com...
10.101.1.223 209.132.181.26, 209.132.181.27, 209.132.181.23, ...
10.101.1.223 Connecting to download.fedora.redhat.com|209.132.181.26|:80...
10.101.1.223 connected.
10.101.1.223 HTTP request sent, awaiting response...
10.101.1.223 200 OK
10.101.1.223 Length: 12232 (12K) [application/x-rpm]
#
# Cookbook Name:: postgresql
# Recipe:: server
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Lamont Granquist (<lamont@opscode.com>)
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.