Skip to content

Instantly share code, notes, and snippets.

View thbishop's full-sized avatar

Tommy Bishop thbishop

View GitHub Profile
# Packaging ruby with fpm is a bit meta
# You need ruby install to use fpm
# I used an RVM install on a VM install fpm in a packaging gemset
# Install EPEL if you don't have it already
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# Install deps for ruby build
yum install rpm-build readline-devel.x86_64 libffi-devel.x86_64 libyaml-devel.x86_64 zlib-devel.x86_64 openssl-devel.x86_64
bash -c '
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
yum install -q -y sudo gcc gcc-c++ automake autoconf make readline-devel.x86_64 libffi-devel.x86_64 libyaml-devel.x86_64 zlib-devel.x86_64 openssl-devel.x86_64 wget
# This may not be necessary for you
yum remove -q -y ruby-libs ec2-ami-tools
wget http://someurl.domain.com/ruby-1.9.2p180_x86_64.rpm -O /tmp/ruby-1.9.2p180_x86_64.rpm
yum localinstall --nogpgcheck -q -y /tmp/ruby-1.9.2p180_x86_64.rpm
require 'cinch'
module MyBot
module Plugins
class Foo
include ::Cinch::Plugin
match "foo"
def execute(m)
module MyBot
module Plugins
class Hello
include ::Cinch::Plugin
match "hello"
def execute(m)
m.reply "Hello, #{m.user.nick}"
end
@thbishop
thbishop / foo.rb
Created March 28, 2011 15:52
calling the mailer
@user = User.invite_without_notification!
@group = Group.find_by_name('foo')
@group.memebers << @user
GroupMailer.welcome_invitation(@group, @user).deliver
class Group < ActiveRecord::Base
has_many :group_memberships, :dependent => :destroy
has_many :members, :through => :group_memberships, :source => :user
end
@thbishop
thbishop / boom_completion.sh
Created January 14, 2011 18:27
provides tab completion for boom (bash)
_boom_complete() {
local cur prev lists
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
lists=`boom | awk '{print $1}'`
case "${prev}" in
boom)
$boom test
Boom! Created a new list called "test".
$boom test foo bar
Boom! "foo" in "test" is "bar". Got it.
$boom test foo blah
Boom! "foo" in "test" is "blah". Got it.
$boom test foo
@thbishop
thbishop / map_syslog_priorities.rb
Created December 21, 2010 21:30
Creates a facility/severity map of all of the possible syslog priorities
facility = { 0 => 'kern',
1 => 'user',
2 => 'mail',
3 => 'daemon',
4 => 'auth',
5 => 'syslog',
6 => 'lpr',
7 => 'news',
8 => 'uucp',
9 => 'cron',
debian01:/usr/lib/ruby/1.8/chef# gem sources
*** CURRENT SOURCES ***
http://gems.rubyforge.org/
debian01:/usr/lib/ruby/1.8/chef# gem install httpclient
ERROR: could not find gem httpclient locally or in a repository
debian01:/usr/lib/ruby/1.8/chef# gem install httpclient
debian01:/usr/lib/ruby/1.8/chef# gem search -r httpclient
*** REMOTE GEMS ***