Workers to ensure all objects in a S3 bucket have the 'public-read' canned ACL permission. Designed to work with iron.io's IronWorker product to use it's scalable workers to set the permissions quickly and afforably.
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
| adduser 3.113ubuntu2 | |
| apt 0.8.16~exp12ubuntu10.2 | |
| apt-utils 0.8.16~exp12ubuntu10.2 | |
| aspell 0.60.7~20110707-1 | |
| aspell-en 6.0-0-6ubuntu2 | |
| autoconf 2.68-1ubuntu2 | |
| automake 1:1.11.3-1ubuntu2 | |
| autotools-dev 20120210.1ubuntu1 | |
| base-files 6.5ubuntu6.2 | |
| base-passwd 3.5.24 |
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
| iced@iced test % cat test.worker | |
| exec 'test.rb' | |
| iced@iced test % cat test.rb | |
| puts config.inspect | |
| puts "YO!" | |
| iced@iced test % iron_worker upload test --worker-config test.json | |
| ------> Creating client | |
| Project 'Test' with id='517baf16ed3d7607990013a0' | |
| ------> Creating code package | |
| Found workerfile with path='test.worker' |
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
| brews = [] | |
| out = IO.popen("brew list", "r") do |io| | |
| brews = io.read.split "\n" | |
| end | |
| def parse(brew, brew_info) | |
| in_options = false | |
| print "brew reinstall -v #{brew} " | |
| brew_info.split("\n").each do |m| | |
| #puts m.inspect |
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 | |
| require 'net/https' | |
| require 'json' | |
| # a simple wrapper to do an HTTP GET | |
| def fetch_uri(uri) | |
| uri = URI(uri) | |
| Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http| | |
| http.verify_mode = OpenSSL::SSL::VERIFY_NONE |
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
| def mode(array) | |
| count = Hash.new(0) | |
| array.each { |element| count[element] += 1 } #count how many times an element[s] appears the most | |
| # element of the array => number of times element occured in an array | |
| # ex. {5 => 2, 6 =>2, 7 =>1} | |
| max = count.values.max | |
| count.keep_if { |key, val| val == max} | |
| # count is {5 => 2, 6 =>2} | |
| count.keys #return an array of those elements | |
| end |
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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
| $stack, $draws = [], {} | |
| def method_missing *args | |
| return if args[0][/^to_/] | |
| $stack << args.map { |a| a or $stack.pop } | |
| $draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
| end | |
| class Array | |
| def +@ |
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
| body { | |
| background-color: #7A060C; | |
| } | |
| #wrapper { | |
| width: 90%; | |
| margin: 200px auto; | |
| } | |
| h1 { |
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
| ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
| html = %(<div class="field_with_errors">#{html_tag}</div>).html_safe | |
| # add nokogiri gem to Gemfile | |
| elements = Nokogiri::HTML::DocumentFragment.parse(html_tag).css "label, input" | |
| elements.each do |e| | |
| if e.node_name.eql? 'label' | |
| html = %(<div class="clearfix error">#{e}</div>).html_safe | |
| elsif e.node_name.eql? 'input' | |
| if instance.error_message.kind_of?(Array) | |
| html = %(<div class="clearfix error">#{html_tag}<span class="help-inline"> #{instance.error_message.join(',')}</span></div>).html_safe |
NewerOlder