Original: http://www.shadowandy.net/2012/03/asus-rt-n66u-tomatousb-firmware-flashing-guide.htm
| import tornado.web | |
| import tornado.httpserver | |
| import tornado.ioloop | |
| class MainHandler(tornado.web.RequestHandler): | |
| def get(self): | |
| self.write("Greetings from the instance %s!" % tornado.process.task_id()) | |
| app = tornado.web.Application([ | |
| (r"/", MainHandler), |
| #!/usr/bin/env python | |
| '''\ | |
| Usage: cookbookdiff COOKBOOK_NAME COOKBOOK_VER LOCAL_PATH [--nocolor] | |
| Diff your LOCAL_PATH against what is on the chef server for a | |
| given cookbook and version. | |
| --nocolor: don't pipe output through 'colordiff' (in case you want to pipe to something else) | |
| Examples: | |
| cookbookdiff percona_toolkit 0.0.4 ~/chef-repo/cookbooks/percona_toolkit |
| require "timeout" | |
| module WaitSteps | |
| extend RSpec::Matchers::DSL | |
| matcher :become_true do | |
| match do |block| | |
| begin | |
| Timeout.timeout(Capybara.default_wait_time) do | |
| sleep(0.1) until value = block.call |
Changes:
-
this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .
ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.
-
this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.
This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.
| module AuthHelper | |
| def http_login | |
| user = 'username' | |
| pw = 'password' | |
| request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw) | |
| end | |
| end | |
| module AuthRequestHelper | |
| # |
| #!/usr/bin/env python | |
| """ | |
| How to use it: | |
| 1. Just `kill -2 PROCESS_ID` or `kill -15 PROCESS_ID` , The Tornado Web Server Will shutdown after process all the request. | |
| 2. When you run it behind Nginx, it can graceful reboot your production server. | |
| 3. Nice Print in http://weibo.com/1682780325/zgkb7g8k7 | |
| """ |
| require 'chefspec' | |
| module SpecHelper | |
| def global_stubs | |
| # Don't worry about external cookbook dependencies | |
| Chef::Cookbook::Metadata.any_instance.stub(:depends) | |
| # Test each recipe in isolation, regardless of includes | |
| @included_recipes = [] | |
| Chef::RunContext.any_instance.stub(:loaded_recipe?).and_return(false) |
- see https://gist.github.com/machty/5723945 for the latest API (unlikely to change from now on)
- latest Ember build: https://machty.s3.amazonaws.com/ember/ember-async-routing-10.js
The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.