Skip to content

Instantly share code, notes, and snippets.

View dylanz's full-sized avatar
🐝

Dylan Stamat dylanz

🐝
View GitHub Profile
<?php
$ironmq = new \IronMQ\IronMQ(array("token" => 'xxxx',"project_id" => 'xxxx'));
$queue_name = "my-handy-push-queue";
$params = array(
"type" => "multicast",
"push" => array(
"subscribers" => array(
array("some-url" => "https://example.com/accept/notification/here", "name" => "http-subscriber"),
array("worker-url" => "ironworker://my-project:xxxxx@xxxxx/process-data", "name" => "worker-subscriber")
curl -X PUT -H "Authorization: OAuth TOKEN" -H "Content-Type: application/json" \
-d '{
"queue" : {
"type": "multicast",
"push": {
"subscribers": [
{"name": "some-url", "url": "https://example.com/accept/notification/here"},
{"name": "worker-url", "url": "ironworker://my-project:xxxxx@xxxxx/process-data"}
],
"retries": 3,
@dylanz
dylanz / Gemfile
Last active December 11, 2017 22:20
gem 'iron_worker'
@dylanz
dylanz / Dockerfile
Created November 22, 2017 04:36
MessageProcessor Dockerfile
FROM iron/ruby
WORKDIR /app
ADD . /app
ENTRYPOINT ["ruby", "message_processor.rb"]
@dylanz
dylanz / message_processor.rb
Created November 22, 2017 04:23
Lookup a message and process it with Sidekiq
class MessageProcessor
include Sidekiq::Worker
def perform(message_id)
Rails.logger.info("Processing message #{message_id}")
message = Message.find_by_id(message_id)
message.process
end
end
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDH2Vjf2ejJamkaiHy0yS9HWOKBBRGI7wMCqnMgw8F9+GnPj9lcDAEkduGNGIOAqtw7/dWBggxKn2NjQhVTSaJlAzuEquE8x1KVqWlBNKifp6p0952vWZosi48kLu3zpjvz6hMNX3WE15gm/6GquoSUjnp+Z+S7BjV36GHsu3di1pMl2xm4mwjW4VVDuLUNq+vRLj7ARPMhAITIGOsGmd9TaYvtHFcbdB4aUKifFSfI1iZPd635g9PN0n6/tJJziCEiPK27onCg4JwR1Y8ADu/ReJYFdMsZ+eR5IX7BJKNbY+iutG0W5KsINGgt7oW/dBk7wqJKbtoAx0T+7MRdo41/CoCQWJQ06g7fUxjHwN/k531hXTZs/a2HaAGEyojiXzQ0J4aPfyDzs/6x5evHmei7Xz+UkTPxfIXkPgQ5qE9bQE0oPA/wrUPi9HAxrxIQC2b7CoOxPeCsbLw1cJ8vXn+d+pOxzNEVJ37nmXbJmyapGIUdhJ+BmfUQCjJdIAPne+fSzqXDelkleyMRslU3fNVOzcY5JXOOA9/IIDiv6P2UbBZA7cEb0Iay3eAtlLmcfFPxxH7vbKNTDz6DMK2pYinmnomHKo2HtSgPrnAVm90oQyQQCDXdWtlcHLeQoEsAjMOZHs+bDaIkXj22nUAl1MAPAaCYv090d/zgPRZSK9Bs6Q== dylan@xenon.io
@dylanz
dylanz / gist:7274580
Created November 2, 2013 01:48
who is mixme.com.br?
10.0.11.xxx: Completed 200 OK in 109ms (Views: 104.4ms | ActiveRecord: 0.0ms)
10.0.11.xxx: Started GET "/" for 192.55.26.79 at 2013-11-02 01:24:57 +0000
10.0.11.xxx: Processing by AppHomeController#index as HTML
10.0.11.xxx: Redirected to https://mixme.com.br/login
10.0.11.xxx: Filter chain halted as :authenticate_user! rendered or redirected
10.0.11.xxx: Completed 302 Found in 2ms (ActiveRecord: 0.0ms)
10.0.11.xxx: Started GET "/login" for 192.55.26.79 at 2013-11-02 01:24:58 +0000
10.0.11.xxx: Processing by SessionsController#new as HTML
10.0.11.xxx: Redirected to https://app-mixme.com.br/login
10.0.11.xxx: Filter chain halted as :ensure_app_domain rendered or redirected
CONNECT: ["s3.amazonaws.com", 443]
CONNECT: ["s3.amazonaws.com", 443]
CONNECT: ["s3.amazonaws.com", 443]
CONNECT: ["s3.amazonaws.com", 443]
Started POST "/agencies/36aff346-f1f5-4517-81ec-90e69994c0ad/users/d04ca3ef-113f-4aa6-ae1f-e3abce7c7e70/image" for 127.0.0.1 at 2012-11-28 10:48:30 -0800
Processing by UsersController#image as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"a6RPf2DLjdKGf5hFyngS1alSWE1ExSg3OHuftkOxMiE=", "uploadedFile"=>#<ActionDispatch::Http::UploadedFile:0x007f9c3421d748 @original_filename="sifu.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"uploadedFile\"; filename=\"sifu.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/gb/_5vd1j5j2bzfz5k2t3qcc7s80000gn/T/RackMultipart20121128-44433-1a6um9d>>, "commit"=>"Upload", "agency_id"=>"36aff346-f1f5-4517-81ec-90e69994c0ad", "id"=>"d04ca3ef-113f-4aa6-ae1f-e3abce7c7e70"}
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."auth_token" = '4HMskzzFMY1sQyaqhKP8Bg' LIMIT 1
CONNECT: ["s3.amazonaws.com", 443]
CONNECT: ["s3.amazonaws.com", 443]
CONNECT: ["s3.amazonaws.com", 443]
CONNECT: ["s3.amazonaws.com", 443]
Started POST "/agencies/36aff346-f1f5-4517-81ec-90e69994c0ad/users/d04ca3ef-113f-4aa6-ae1f-e3abce7c7e70/image" for 127.0.0.1 at 2012-11-28 10:48:30 -0800
Processing by UsersController#image as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"a6RPf2DLjdKGf5hFyngS1alSWE1ExSg3OHuftkOxMiE=", "uploadedFile"=>#<ActionDispatch::Http::UploadedFile:0x007f9c3421d748 @original_filename="sifu.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"uploadedFile\"; filename=\"sifu.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/gb/_5vd1j5j2bzfz5k2t3qcc7s80000gn/T/RackMultipart20121128-44433-1a6um9d>>, "commit"=>"Upload", "agency_id"=>"36aff346-f1f5-4517-81ec-90e69994c0ad", "id"=>"d04ca3ef-113f-4aa6-ae1f-e3abce7c7e70"}
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."auth_token" = '4HMskzzFMY1sQyaqhKP8Bg' LIMIT 1
@dylanz
dylanz / gist:4113604
Created November 19, 2012 20:16
Chef/Ruby
# This runs, but during the loading of the recipes, and not when the cookbook should be run:
#
%w{user1 user2 user3 user4 user5 user6}.each do |u|
puts "I see this output immediately on recipe load"
directory "/home/#{u.name}" do
etc...
end
bash "I think this might be running on recipe load, but not the directory directive above?" do