Skip to content

Instantly share code, notes, and snippets.

View Farzy's full-sized avatar

Farzad FARID Farzy

View GitHub Profile
@Farzy
Farzy / irb3.rb
Created October 31, 2011 15:15 — forked from peterc/irb3.rb
irb3 - Run an IRB-esque prompt over multiple Ruby implementations at once using RVM
#!/usr/bin/env ruby
# encoding: utf-8
# irb3 - Runs an IRB-esque prompt (but it's NOT really IRB!) over multiple
# versions of Ruby at once (using RVM)
#
# By Peter Cooper, BSD licensed
#
# Main dependency is term-ansicolor for each impl:
# rvm exec gem install term-ansicolor
@Farzy
Farzy / rvm-your-chef.rb
Created July 8, 2010 08:35 — forked from adamhjk/rvm-your-chef.rb
Chef - Invoke rvm and inherit the environment updates
# Check this out, rvm use rbx
ruby_block "rvm use rbx" do
block do
Chef::Mixin::Command.popen4('bash -l -c "rvm use 1.9.1 && env"') do |p,i,o,e|
o.each_line do |line|
env_bits = line.split("=")
ENV[env_bits[0]] = env_bits[1]
end
end
class Chef
module Mixin
module Language
# esearch(:node, 'role\[admin\]')
# recursively search for this role/recipe in all roles
def esearch(context, search)
if context == :role
ret = []
# First solve all roles:
roles = search(:role, search)
@Farzy
Farzy / gemspec
Created May 13, 2010 19:45 — forked from defunkt/gemspec
Quickly create a gemspec
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
#
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
#
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
#
#! /usr/bin/ruby
require 'chef/config'
require 'chef/search/query'
require 'chef/log'
require 'time'
require 'getoptlong'
require "ohai"
RET = {
#!/usr/bin/env ruby
# Use dot separated pathspec:
# ./cooto.rb mysql.datadir
# /var/lib/mysql
require 'rubygems'
require 'chef/client'
require 'ohai'
@Farzy
Farzy / clients.md
Created April 18, 2010 21:34 — forked from defunkt/clients.md
Gist clients

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@Farzy
Farzy / gist:256933
Created December 15, 2009 13:24 — forked from jsierles/gist:100837
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'
# Please see the readme for overview documentation.
#
#!/usr/bin/env ruby
#
# Author: Vitalie Lazu <[email protected]>
# Date: Sat, 10 Jan 2009 19:12:43 +0200
#
# CLI ruby client for Tracks: rails application for GTD methodology
# http://www.getontracks.org/development/
# You need to set ENV['GTD_LOGIN'], ENV['GTD_PASSWORD']