Skip to content

Instantly share code, notes, and snippets.

Avatar

Katsunori KAWAGUCHI hamakn

View GitHub Profile
@hamakn
hamakn / node.rb
Created Nov 28, 2011
services/mysql/lib/mysql_service/node.rb
View node.rb
def gen_credential(name, user, passwd)
response = {
"name" => name,
"hostname" => @mysql_config['hostname'],
"host" => @mysql_config['host'],
"port" => @mysql_config['port'],
"user" => user,
"username" => user,
"password" => passwd,
}
@hamakn
hamakn / observer.js.coffee
Created Dec 17, 2011
js2coffee sample http://js2coffee.org/ (javascript pattern observer sample)
View observer.js.coffee
makePublisher = (o) ->
i = undefined
for i of publisher
o[i] = publisher[i] if publisher.hasOwnProperty(i) and typeof publisher[i] is "function"
o.subscribers = any: []
publisher =
subscribers:
any: []
@hamakn
hamakn / index.rb
Created May 15, 2012
show service environment (id, pw, host, dbname)
View index.rb
require 'rubygems' # for ruby18
require 'sinatra'
require 'json'
require 'yaml'
get '/' do
"<h1>Hello Tamac.io!!</h1>"
end
get '/version' do
@hamakn
hamakn / cloud.rb
Created Jul 26, 2012
workaround for micro bosh northeast region
View cloud.rb
# /var/vcap/packages/director/bosh/director/vendor/bundle/ruby/1.9.1/gems/bosh_aws_cpi-0.6.0/lib/cloud/aws/cloud.rb
#aki = find_aki(architecture, root_device_name)
aki = "aki-ee5df7ef"
# we could set :description here, but since we don't have a
# handle to the stemcell name and version, we can't set it
# to something useful :(
image_params = {
:name => "BOSH-#{generate_unique_name}",
@hamakn
hamakn / config
Created Sep 3, 2012
check vcap-staging BUNDLE_WITHOUT option
View config
---
BUNDLE_DISABLE_SHARED_GEMS: "1"
BUNDLE_WITHOUT: test
BUNDLE_PATH: vendor/bundle
View gist:3775410
# coding: utf-8
terms = %w(わかんない え? 分かった まじで?)
final_term = "わかんないけどわかった!"
(3 + rand(7)).times {
print terms.sample
print "、"
}
puts final_term
View .gemrc
gem: --no-ri --no-rdoc
:sources:
#- http://rubygems.org/
- http://production.s3.rubygems.org/
@hamakn
hamakn / nokogiri.rb
Created Nov 22, 2012
suburi of nokogiri
View nokogiri.rb
# coding: utf-8
require "nokogiri"
# Nokogiriの素振り
# <hosts>
# <host address="localhost">
# </hosts>
# を
# <hosts>
# <host address="172.16.0.1">
@hamakn
hamakn / gist:4174848
Created Nov 30, 2012
Rails4勉強用
View gist:4174848
View gist:4266887