Skip to content

Instantly share code, notes, and snippets.

View MatthewRDodds's full-sized avatar

Matthew Russell Dodds MatthewRDodds

View GitHub Profile
@MatthewRDodds
MatthewRDodds / gist:0d083bf4a213a34a48fc
Last active August 29, 2015 14:08
Install Elasticsearch Plugin Head
sudo /usr/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head
Sidekiq.redis{ |conn| conn.smembers('queues').map{|q| Sidekiq::Queue.new(q).clear} }; Sidekiq::RetrySet.new.clear
@MatthewRDodds
MatthewRDodds / gist:b19bb2c1532deeb13642
Last active August 29, 2015 14:10
PostgresExt ActiveModelSerializers

With PostgresExt

       user     system      total        real
   0.340000   0.020000   0.360000 (  0.742707)
   0.350000   0.030000   0.380000 (  0.751849)
   0.360000   0.010000   0.370000 (  0.798465)
   0.330000   0.020000   0.350000 (  0.723302)
   0.360000   0.020000   0.380000 (  0.750776)
 0.370000 0.010000 0.380000 ( 0.748968)
@MatthewRDodds
MatthewRDodds / gist:06e1de1c2854272b173f
Last active August 29, 2015 14:11
Clear all named queues
require 'sidekiq'
Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDIS_URL'] }
end
Sidekiq.redis do |conn|
conn.smembers('queues').each do |q|
# Sidekiq::Queue.new(q).clear
puts q
@MatthewRDodds
MatthewRDodds / gist:70e48a76dd02df0ebe56
Created December 16, 2014 18:26
Vagrant Halt SSH key swapping
==> dev: Attempting graceful shutdown of VM...
dev:
dev: Vagrant insecure key detected. Vagrant will automatically replace
dev: this with a newly generated keypair for better security.
dev:
dev: Inserting generated public key within guest...
dev: Removing insecure key from the guest if its present...
dev: Key inserted! Disconnecting and reconnecting using new SSH key...
==> dev: Stopping the VMware VM...
@MatthewRDodds
MatthewRDodds / gist:5592853fde23388d8c76
Last active August 29, 2015 14:11
HGFS kernel module loading error vagrant

Error when starting vagrant

The HGFS kernel module was not found on the running virtual machine. This must be installed for shared folders to work properly. Please install the VMware tools within the guest and try again. Note that the VMware tools installation will succeed even if HGFS fails to properly install. Carefully read the output of the VMware tools installation to verify the HGFS kernel modules were installed properly.

Solution

@MatthewRDodds
MatthewRDodds / gist:0a91fbcf7b1614651dd6
Created December 19, 2014 21:10
find in retryset by queue
Sidekiq::RetrySet.new.find { |job| job.queue == 'queue_name' }
@MatthewRDodds
MatthewRDodds / gist:4a5121498f01ad5d55ea
Created December 23, 2014 15:25
Elasticsearch indexing speed tests

Elasticsearch indexing speed tests

Trying to find the fastest way to index all the things

Iterating over the entire collection and serializing and indexing for each item:

    user     system      total        real
10.630000   0.400000  11.030000 ( 24.820179)
@MatthewRDodds
MatthewRDodds / gist:105b7f55db1ba144343d
Created January 6, 2015 19:10
Super Simple Active Record Example
require 'active_record'
require 'sqlite3'
ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ":memory:" )
ActiveRecord::Schema.define(version: 1) do
create_table :articles do |t|
t.string :title
t.date :published_at
t.timestamps
@MatthewRDodds
MatthewRDodds / gist:df0d7b2cec10db7d7714
Last active August 29, 2015 14:14
docker exploration
cd /builds
docker build --tag=tag .
docker run -d tag
docker exec -it container bash