Skip to content

Instantly share code, notes, and snippets.

View ezmobius's full-sized avatar

Ezra Zygmuntowicz ezmobius

View GitHub Profile
(master)⚡)% ls
Gemfile foo.rb
(master)⚡)% cat foo.rb
require 'sinatra'
require 'pp'
get '/' do
"<pre>#{ENV.pretty_inspect}</pre>"
end
(master)⚡)% vmc runtimes
Ruby on Rails Technical Advocate for VMware
VMware’s Developer Relations team is seeking a Ruby on Rails Technical Advocate
for Cloud Foundry, the industry’s first open platform as a service and a
platform.
• As an Advocate you will act as a bridge between the ruby on rails developer
community and VMware Cloud Foundry product team.
• As the Technical Advocate the primary scope of your role is to support and
Ruby on Rails Technical Advocate for VMware
VMware’s Developer Relations team is seeking a Ruby on Rails Technical Advocate for Cloud Foundry, the industry’s first open platform as a service and a platform.
As an Advocate you will act as a bridge between the ruby on rails developer community and VMware Cloud Foundry product team. As the Technical Advocate the primary scope of your role is to support and nurture the Ruby on Rails development community and to build awareness of Cloud Foundry to make it the platform of choice for Ruby on Rails developers.
To simplify you will help ruby on rails developers succeed because they help advance the cause and benefits of VMware’s Cloud Foundry.
How will you advocate?
You will partner with VMware’s marketing team to edit existing content and produce original content (papers, sample applications, tutorials, screen casts, etc.) about Ruby on Rails and Cloud Foundry. This content will help educate the larger enterprise development community about the benefits of Cloud
# use fog to bootstrap a Rackspace cloud server
# since it does not have user-data like ec2
@compute = Fog::Compute.new(...)
server = @compute.servers.create(....)
server.wait_for { ready? }
server.private_key = IO.read("~/.ssh/foo")
require 'pp'
app = Proc.new do |env|
[200, {'Content-Type' => 'text/html'}, ["<html><body><h1>hello</h1><pre>#{env.pretty_inspect}</pre></body></html>"]]
end
map "/" do
run app
end
dsfsdfdsf
# chef library for booting a Thin server during the chef-client or chef-solo run
# that returns JSON status messages of what the recipes run is currently working on
# comes in handy if you have a small tool that pushes recipes with ssh to a server
# and runs then, you can use rest-client or something like it to poll the status
# server for status, the status server requires a shared secret token during the run
# in order to poll it and only runs while the chef client/solo run is going and dies
# when the client run is over so its not always on. Also it runs the thin server
# within the chef process rather then requiring a whole separate process.
# feel free to use this under the MIT license
require 'redis'
require 'json'
module RedActor
class Actor
class << self
def mailbox(queue, &blk)
RedActor.queues ||= {}
RedActor.queues[queue.to_s] = [self, blk]
$ mkdir env && cd env
$ cat «EOF > envvars.rb
require ‘sinatra’
require ‘pp’
get ‘/’ do
“<pre>#{ENV.pretty_inspect}</pre>”
end
EOF
$ vmc push …
require 'sinatra'
require 'pp'
require 'redis'
require 'json'
configure do
redis = JSON.parse(ENV['VMC_SERVICES']).select {|srvc| srvc['name'] =~ /redis-.*?/ }.first['options']
redis_conf = {:host => redis['hostname'], :port => redis['port'], :password => redis['password']}
@@redis = Redis.new redis_conf