Skip to content

Instantly share code, notes, and snippets.

View vitaliel's full-sized avatar

Vitalie Lazu vitaliel

  • Moldova, Chisinau
View GitHub Profile
#!/usr/bin/env ruby
# $File: apache_status_parser.rb $
# Created by Vitalie Lazu on Mon, 05 Nov 2007 20:28:57 +0200
# Using hpricot to parse apache server status and kill processes that takes too much time to complete
#
# Debian/Ubuntu setup:
# apt-get install rubygems
# gem install hpricot --no-ri --no-rdoc
require 'rubygems'
require 'roo'
s = Excel.new("price-dd.xls")
s.default_sheet = s.sheets.first
#puts s.info
i = s.first_row
#!/usr/bin/env ruby
require 'net/http'
require 'optparse'
require 'timeout'
require 'cgi'
# Source: http://pastie.org/98642
# Post code for review
# Author: Vitalie Lazu
# Date: Mon, 01 Dec 2008 14:28:28 +0200
# Rake tasks to help you with family photos:
# * Download photos from camera
# * Arrange photos in folders by date like digikam,
# * Rotate them according exif information
#
# Setup to use this tasks:
# apt-get install rubygems imagemagick gphoto2 rake
#!/usr/bin/env ruby
#
# Author: Vitalie Lazu <vitalie.lazu@gmail.com>
# 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']
link_to_remote("Post a comment", :update => "wiki-comment-form", :url => {:action => "show_add_comment", :id => @space, :wiki_id => @wiki_version},
:before => visual_effect(:appear, "load_dots", :queue => 'end'),
:complete => visual_effect(:fade, "load_dots") + visual_effect(:fade, 'flows-w') + visual_effect(:appear, 'wiki-comment-form', :queue => 'end'))
encodeURIComponent(location.href)
Form.getInputs(form, 'radio', name).each(function(input) {
if (input.value == value) {
input.checked = true
#
# 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"
# 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}~"
# 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
# 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