This file contains hidden or 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 'json' | |
| require 'httparty' | |
| class Github | |
| include HTTParty | |
| base_uri 'http://github.com/api/v2/json' | |
| # @param [String] username GitHub username | |
| # @param [String] password Password or API token | |
| def initialize(username, password) |
This file contains hidden or 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 'rubygems' | |
| require 'httparty' | |
| require 'HTTMultiParty' | |
| require 'base64' | |
| # This is a quick example to demonstrate the use of ruby to interact with the Specify API. | |
| # I am a beginner rubyist, so please excuse my rudimentary code! | |
| # Depends on httparty for clean and simple API wrapper code https://github.com/jnunemaker/httparty | |
| # Depends on httpmultiparty to allow image and file uploads https://github.com/jwagener/httmultiparty |
This file contains hidden or 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
| { | |
| "_id": "a58af3e3e43733657152f59865021e0f", | |
| "_rev": "28-c7d4a44d4c176886cf742ebec4876550", | |
| "classes": [ | |
| "balancer" | |
| ], | |
| "host": "example.com", | |
| "directors": [ | |
| { | |
| "name": "temp", |
This file contains hidden or 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 'net/ssh' | |
| desc "Deploy site to production" | |
| task :deploy => :environment do | |
| host = 'yourhost.com' | |
| user = 'username' | |
| options = {:keys => '~/.ssh/keys/yourserver.pem'} | |
| remote_path = '/path/to/rails_app' | |
| commands = [ |
This file contains hidden or 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
| # www.fduran.com | |
| # hardware stress test | |
| # mismatched md5sums shows a faulty disk/RAM | |
| # time depends on hardware, ex: 1 sec per 100 count | |
| dd if=/dev/zero of=/tmp/test.file bs=1M count=1000 | |
| for i in {1..5}; do md5sum /tmp/test.file; done |
This file contains hidden or 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
| # | |
| # sorted_json.rb | |
| # Puppet module for outputting json in a sorted consistent way. I use it for creating config files with puppet | |
| require 'json' | |
| def sorted_json(json) | |
| if (json.kind_of? String) | |
| return json.to_json | |
| elsif (json.kind_of? Array) |
This file contains hidden or 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
| :username: caspyin | |
| :password: PASSWD |
This file contains hidden or 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 | |
| REMOTE_HOST = "" | |
| USER = "" | |
| SOURCE = "" | |
| DESTINATION = "backup/" | |
| vm_list = `vmrun list`.split("\n") | |
| vm_list.shift |
This file contains hidden or 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
| # User omniauth with the omniauth-basecamp strategy to authenticate. And, store the token that you receive. | |
| # To connect to the API create an instance of the wrapper: | |
| # @basecamp = Basecamp.new(token), at this point only .accounts will work, use that get the account | |
| # id of the account you want to connect. After that, just passs the accout id to the connection, @basecamp = Basecamp.new(token, account_id) | |
| # and feel free to call any method. | |
| # | |
| # By Javier Carballo, javier@javier.im. | |
| class Basecamp | |
| def initialize(token, account_id = nil, app = nil) | |
| @token = token |
This file contains hidden or 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
| if $cloudify_service != undef { | |
| case $cloudify_service { | |
| 'mysql' : { | |
| class { '::mysql::server': | |
| root_password => 'strongpassword', | |
| } | |
| } | |
| } | |
| } |
OlderNewer