Skip to content

Instantly share code, notes, and snippets.

View geemus's full-sized avatar

Wesley Beary geemus

View GitHub Profile
@geemus
geemus / gist:1248281
Created September 28, 2011 15:45
2012 Fukuoka Ruby Award Competition

Details on the competition: http://www.myfukuoka.com/events/2012-fukuoka-ruby-award-competition

Outline

Explain briefly functions and feature.

fog provides a consistent, simple interface to many cloud services. Whether utilizing computing, DNS, storage or other cloud resources, fog's simple interface helps new users get started quickly and easily, find the best provider for their needs, and migrate easily when those needs change. Because of it's open source license and the community built around it, fog also allows for quick extension of its interface when new cloud products and features are released.

@geemus
geemus / addendum.markdown
Created September 1, 2011 20:26
API - Assumptions Probably Incorrect
@geemus
geemus / see also
Created August 16, 2011 15:10
vim installation
# on ubuntu, ensure appropriate ruby-dev is also installed
hg clone https://vim.googlecode.com/hg/ vim
cd vim
./configure --enable-multibyte --enable-rubyinterp
make && make install
@geemus
geemus / fog_virtualbox.rb
Created March 14, 2011 21:08
simple example of using virtualbox
require 'fog'
compute = Fog::Compute.new(:provider => 'VirtualBox')
server = compute.servers.create(:name => 'lucid', :os => 'Ubuntu')
medium = compute.mediums.create(:device_type => :hard_disk, :location => '/Users/geemus/geemus/virtualbox_poc/lucid.vmdk', :read_only => false)
storage_controller = server.storage_controllers.create(:bus => :sata, :name => 'sata')
storage_controller.attach(medium, 0)
@geemus
geemus / 0_rackspace.rb
Created December 6, 2010 07:46
fog or: How I Learned to Stop Worrying and Love the Cloud (examples)
server_data = compute.create_server(
1,
49
).body['server']
until compute.get_server_details(
server_data['id']
).body['server']['status'] == 'ACTIVE'
end
@geemus
geemus / Gemfile
Created November 22, 2010 22:45
fog - resume uploading example
source "http://rubygems.org"
gem 'fog'
# Optimized regex for finding urls
# Top level domain list from: http://data.iana.org/TLD/tlds-alpha-by-domain.txt
/(?:^|\s)(?:http[s]?:\/\/)?(?:www\.)?([-a-zA-Z_\.]*\.(?:a(?:[cdfgilmnoqtuwxz]|e(?:ro)?|r(?:pa)?|s(?:ia)?)|b(?:[abdefghjmnorstvwyz]|i(?:z)?)|c(?:[cdfghiklmnruvxyz]|a(?:t)?|o(?:m|op)?)|d(?:[ejkmoz])|e(?:[cegrstu]|du)|f(?:[ijkmor])|g(?:[abdefghilmnpqrstuwy]|ov)|h(?:[kmnrtu])|i(?:[delmoqrst]|n(?:fo|t)?)|j(?:[emp]|o(?:bs)?)|k(?:[eghimnprwyz])|l(?:[abcikrstuvy])|m(?:[acdeghklmnpqrstvwxyz]|il|o(?:bi)?|u(?:seum)?)|n(?:[cfgilopruz]|a(?:me)?|e(?:t)?)|o(?:m|rg)|p(?:[aefghklmnstwy]|r(?:o)?)|q(?:a)|r(?:[eosuw])|s(?:[abcdeghijklmnortuvyz])|t(?:[cdfghjklmnoptvwz]|el|r(?:avel)?)|u(?:[agksyz])|v(?:[aceginu])|w(?:[fs])|xn--(?:0zwm56d|11b5bs3a9aj6g|80akhbyknj4f|9t4b11yi5a|deba0ad|g6w251d|hgbk6aj7f53bba|hlcj6aya9esc7a|jxalpdlp|kgbechtv|zckzah)|y(?:[etu])|z(?:[amw]))(?:[\/]?|(?:[\/]??[-a-zA-Z_\.\/?=&]*)))(?:[,\!\.\?])?(?:\s|$)/iu
module Base
module_function
BASE_CHARACTERS = '0123456789BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz'
def encode(int)
str = ''
while int > 0
character = int % BASE_CHARACTERS.length
int = int / BASE_CHARACTERS.length
str = BASE_CHARACTERS[character..character] + str