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 | |
# Script to help with rails migrations | |
cmd = "rake db:migrate" | |
rev = ARGV[0].to_i | |
if rev > 0 | |
cmd << " VERSION=#{rev}" |
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
# collect information about a running process | |
# ruby debug.rb <pid> | |
begin | |
raise ArgumentError unless pid = ARGV[0] | |
pid = pid.to_i | |
raise ArgumentError unless pid > 0 | |
Process.kill(0,pid) | |
rescue TypeError, ArgumentError | |
raise 'pid required' |
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 'svn/info' | |
repo = 'sa_cp33' | |
rev = 19 | |
path = nil | |
for i in 1..6 | |
path = "/var/svn#{i}/#{repo}" | |
if test ?d, path | |
break |
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 | |
# Author: Vitalie Lazu | |
# Date: Mon, 21 Sep 2009 17:59:50 +0300 | |
# | |
# Starling status plugin for nagios | |
require 'rubygems' | |
# needs memcache-client gem | |
require "memcache" | |
require 'optparse' |
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/ruby | |
# Usage: | |
# ruby extract_l.rb cc.csv ids.txt > new_cc.csv | |
lines = IO::readlines(ARGV[0]).map {|x| x.chomp! } | |
ids = IO::readlines(ARGV[1]).map {|x| x.chomp! } | |
lines.shift |
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
# Output with command | |
# git log --format="//%h/%ae/%ai/%s" --name-only --relative="iChart ASP.net/" -- iChart ASP.net/ | |
# | |
class GitBrowseInfo | |
def initialize(str) | |
@str = str | |
end | |
def parse |
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
# add chars at beginning, last should be \\ | |
BAD_URL_CHARS = "<>\"'\r\n #:/&;,%.=?\\" | |
# This id will be used in links | |
def to_param | |
if new_record? | |
"new-milestone" | |
else | |
"#{id}-#{title.tr(BAD_URL_CHARS, "-")}" | |
end |
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
# build server role map | |
task :test_me, :roles => :web do |t| | |
srv_roles = {} | |
for role, values in t.roles | |
values.map do |s| | |
srv_roles[s.host] ||= [] | |
srv_roles[s.host] << role | |
end | |
end |
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
# replace string in files recursively. | |
# author: Vitalie Lazu | |
s = ARGV[0] | |
r = ARGV[1] | |
FILES = /\.(rb|erb|rhtml|rake|yml|rjs|rxml)$/ | |
def suggest_bak(file) | |
bak = "#{file}~" |
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
# | |
# Helper tasks to build debian packages from git repository | |
# | |
# apt-get install git-buildpackage | |
# Create local branches | |
# $ rake deb:setup | |
# create a snapshot | |
# $ rake snap | |
branch = "snapshot" |