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
# Generate logrotate conf for rails sites deployed with capistrano | |
# it scans current directory for rails site, it assumes that webserver is passenger | |
# cd /u/apps && ~/bin/gen_logrotate.rb | |
require 'etc' | |
Dir['*'].each do |entry| | |
next unless File.directory? entry | |
dir = File.expand_path entry | |
log_dir = dir + "/shared/log" |
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 | |
# Read database.yml file and generate sql to create databases | |
# ./rails_db_create.rb | mysql | |
require 'yaml' | |
config = YAML.load_file 'database.yml' | |
dbs = {} |
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
desc "create TAGS file for emacs, vim" | |
# sudo apt-get install exuberant-ctags | |
task :tags do | |
rm_f "TAGS" | |
# ctags-exuberant -a -e -f TAGS --tag-relative -R app lib vendor | |
cmd = RUBY_PLATFORM =~ /darwin/i ? "/usr/local/bin/ctags -e" : "etags" | |
dirs = %w{app lib test} |
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
module AdminHelper | |
def field_must_be_slug(element, separator = '-') | |
render :update do |page| | |
page << <<-rawJS | |
var element = $('#{element.to_s}'); | |
new Form.Element.Observer(element, 0.02, function(){ | |
element.value = element.getValue().toLowerCase().gsub(/[^a-z0-9\\d\\s\\s+\\#{separator}]+/, '').gsub(/\\s+/,'#{separator}'); | |
}); | |
rawJS |
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
Failures: | |
1) Mailman ticket create with attachment | |
Failure/Error: Mailman.receive(str) | |
Encoding::UndefinedConversionError: | |
"\x89" from ASCII-8BIT to UTF-8 | |
# ./lib/email_utils.rb:205:in `save_attachment' | |
# ./lib/tools/ticket_tool.rb:396:in `block in parse_email' | |
# ./lib/tools/ticket_tool.rb:396:in `each' | |
# ./lib/tools/ticket_tool.rb:396:in `parse_email' |
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 | |
# Copy path from rspect stack trace and execute it | |
# spm ./spec/models/space_spec.rb:867 | |
path = ARGV[0] | |
file, number, _ = path.split ':' | |
number = number.to_i | |
line = number > 0 ? " -l #{number}" : "" |
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
# gerrit.config for custom gitweb | |
[gitweb] | |
type = custom | |
url = http://www.assembla.com/code/ | |
revision = ${project}/git/nodes/?rev=${commit} | |
project = ${project}/git/nodes/ |
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 | |
# Convert videos to mp4 for my TV | |
def convert(ext) | |
# ext = "ogv" | |
files = Dir["*.#{ext}"] | |
files.each do |file| | |
out = "#{file.gsub(/#{ext}$/, '')}mp4" |
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/perl | |
# Usage: $0 [email protected] | |
$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!"; | |
@data = qx</usr/sbin/postqueue -p>; | |
for (@data) { | |
if (/^(\w+)(\*|\!)?\s/) { | |
$queue_id = $1; |
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 L | |
# Simple replacer to bundler gem | |
# Sample config file | |
=begin | |
rails,2.2.3 | |
rcov | |
rdiscount | |
uuidtools,1.0.7 |