Rails 3 提供了 match
方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:
注:(r3 代表 Rails 3,r4 代表 Rails 4)
# routes.rb
useradd nagios | |
mkdir -p /opt/install_file | |
cd /opt/install_file | |
scp 10.103.13.148:/opt/install_file/nagios-plugins-1.5.tar.gz /opt/install_file | |
scp 10.103.13.148:/opt/install_file/nrpe-2.15.tar.gz /opt/install_file | |
tar xvfz nagios-plugins-1.5.tar.gz | |
cd nagios-plugins-1.5 | |
./configure --prefix=/opt/nagios | |
make && make install | |
chown nagios.nagios /opt/nagios |
Fibur is a library that allows concurrency during Ruby I/O operations without needing to make use of callback systems. Traditionally in Ruby, to achieve concurrency during blocking I/O operations, programmers would make use of Fibers and callbacks. Fibur eliminates the need for wrapping your I/O calls with Fibers and a callback. It allows you to write your blocking I/O calls the way you normally would, and still have concurrent execution during those I/O calls.
Say you have a method that fetches data from a network resource:
2091039935 |
99669999996669999996699666699666999966699666699 | |
99699999999699999999699666699669966996699666699 | |
99669999999999999996699666699699666699699666699 | |
99666699999999999966666999966699666699699666699 | |
99666666999999996666666699666699666699699666699 | |
99666666669999666666666699666669966996699666699 | |
99666666666996666666666699666666999966669999996 |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from util import api, settings | |
from v3._base import CachedPlusHandler, BaseHandler, UserClient | |
import json | |
import logging | |
import urllib2 | |
from service import service_ugc, service_user, service_connection | |
from service.connection import ttypes |
[E 120915 12:47:46 web:1085] Uncaught exception GET /v1/videos/append?vids=XNDUwNTc4MDI0,XNDUwNTc3MTY4,XNDM2MTg1MDY4,XMzg5NTg4ODYw&size_set=4 (127.0.0.1) | |
HTTPRequest(protocol='http', host='localhost:11535', method='GET', uri='/v1/videos/append?vids=XNDUwNTc4MDI0,XNDUwNTc3MTY4,XNDM2MTg1MDY4,XMzg5NTg4ODYw&size_set=4', version='HTTP/1.1', remote_ip='127.0.0.1', body='', headers={'Host': 'localhost:11535', 'User-Agent': 'Python-urllib/2.7', 'Connection': 'close', 'Accept-Encoding': 'identity'}) | |
Traceback (most recent call last): | |
File "/opt/python2.7/lib/python2.7/site-packages/tornado-2.4-py2.7.egg/tornado/web.py", line 1021, in _stack_context_handle_exception | |
raise_exc_info((type, value, traceback)) | |
File "/opt/python2.7/lib/python2.7/site-packages/tornado-2.4-py2.7.egg/tornado/web.py", line 1139, in wrapper | |
return method(self, *args, **kwargs) | |
File "/opt/paike/gof/modules/video/v1/video_info.py", line 133, in get | |
self.async_send_request('video', context, 'video.a |
db.paike_video.update({"$or" : [{"loc.0": {"$gt": 180} },{"loc.0":{"$lt":-180}},{"loc.1":{"$lt": -90}},{"loc.1":{"$gt":90}}]},{"$set":{"loc":[0,0]}},false,true) |
#!/bin/sh | |
# | |
# Simple Redis init.d script conceived to work on Linux systems | |
# as it does use of the /proc filesystem. | |
REDISPORT=6379 | |
EXEC=/usr/local/bin/redis-server | |
CLIEXEC=/usr/local/bin/redis-cli | |
PIDFILE=/var/run/redis_${REDISPORT}.pid |