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
server_data = compute.create_server( | |
1, | |
49 | |
).body['server'] | |
until compute.get_server_details( | |
server_data['id'] | |
).body['server']['status'] == 'ACTIVE' | |
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
sudo apt-get install libdjvulibre-dev libjpeg-dev libtiff-dev libwmf-dev libmagickcore-dev libmagickwand-dev libmagick++-dev rvm | |
sudo gem install rmagick | |
ok! | |
Fetching: rmagick-2.13.1.gem (100%) Building native extensions. This could take a while ... Successfully installed rmagick-2.13.1 1 gem installed | |
require 'RMagick' #=> true |
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
AWS_ACCESS_KEY_ID="YOURAWSACCESSKEYID" | |
AWS_SECRET_KEY="YOURAWSSECRETKEY" | |
EC2_REGION=$(wget -q -O - http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}') | |
EC2_INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id) | |
EC2_CLOUDWATCH_NAMESPACE='WebService' | |
NGINX_CONNECTIONS=$(wget -q -O - http://127.0.0.1/nginx_status | grep 'connections' | awk '{print $3}') | |
/usr/bin/mon-put-data --region \"$EC2_REGION\" --metric-name HttpConnections --namespace \"$EC2_CLOUDWATCH_NAMESPACE\" --dimensions \"InstanceId=$EC2_INSTANCE_ID\" --value \"$NGINX_CONNECTIONS\" -I \"$AWS_ACCESS_KEY_ID\" -S \"$AWS_SECRET_KEY\" |
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
# Put this into lib/tasks | |
require 'rubygems' | |
require 'bundler' | |
require 'aws-sdk' | |
require 'socket' | |
require 'os' | |
if Rails.env.development? |
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 'rubygems' | |
require 'chef/encrypted_data_bag_item' | |
secret = Chef::EncryptedDataBagItem.load_secret('data_bag_key') | |
data = {"id" => "mysql", "root" => "some secret password"} | |
encrypted_data = Chef::EncryptedDataBagItem.encrypt_data_bag_item(data, secret) | |
FileUtils.mkpath('data_bags/passwords') | |
File.open('data_bags/passwords/mysql.json', 'w') do |f| | |
f.print encrypted_data.to_json |
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
# if ask "Do you want to do something?"; then | |
# echo "Yes" | |
# else | |
# echo "No" | |
# fi | |
# | |
# # Default to No if the user presses enter without giving an answer: | |
# if ask "Do you want to do something?" N; then | |
# echo "Yes" | |
# else |
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
# redirect http to https | |
set $redirect ""; | |
if ($http_x_forwarded_proto != 'https') { | |
set $redirect "1"; | |
} | |
if ($http_user_agent !~* ELB-HealthChecker) { | |
set $redirect "${redirect}1"; | |
} | |
if ($http_host ~ "your-nifty-domain.com") { | |
set $redirect "${redirect}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
gem 'concurrent' |
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 | |
Dir.chdir File.join(__FILE__, "../..") | |
unless ENV['EDITOR'] | |
puts "No EDITOR found. Try:" | |
puts "export EDITOR=vim" | |
exit 1 | |
end | |
unless ARGV.count == 2 |
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
# Rake task to launch multiple Resque workers in development/production with simple management included | |
require 'resque/tasks' # Require Resque tasks | |
namespace :workers do | |
# = $ rake workers:start | |
# | |
# Launch multiple Resque workers with the Rails environment loaded, | |
# so they have access to your models, etc. |
OlderNewer