Skip to content

Instantly share code, notes, and snippets.

Vladimir Rybas vrybas

Block or report user

Report or block vrybas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rmultirename.rb
if ((ARGV[0] == nil) || (ARGV[0] == '--help'))
puts "Usage: rmultirename [PATTERN] [REPLACEMENT]"
printf "Example: rmultirename htm html \n\n"
STDOUT.sync = true
vrybas / sleeptill
Created Sep 25, 2009
Improved system 'sleep'. Could be used like: $ sleeptill 1 7 30 && mplayer -o loop superannoyingringer.mp3 =)
View sleeptill
# == SleepTill ==
# Improved system 'sleep'. Could be used like:
# $ sleeptill 1 7 30 && mplayer -o loop superannoyingringer.mp3 =)
require 'rubygems'
require 'active_support'
View csv2gdoc_slimtimer_parser.rb
#!/usr/bin/env ruby
@log_entries =
IO.foreach(ARGV[0]) do |line|
date,start_time,end_time,task,comments,duration = line.scan(/(?:^|,)(\"(?:[^\"]+|\"\")*\"|[^,]*)/).flatten
@log_entries << "#{date.chomp}\t#{duration.chomp.gsub('.',',')}\t#{task.chomp}"
puts @log_entries[1..-2]
# Original script is taken from
# It downloads World Sunlight Map every hour, and you could use it as wallpaper.
# I've added ImageMagick line to put your city on the map. Just change 'convert' parameters:
# '-size' - to set screen size
# '-annotate' - to set city name(two times)
# '-geometry' - to set your city position on the map
# Add to autostart and set your wallpaper to ~/world_sunlight_Wallpaper.jpg
# requires wget and ImageMagick
View rspec_authlogic.rb
require "authlogic/test_case"
before(:each) do
View data_grabbing.rb
# -------------------- Taking a peron name from E-mail header
# === Returns Hash with firstname, lastname, and email from String:
# String "John Smith < >" will produce hash pairs:
# :firstname => "John",
# :lastname => "Smith",
# :email => ""
View nginx.conf
user app;
worker_processes 2;
error_log /home/app/logs/nginx.error.log info;
events {
worker_connections 1024;
View deletable.rb
module Deletable
def self.included(base)
base.class_eval do
named_scope :are, :conditions => ['`deleted_at` IS NULL']
named_scope :deleted, :conditions => ['`deleted_at` IS NOT NULL']
named_scope :deleted_at, lambda {|timestamp| {:conditions => ['`deleted_at` = ?',timestamp.to_formatted_s(:db)]}}
View production.pill
Bluepill.application("yourapp", :log_file => "/home/user/www/yourapp/shared/log/bluepill.log") do |app|
app.process("delayed_job") do |process|
process.working_dir = "/home/user/www/yourapp/current"
process.start_grace_time = 10.seconds
process.stop_grace_time = 10.seconds
process.restart_grace_time = 10.seconds
process.start_command = "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'RAILS_ENV=production ruby /home/user/www/yourapp/current/script/delayed_job start'"
process.stop_command = "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'RAILS_ENV=production ruby /home/user/www/yourapp/current/script/delayed_job stop'"
View deploy_with_bluepill.rb
# Bluepill related tasks
namespace :bluepill do
desc "Stop processes that bluepill is monitoring and quit bluepill"
task :quit, :roles => [:app] do
#run "cd #{release_path} && rvmsudo bundle exec bluepill stop"
#run "cd #{release_path} && rvmsudo bundle exec bluepill quit"
run "rvmsudo bluepill stop"
run "rvmsudo bluepill quit"
You can’t perform that action at this time.