Skip to content

Instantly share code, notes, and snippets.

View ansonK's full-sized avatar

Anson Kelly ansonK

View GitHub Profile
#!/usr/bin/env osascript
(*
Script to set a HTML email signature in Mail.app
Before doing anything the script will:
* Check that the os version is 10.10
* There is at least 1 Mail account
If either of these checks fails the script will exit
@ansonK
ansonK / gist:e01f1559ae078bb8b4a8
Created July 1, 2015 13:21
Manually set Rails 4 session cookie for tests
#
# Manually set the contents of an encrypted session cookie
#
# Uses the same encryption keys as the Rails app using devise
#
# Based off http://big-elephants.com/2014-01/handling-rails-4-sessions-with-go/
# Verified against https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/cookies.rb
#
class TestSession
@ansonK
ansonK / gist:7771276
Created December 3, 2013 15:34
Quick and dirty way of transferring enqueued sidekiq jobs from a non-namespaced sidekiq environment to a namespaced one
no_namespace_redis = Sidekiq::RedisConnection.create({ url: ENV['REDISCLOUD_URL'] })
namespace_redis = Sidekiq::RedisConnection.create({ url: ENV['REDISCLOUD_URL'], namespace: "#{ENV['SIDEKIQ_NAMESPACE'] || Rails.env}" })
Sidekiq.instance_variable_set "@redis", no_namespace_redis
Sidekiq::Stats.new.queues
queue_names = Sidekiq::Stats.new.queues.select {|k,v| v.to_i > 0 }.keys
puts "Queue Names: #{queue_names.inspect}"