Skip to content

Instantly share code, notes, and snippets.

@geeky-sh
geeky-sh / gist:5298992
Created April 3, 2013 06:54
Mongo db connection failure
2013-04-03T06:41:43+00:00 app[worker.1]: I, [2013-04-03T06:41:43.193155 #14] INFO -- : Triggering 'pop.comments'
2013-04-03T06:41:43+00:00 app[worker.1]: E, [2013-04-03T06:41:43.194496 #14] ERROR -- : Operation failed with the following exception: Broken pipe:Broken pipe (Mongo::ConnectionFailure)
2013-04-03T06:41:43+00:00 app[worker.1]: /app/vendor/bundle/ruby/1.9.1/gems/mongo-1.7.1/lib/mongo/networking.rb:285:in `rescue in send_message_on_socket'
2013-04-03T06:41:43+00:00 app[worker.1]: /app/vendor/bundle/ruby/1.9.1/gems/mongo-1.7.1/lib/mongo/networking.rb:273:in `send_message_on_socket'
2013-04-03T06:41:43+00:00 app[worker.1]: /app/vendor/bundle/ruby/1.9.1/gems/mongo-1.7.1/lib/mongo/networking.rb:36:in `send_message'
2013-04-03T06:41:43+00:00 app[worker.1]: /app/vendor/bundle/ruby/1.9.1/gems/mongo-1.7.1/lib/mongo/collection.rb:1032:in `block in insert_documents'
2013-04-03T06:41:43+00:00 app[worker.1]: /app/vendor/bundle/ruby/1.9.1/gems/mongo-1.7.1/lib/mongo/util/logging.rb:32:in `instrument'
2013-04-03T0
@geeky-sh
geeky-sh / gist:5433046
Created April 22, 2013 07:28
Error while making a new controller action
[daiict.almaconnect.dev] Started GET "/admin/temp/send.json" for 127.0.0.1 at 2013-04-22 12:55:12 +0530
[daiict.almaconnect.dev] Creating scope :failed. Overwriting existing method Delayed::Backend::Mongoid::Job.failed.
[daiict.almaconnect.dev] Creating scope :pending. Overwriting existing method Delayed::Backend::Mongoid::Job.pending.
[daiict.almaconnect.dev] DEPRECATION WARNING: Passing a block to devise_for is deprecated. Please remove the block from devise_for (only the block, the call to devise_for must still exist) and call devise_scope :user do ... end with the block instead. (called from block (2 levels) in <top (required)> at /media/DATA/Almaconnect/project/config/routes.rb:5)
[daiict.almaconnect.dev] MONGODB (166ms) alma_connect['system.namespaces'].find({})
[daiict.almaconnect.dev] MONGODB [DEBUG] cursor.refresh() for cursor 24199882966682455
[daiict.almaconnect.dev] MONGODB (3ms) alma_connect['institutions'].find({:portaled=>true, :creation_progress=>{"$all"=>["created", "accounts", "analytics"]}}
@geeky-sh
geeky-sh / Elastictastic
Created May 4, 2013 07:17
Elastictastic Error
Elastictastic::ConnectionFailed: Connection refused - connect(2)
from /app/vendor/bundle/ruby/1.9.1/bundler/gems/elastictastic-3ab2a5308c5e/lib/elastictastic/adapter.rb:48:in `rescue in request'
from /app/vendor/bundle/ruby/1.9.1/bundler/gems/elastictastic-3ab2a5308c5e/lib/elastictastic/adapter.rb:37:in `request'
from /app/vendor/bundle/ruby/1.9.1/bundler/gems/elastictastic-3ab2a5308c5e/lib/elastictastic/middleware.rb:16:in `request'
from /app/vendor/bundle/ruby/1.9.1/bundler/gems/elastictastic-3ab2a5308c5e/lib/elastictastic/middleware.rb:89:in `request'
from /app/vendor/bundle/ruby/1.9.1/bundler/gems/elastictastic-3ab2a5308c5e/lib/elastictastic/middleware.rb:16:in `request'
from /app/vendor/bundle/ruby/1.9.1/bundler/gems/elastictastic-3ab2a5308c5e/lib/elastictastic/middleware.rb:40:in `request'
from /app/vendor/bundle/ruby/1.9.1/bundler/gems/elastictastic-3ab2a5308c5e/lib/elastictastic/middleware.rb:28:in `request'
from /app/vendor/bundle/ruby/1
@geeky-sh
geeky-sh / logging.yml
Created June 13, 2013 08:18
logging.yml in ES 0.90.1
rootLogger: INFO, console, file
logger:
# log action execution errors for easier debugging
action: DEBUG
# reduce the logging for aws, too much is logged under the default INFO
com.amazonaws: WARN
# gateway
#gateway: DEBUG
#index.gateway: DEBUG
@geeky-sh
geeky-sh / gist:6094577
Created July 27, 2013 11:08
last pacman update
>>> Updating module dependencies. Please wait ...
>>> Generating initial ramdisk, using mkinitcpio. Please wait...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 3.10.2-1-ARCH
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [autodetect]
-> Running build hook: [modconf]
-> Running build hook: [block]
# want to nest `Video` under `Media`; had a `videos` collection
# rename the collection:
Mongoid.database.drop_collection('videos')
Mongoid.database.rename_collection('videos', 'media')
# or
Mongoid.database.collection('videos').rename('media')
# change the type of all the existing records
@geeky-sh
geeky-sh / validate_data.rb
Created March 15, 2014 08:14
ruby code for validating rows in a csv file
valid = []
invalid = []
File.open('file.txt') do |f|
f.each_line do |l|
user_id, item_id, price_id = l.split(',').map {|x| x.strip.to_i}
if user_id.to_s.size == 5 && item_id.to_s.size >= 1 && item_id.to_s.size <= 3 && price_id > 0
valid << l
else
invalid << l
end
#!/usr/bin/env ruby
#
# Convert blogger (blogspot) posts to jekyll posts
#
# Basic Usage
# -----------
#
# ./blogger_to_jekyll.rb feed_url
#
# where `feed_url` can have the following format:
@geeky-sh
geeky-sh / gist:4cb22c9d31915dbad392
Created October 1, 2015 07:27
Error importing postgres database
g_restore: [archiver (db)] Error from TOC entry 7018; 0 0 ACL public root
pg_restore: [archiver (db)] could not execute query: ERROR: role "www_coverfox" does not exist
Command was: REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM root;
GRANT ALL ON SCHEMA public TO root;
GRANT AL...
pg_restore: [archiver (db)] Error from TOC entry 7022; 0 0 ACL account_manager_offlinetransaction root
pg_restore: [archiver (db)] could not execute query: ERROR: role "www_coverfox" does not exist
Command was: REVOKE ALL ON TABLE account_manager_offlinetransaction FROM PUBLIC;
REVOKE ALL ON TABLE account_manager_offlinetransaction F...
@geeky-sh
geeky-sh / file.sh
Created June 16, 2016 17:56
How to add multiple ssh keys for multiple github accounts on a single machine
ssh-keygen -t rsa -b 4096 -C "aash.discover@gmail.com"
## when prompted for file name, take id_rsa_personal
ssh-keygen -t rsa -b 4096 -C "aash@workmail.com"
# when prompted for file name, take id_rsa_work
## below are the content of ~/.ssh/config