Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kareemk on github.
  • I am kareemk (https://keybase.io/kareemk) on keybase.
  • I have a public key ASBYQi-KTvbRsu6QyCJU5WN5l4MJynanyKVNXTrqOoxTnwo

To claim this, I am signing this object:

@kareemk
kareemk / dssh
Created April 24, 2015 13:57
Docker Exec over SSH for Tutum
#!/usr/bin/ruby
require 'net/http'
require 'json'
raise "Invalid arguments: dssh [container-name] [command=/bin/bash]" if ARGV.length < 1
service_name = "#{ARGV[0]}"
ARGV[1] ||= "/bin/bash"
command = ARGV[1..-1].join(' ')
["Welcome", "Lean Meetup", "MVP", "Ux", "Lean", "Startup", "Fail", "Beta", "Pivot", "Model", "Founder", "Wireframe", "Usability", "Cust. Dev", "Agile", "Waterfall", "Hypothesis", "Validate", "Learned", "Beta", "Alpha", "Angel", "Raise", "Vc", "Round", "Funding", "Customer", "Product", "Fit", "Metrics", "Retention", "Hiring", "Exit", "Eric", "Steve ", "4 steps", "Cto", "Designer", "Discovery", "iPhone", "App", "iPad", "Email", "Tweet"]
@kareemk
kareemk / gist:1102990
Created July 24, 2011 19:31
Stitch-rb Config
class StitchApplication < Stitch::Server
def initialize
settings = YAML.load_file("config/stitch.yml")
super(:paths => settings["paths"], :dependencies => settings["dependencies"])
end
def call(env)
if Rails.env == "production"
[200, {"Content-Type" => "text/javascript"}, [Uglifier.compile(@package.compile)]]
else
@kareemk
kareemk / gist:792134
Created January 23, 2011 15:07
passenger_monitor cookbook
if ['solo','app_master','app'].include?(node[:instance_role])
execute "patch passenger_monitor script" do
command %Q{
sudo replace 'framework_ps_regex="rack"' 'framework_ps_regex="Rack"' -- /engineyard/bin/passenger_monitor
}
not_if 'grep "framework_ps_regex=\"Rack\"" /engineyard/bin/passenger_monitor'
end
cron "passenger_monitor" do
def create
@tip = current_user.tips.build(params[:tip])
@option_string = params[:option_string] || ""
if @tip.valid?
# Try and lookup location if no direct match then prompt user with options
unless @tip.location_id
@locations = Location.find_all_by_name(@tip.location_name) || []
if @locations.empty?
@locations = Location.search(:conditions => {:name => @tip.location_name}, :star => true, :match_mode => :any)
end