Quickie: Creating a new EC2 instance with the AWS-SDK for Ruby version 2

Because the documentation for the version 2 SDK has made this incredibly unclear, here you go. ec2 = Aws::EC2::Client.new(region: ‘us-west-2′) res = Aws::EC2::Resource.new(client: ec2) #remove dry_run: true from the parameters to actually create an instance inst = res.create_instances(image_id:’ami-123456’, min_count:1, max_count:1, instance_type: ‘t1.micro’, dry_run: true) Some helpful methods on the instance returned: inst.public_ip_address inst.state inst.data To … [Read more…]

Tech and feminism

Anyone who knows me would know that I am not particularly militant when it comes to feminism. I am not a man-hater. I like men. I have many menfriends. I married one. I think they’re neat. But crap like this happens, and I have to say something: http://stoptechfeminism.tumblr.com/ Talking about acts of sexual assault at tech … [Read more…]

Checking your SSL Certificate setup

Had a problem recently where the SSL cert expired and I didn’t add the intermediate certs when putting the new one in an EC2 instance. Made for some annoying troubleshooting. This service will check your setup and make sure everything is correct: http://www.digicert.com/help/

Ruby on Rails and FTPS

If you’re unlucky enough to have to connect to an FTPS server (SFTP ends up being much easier), the Double Bag FTPS gem makes things much easier. A few finer points to note: “verify_mode: OpenSSL::SSL::VERIFY_NONE” makes your life easier in development mode – not to mention some FTPS sites won’t even have one Most servers don’t … [Read more…]

Avoiding Ruby hash conditionals in Ruby on Rails

This gets really old: if params[:teacher] && params[:teacher][:id] … so instead, do this: if params[:teacher].try(:[], :id) or do it a lot more: name = params[:company][:owner][:name] if params[:company] and params[:company][:owner] and params[:company][:owner][:name] turns into: name = params.try(:[], :company).try(:[], :owner).try(:[], :name) Yay for Stack Overflow!