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
| delay = 0 | |
| 10000.times do |i| | |
| worker = MyIronWorker.new | |
| worker.queue(:delay=>delay) | |
| delay += 30 # add thirty seconds | |
| 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
| puts 'it worked!' | |
| puts 'here are the params: ' + $params.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
| description "thin" | |
| version "1.0" | |
| author "Travis Reeder" | |
| env LANG=en_US.UTF-8 | |
| env APP_HOME=/home/ubuntu/myapp | |
| respawn | |
| start on runlevel [23] |
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
| users = User.all | |
| users_for_worker = [] | |
| users.each_with_index do |user, i| | |
| # Queue up a task every 100 | |
| if i > 0 && i % 100 == 0 | |
| puts "#{i} Queueing worker..." | |
| worker = NotificationWorker.new | |
| worker.users = users_for_worker | |
| # set other attributes that your worker needs to run | |
| worker.queue |
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 'cgi' | |
| require 'yaml' | |
| require 'hipchat-api' | |
| cgi_parsed = CGI::parse(payload) | |
| log "cgi_parsed: #{cgi_parsed.inspect}" | |
| parsed = JSON.parse(cgi_parsed['payload'][0]) | |
| log "parsed: #{parsed.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
| { | |
| "token": "MY_TOKEN", | |
| "project_id": "MY_PROJECT_ID" | |
| } |
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
| gem 'delayed_job_ironmq' |
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
| using System; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Collections.Generic; | |
| using System.Web.Script.Serialization; | |
| public class HelloWorld | |
| { | |
| static public void Main(string[] args) | |
| { |
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
| # Install charlock_holmes gem: | |
| # sudo gem install charlock_holmes | |
| # Set filename below and run script. | |
| require 'charlock_holmes' | |
| contents = File.read("documents.txt") | |
| detection = CharlockHolmes::EncodingDetector.detect(contents) | |
| p detection | |
| new_contents = CharlockHolmes::Converter.convert contents, detection[:encoding], 'UTF-8' |
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
| iron_worker upload max_worker --max-concurrency 100 |