Archive for the ‘Internet’ Category.
6th May 2007, 04:04 pm
require ‘rubygems’
require ‘aws/s3′
# Setup Connection
AWS::S3::Base.establish_connection!(
:access_key_id => ‘<access key>’,
:secret_access_key => ‘<secret key>’
)
# Initialize Variables
bucket_name = ‘<bucket name>’
file = ‘<file path>’
timestamp = Time.now.strftime(’%Y%m%d%H%M’)
# Setup Bucket And Save File
AWS::S3::Bucket.create(bucket_name)
AWS::S3::S3Object.store(timestamp + file, open(file), bucket_name)
# List Contents of Bucket
AWS::S3::Bucket.find(bucket_name).each do |current_object|
puts current_object.key
end
2nd May 2007, 10:04 pm
Direct all clean traffic using an exact match on the host.
$HTTP["host"] == “www.<example>.com” {
server.document-root = “/www/sites/<example>.com/www/”
}
Trap all traffic not directed to the main site (regex non-match), then filter remaining traffic headed to the correct domain with the wrong host (regex) and redirect to the main site.
$HTTP["host"] !~ “^(www|mail)\.(<example>\.com)$” {
$HTTP["host"] =~ “(^|.*\.)<example>\.com” {
url.redirect = ( “^/(.*)” => “http://www.<example>.com/” )
}
}
This is an effective defensive technique to guard against redundant content bombing in which a competitor submits URLs containing different hosts with the same domain to search engines making it appear as if the target site has several pages of identical content