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
public MagickImage resized(int width, int height){ | |
MagickImage result = new MagickImage(width, height); | |
int originalWidth = this.getWidth(); | |
int originalHeight = this.getHeight(); | |
int maxSize = Math.max(width, height); | |
float scaleFactor = 1.0f; | |
if (originalWidth > originalHeight) | |
scaleFactor = ((float) maxSize / (float) originalWidth); |
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
# Install deps | |
package "libfuse-dev" | |
package "libcurl4-openssl-dev" | |
package "libxml2-dev" | |
# Download & Install | |
wget http://s3fs.googlecode.com/files/s3fs-r177-source.tar.gz | |
tar xvzf s3fs-r177-source.tar.gz |
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
namespace :deploy do | |
desc "Restarts each app role one at a time, removing from load balancing during restart" | |
serial_task self, :rolling_restart, :roles => :app do | |
lb = fetch(:load_balancer) | |
lb_removal = lambda { `elb-deregister-instances-from-lb #{lb} --instances #{@instance_id}` } | |
lb_addition = lambda { `elb-register-instances-with-lb #{lb} --instances #{@instance_id}` } | |
watch = "rails" | |
port = 8080 |
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
#!/bin/sh | |
echo "Starting memcached in background..." | |
memcached & | |
echo "Starting OpenMQ broker in background..." | |
imqbrokerd -silent & | |
echo "Starting background_tasks queue processor in background..." | |
jruby script/queue_processor >/dev/null 2>&1 & | |
echo "Starting Jetty Rails..." | |
jruby --headless -S jetty_rails |
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
require "jruby" | |
module JettyRails | |
class Runner | |
attr_reader :servers | |
def initialize(config = {}) | |
@servers = {} | |
config.symbolize_keys! |
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
pool :involver_rails do | |
cloud :nginx do | |
instances 2..2 # binds against 2 elastic IPs | |
has_package "nginx" | |
end | |
cloud :app do | |
instances 2..12 | |
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
# Following adds a svn co of my_app to /mnt/svn-repos/my_app on cloud-start | |
# svn up is run on the working copy every cloud-configure | |
has_svn_repos :name => "my_app", | |
:at => "/mnt/svn-repos", | |
:source => "http://svn.myhost.com/my_app", | |
:user => "<optional>", | |
:password => "<optional>" |
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
pool :sandbox do | |
instances 1..1 | |
cloud :hello_world do | |
# Update with the path to your EC2 keypair | |
# If you don't have one, create with: | |
# $ ec2-create-keypair NAME > /path/to/your/keypairs/<NAME> | |
keypair "/path/to/your/keypairs/<NAME>" | |
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
class Greeter | |
attr_accessor :greeting | |
def initialize(greeting) | |
self.greeting = greeting | |
end | |
def greet | |
puts self | |
end |
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
puts "Hello World" |