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
Typhoeus.get("api.travis-ci.org/repos/travis-ci/travis").total_time | |
#=> 0.428954 | |
Typhoeus.get("https://api.travis-ci.org/repos/travis-ci/travis", followlocation: true).total_time | |
#=> 0.786656 |
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
$ ruby --version | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0] | |
$ irb --version | |
irb 0.9.6(09/06/30) | |
$ irb | |
> a = "gc me" | |
=> "gc me" | |
> ObjectSpace.define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" }) | |
=> [0, #<Proc:0x007f9e2abb9200@(irb):3>] | |
> a = nil |
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
webmock master bundle exec rspec spec; | |
Run options: | |
include {:focus=>true} | |
exclude {:without_webmock=>true} | |
All examples were filtered out; ignoring {:focus=>true} | |
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... |
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
APIBETA_Redis_VMaster:~$ cat /var/log/syslog | grep -i redis | |
Jan 9 06:44:30 ip-10-32-32-9 redis-6379[19818]: Opening port 6379: bind: Address already in use | |
Jan 9 06:44:30 ip-10-32-32-9 redis-6379[19827]: Opening port 6379: bind: Address already in use | |
Jan 9 06:50:03 ip-10-32-32-9 redis-6379[20334]: Opening port 6379: bind: Address already in use | |
Jan 9 06:50:04 ip-10-32-32-9 redis-6379[20343]: Opening port 6379: bind: Address already in use | |
Jan 9 06:55:23 ip-10-32-32-9 redis-6379[20857]: Opening port 6379: bind: Address already in use | |
Jan 9 06:55:23 ip-10-32-32-9 redis-6379[20866]: Opening port 6379: bind: Address already in use | |
Jan 9 07:00:54 ip-10-32-32-9 redis-6379[21375]: Opening port 6379: bind: Address already in use | |
Jan 9 07:00:54 ip-10-32-32-9 redis-6379[21384]: Opening port 6379: bind: Address already in use | |
Jan 9 07:06:31 ip-10-32-32-9 redis-6379[21899]: Opening port 6379: bind: Address already in use |
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
NoMethodError: undefined method `cmd_tuples' for nil:NilClass: UPDATE "tasks" SET "completed_at" = '2013-01-08 20:58:11.000000', "version" = 2, "updated_at" = '2013-01-08 21:08:09.784780' WHERE "tasks"."id" = 279862062 | |
/var/www/wunderapi/shared/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block in exec_delete' | |
/var/www/wunderapi/shared/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log' | |
/var/www/wunderapi/shared/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | |
/var/www/wunderapi/shared/vendor/bundle/ruby/1.9.1/bundler/gems/octopus-3025b7b8a5e7/lib/octopus/rails3/abstract_adapter.rb:14:in `instrument' | |
/var/www/wunderapi/shared/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log' | |
/var/www/wunderapi/shared/vendor/bundle/ruby/1.9.1/g |
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
NoMethodError: undefined method `fields' for nil:NilClass: SELECT "list_elements"."id" AS t0_r0, "list_elements"."container_id" AS t0_r1, "list_elements"."container_type" AS t0_r2, "list_elements"."resource_id" AS t0_r3, "list_elements"."resource_type" AS t0_r4, "list_elements"."user_id" AS t0_r5, "list_elements"."owner" AS t0_r6, "list_elements"."position" AS t0_r7, "list_elements"."bucket" AS t0_r8, "list_elements"."deleted_at" AS t0_r9, "list_elements"."created_at" AS t0_r10, "list_elements"."updated_at" AS t0_r11, "tasks"."id" AS t1_r0, "tasks"."title" AS t1_r1, "tasks"."starred" AS t1_r2, "tasks"."note" AS t1_r3, "tasks"."completed_at" AS t1_r4, "tasks"."created_at" AS t1_r5, "tasks"."updated_at" AS t1_r6, "tasks"."parent_id" AS t1_r7, "tasks"."due_date" AS t1_r8, "tasks"."recurrence_type" AS t1_r9, "tasks"."recurrence_count" AS t1_r10, "tasks"."recurring_parent_id" AS t1_r11, "tasks"."updated_by_id" AS t1_r12, "tasks"."deleted_at" AS t1_r13, "tasks"."local_identifier" AS t1_r14, "tasks"."version" AS t1_ |
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
# number postgres connections | |
sudo ps -ef | grep postgres | wc -l | |
# disk usage | |
iostat 5 | |
# memory | |
mpstat 5 | |
# slow req per second |
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 'json' | |
url = "http://search.tez-tour.com/toursearch/getResult?accommodationId=2&after=29.11.2012&before=29.11.2012&cityId=345&countryId=5732¤cy=8390&hotelClassId=12703&hotelClassBetter=true&hotelInStop=false&locale=ru&nightsMin=7&nightsMax=7&noTicketsFrom=false&noTicketsTo=false&priceMax=9999999&priceMin=0&rAndBId=15350&rAndBBetter=true&formatResult=true&xml=false&" | |
JSON.parse(Typhoeus.get(url).body.force_encoding("utf-8")) | |
#=> => {"success"=>true, "serverName"=>"don.teztour.com", "data"=>[[1, "29.11.2012", "Чт", [...] |
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
$ b ruby perf/ethon.rb | |
user system total real | |
[ 1 000 000 Iterations] | |
String.new 0.200000 0.000000 0.200000 ( 0.200820) | |
Easy.new 6.250000 0.130000 6.380000 ( 6.377507) | |
Curl.set_option 3.540000 0.050000 3.590000 ( 3.597051) |
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
irb(main):001:0> Product.find("123") | |
Mongoid::Errors::DocumentNotFound: | |
Problem: | |
Document(s) not found for class Product with id(s) 123. | |
Summary: | |
When calling Product.find with an id or array of ids, each parameter must match a document in the database or this error will be raised. The search was for the id(s): 123 ... (1 total) and the following ids were not found: 123. | |
Resolution: | |
Search for an id that is in the database or set the Mongoid.raise_not_found_error configuration option to false, which will cause a nil to be returned instead of raising this error when searching for a single id, or only the matched documents when searching for multiples. | |
irb(main):002:0> |