This file contains 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
<?php | |
// Use a JOIN there are aliases. | |
$select = db_select('url_alias', 'a'); | |
$select->join('node', 'n', 'SUBSTR(a.source, 6) = n.nid'); | |
$pairs = $select->fields('a', array('source', 'alias')) | |
->orderBy('changed', 'DESC') | |
->condition('changed', $updated, '>=') | |
->execute() | |
->fetchAllKeyed(); |
This file contains 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
#!/usr/bin/env ruby | |
require 'net/telnet' | |
cache_dump_limit = 100 | |
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3) | |
slab_ids = [] | |
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c| | |
matches = c.scan(/STAT items:(\d+):/) | |
slab_ids = matches.flatten.uniq | |
end |
This file contains 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
## At the http level | |
map $http_cookie $is_secure { | |
default 0; | |
~SESS 1; # there's a session cookie (use SSL - authenticated user) | |
} | |
map $is_secure $not_secure { | |
1 0; | |
0 1; | |
} |
This file contains 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
## At the http level define a connection zone. This is the new post Nginx 1.1.9 syntax that allows multiple zones | |
## Define two connection zones: arbeit and auth_jail | |
limit_conn_zone $binary_remote_addr zone=arbeit:10m; # client IP | |
limit_conn_zone $http_cookie zone=auth_jail:10m; # Cookie header | |
## Define a map for singling out logged in users. | |
map $http_cookie $is_authenticated { | |
default 0; | |
~SESS 1; |
This file contains 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
<?php | |
// cURL obeys the RFCs as it should. Meaning that for a HTTP/1.1 backend if the POST size is above 1024 bytes | |
// cURL sends a 'Expect: 100-continue' header. The server acknowledges and sends back the '100' status code. | |
// cuRL then sends the request body. This is proper behaviour. Nginx supports this header. | |
// This allows to work around servers that do not support that header. | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); | |
// We're emptying the 'Expect' header, saying to the server: please accept the body right now. | |
// Read here: http://pilif.github.com/2007/02/the-return-of-except-100-continue/ |
This file contains 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
2012/02/05 18:35:43 [debug] 3727#0: *12698 event timer del: 55: 1328467003701 | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 generic phase: 0 | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 rewrite phase: 1 | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 http script var | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 http map started | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 http script var: "curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 OpenSSL/1.0.0g zlib/1.2.3.4 libidn/1.23 libssh2/1.2.8 librtmp/2.3" | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 http map: "curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 OpenSSL/1.0.0g zlib/1.2.3.4 libidn/1.23 libssh2/1.2.8 librtmp/2.3" "0" | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 http script var: "0" | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 http script if | |
2012/02/05 18:35:43 [debug] 3727#0: *12698 http script if: false |
This file contains 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
## As explained here: http://googlewebmastercentral.blogspot.com/2011/06/supporting-relcanonical-http-headers.html | |
## This is the add_header incantation to make it work. | |
add_header Link "<$scheme://$http_host$request_uri>; rel=\"canonical\""; |
This file contains 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
settings = { | |
logfile = '/tmp/lsyncd.log', | |
statusFile = '/tmp/lsyncd.stat', | |
statusInterval = 1, | |
nodaemon = true | |
} | |
echo = { | |
maxProcesses = 1, | |
delay = 1, |
This file contains 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
-- Test if a file exists using Lua posix https://github.com/rrthomas/luaposix. | |
local posix = require('posix') | |
-- Test if a file exists. | |
-- @param fname string | |
-- filename | |
-- @return boolean | |
-- true if file exists, false otherwise | |
-- |
This file contains 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
-- Playing with the nixio.fs library. | |
local nixiofs = require('nixio.fs') | |
-- Test if a file exists. | |
-- @param fname string | |
-- filename | |
-- @return boolean | |
-- true if file exists, false otherwise | |
-- |