Skip to content

Instantly share code, notes, and snippets.

@jmcnevin
jmcnevin / sort_movies.rb
Created January 30, 2011 22:14
Sorts a collection of files into folders based on the show name. I use this for TV episodes.
#!/usr/bin/env ruby -wKU
require 'fileutils'
TV_DIR = File.expand_path("~/Movies/TV")
EP_PATTERN = /^([a-z\.]+)\.((?:S[\d]+E[\d]+)|(?:[\dx\.]+))\..+\.(?:avi|mkv|mp4|mpg|mpeg)$/i
files = Dir[File.join(TV_DIR,'*')]
files.each do |f|
@jmcnevin
jmcnevin / s3_bucket_copy.rb
Created March 19, 2010 18:49
Will duplicate contents of one Amazon S3 bucket into another.
require 'rubygems'
require 'aws/s3'
require 'logger'
AWS::S3::S3Object.class_eval do
def self.copy_across_buckets(src_bucket, src_key, dest_bucket, dest_key, options = {})
src_bucket = bucket_name(src_bucket)
dest_bucket = bucket_name(dest_bucket)
source_key = path!(src_bucket, src_key)
@jmcnevin
jmcnevin / main.cf
Created March 13, 2010 08:43
Adds VERP support to NET::SMPT
# Add this line to your postfix main.cf file to add VERP support.
smtpd_authorized_verp_clients = $mynetworks