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
cd /vcap | |
git clone https://github.com/cloudfoundry/cf-release.git | |
cd ./cf-release | |
git remote add yuanying https://github.com/yuanying/cf-release.git | |
git pull yuanying master | |
From https://github.com/yuanying/cf-release | |
* branch master -> FETCH_HEAD |
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
--- | |
name: cfos | |
director_uuid: XXXX-XXXX-XXXX-XXXX # CHANGE | |
release: | |
name: appcloud | |
version: 128 | |
compilation: | |
workers: 3 |
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 -wKU | |
# Syncronize from Garmin Connect to Runkeeper | |
require 'rubygems' | |
require 'runkeeper' | |
require 'rss/1.0' | |
require 'rss/2.0' | |
require 'rss/dublincore' | |
require 'open-uri' | |
require 'uri' | |
require 'cgi' |
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 'openstack/compute' | |
class OpenStack::Compute::Connection | |
def list_keypairs(options = {}) | |
anti_cache_param="cacheid=#{Time.now.to_i}" | |
path = OpenStack::Compute.paginate(options).empty? ? "#{svrmgmtpath}/os-keypairs?#{anti_cache_param}" : "#{svrmgmtpath}/os-keypairs?#{OpenStack::Compute.paginate(options)}&#{anti_cache_param}" | |
response = csreq("GET",svrmgmthost,path,svrmgmtport,svrmgmtscheme) | |
OpenStack::Compute::Exception.raise_exception(response) unless response.code.match(/^20.$/) | |
OpenStack::Compute.symbolize_keys(JSON.parse(response.body)["keypairs"]) |
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 -wKU | |
framework 'AddressBook' | |
def check_email from | |
#http://developer.apple.com/mac/library/DOCUMENTATION/UserExperience/Reference/AddressBook/Miscellaneous/AddressBook_Constants/Reference/reference.html | |
book = ABAddressBook.sharedAddressBook | |
me = book.me | |
book.people.each do |person| | |
if person == me |
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
namespace :deploy do | |
unicorn_start_script = "cd #{current_path} && BUNDLE_GEMFILE=#{current_path}/Gemfile bundle exec unicorn_rails -c #{current_path}/config/unicorn.rb -E production -D" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "#{unicorn_start_script}" | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do | |
run "kill -KILL -s QUIT `cat #{shared_path}/pids/unicorn.pid`" | |
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
#!/usr/bin/env ruby -wKU | |
require 'rubygems' | |
require 'rss/1.0' | |
require 'rss/2.0' | |
require 'rss/dublincore' | |
require 'open-uri' | |
require 'uri' | |
require 'cgi' | |
require 'optparse' |
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
module Mail | |
require 'iconv' | |
class Ruby18 | |
def Ruby18.b_value_decode(str) | |
match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m) | |
if match | |
encoding = match[1] | |
str = Ruby18.decode_base64(match[2]) | |
str = Ruby18.force_encode_to_default str, encoding |
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
// create toc from contents to target. | |
// # dependency | |
// - jquery | |
// # how to use | |
// <script> | |
// $(function() { createToc('#contents', '#toc'); }); | |
// </script> | |
// <div id='toc'></div> | |
// <div id='contents> <h1>...</h1></h2>...</h2>...</div> | |
var createToc = function(contents_selector, target_selector){ |
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 -wKU | |
# PDF to Zip file (including jpg files) script. | |
# sudo port install rb-cocoa | |
# sudo gem install zipruby | |
require 'osx/cocoa' | |
require 'rubygems' | |
require 'fileutils' | |
require 'zipruby' | |