Skip to content

Instantly share code, notes, and snippets.

View adimircolen's full-sized avatar

Adimir Colen adimircolen

View GitHub Profile
#!/usr/local/bin/ruby
#
# Keeps backups for odrible for the last 7 days
#
# Assumes backups are stored in the dir referenced by the
# constant BACKUP_DIR.
#
# Assumes backup file names are in the formats '20101217002634.mysql-backup-sftp-odrible2.sql.gz.enc'
require 'date'
@adimircolen
adimircolen / aws_cf_invalidate.rb
Created November 22, 2011 22:20 — forked from objectoriented/aws_cf_invalidate.rb
Ruby script to invalidate objects on Amazon's CloudFront CDN (shows status of recent requests also)
require 'rubygems'
require 'hmac-sha1' # on OS X: sudo gem install ruby-hmac
require 'net/https'
require 'base64'
#
# CHANGE ME: S3 access credentials go here, along with CloudFront Distribution ID
#
s3_access=''
s3_secret=''
#!/usr/bin/env ruby
git_bundles = [
"git://github.com/astashov/vim-ruby-debugger.git",
"git://github.com/msanders/snipmate.vim.git",
"git://github.com/scrooloose/nerdtree.git",
"git://github.com/scrooloose/syntastic.git",
"git://github.com/timcharper/textile.vim.git",
"git://github.com/tpope/vim-cucumber.git",
"git://github.com/tpope/vim-fugitive.git",
@adimircolen
adimircolen / customer.rb
Created May 6, 2011 20:16
validates_associated
class Customer < ActiveRecord::Base
has_many :projects
validates :name, :presence => true
validates :cnpj, :presence => true, :format => { :with => /^\d{2}.?(\d{3}.?){2}\/\d{4}-?\d{2}$/ }
end
# Ruby 1.9
require 'rubygems'
require 'eventmachine'
##require 'lib/environment' # here we go again!
##require 'sequel'
EM.kqueue = true if EM.kqueue? # file watching requires kqueue on OSX
module Example < EM::Connection
def receive_data(data)
require 'rubygems'
require 'eventmachine'
##require 'lib/environment' # here we go again!
EM.kqueue = true if EM.kqueue? # file watching requires kqueue on OSX
class Example < EM::Connection
def receive_data(data)
#BlockConn.fila.size+1
Example.queue.push "#{data}"