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
{"VMC_APP_HOST"=>"172.30.49.47", | |
"VMC_APP_NAME"=>"foofoo", | |
"VMC_APP_INSTANCE"=> | |
"{\"droplet_id\":961,\"instance_id\":\"9ee7e0e281086789a25da4d7dc0d31c9\",\"instance_index\":0,\"name\":\"foofoo\",\"dir\":\"/var/vcap/data/dea/apps/foofoo-0-9ee7e0e281086789a25da4d7dc0d31c9\",\"uris\":[\"foofoo.cloudfoundry.com\"],\"users\":[\"[email protected]\"],\"version\":\"d2be92bfa13967e61e9d0e6d54ff4fa6dee718ba-1\",\"mem_quota\":134217728,\"disk_quota\":2147483648,\"fds_quota\":256,\"state\":\"STARTING\",\"runtime\":\"ruby18\",\"start\":\"2011-04-15 23:22:19 +0000\",\"state_timestamp\":1302909739,\"secure_user\":\"vcap-user-14\",\"resources_tracked\":true,\"port\":54071}", | |
"SHELL"=>"/bin/sh", | |
"VMC_APP_PORT"=>"54071", | |
"VCAP_APP_PORT"=>"54071", | |
"NO_PROXY"=>".cloudfoundry.com, localhost, 127.0.0.1", | |
"http_proxy"=>"http://squid.las01.emcatmos.com:3128", | |
"USER"=>"vcap-user-14", |
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
# GET /recur?num=5 | |
location /recur { | |
# MIME type determined by default_type: | |
default_type 'text/plain'; | |
content_by_lua ' | |
local num = tonumber(ngx.var.arg_num) or 0 | |
ngx.say("num is: ", num) | |
if num > 0 then |
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
# pseudocode | |
redis = Redis.new | |
# whenever a client connects: | |
connections_count = redis.scard('connected:clients') | |
if connections_count < MAX_CONNECTIONS | |
redis.sadd('connected:clients', request.remote_ip) |
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
case "$NGX_PLATFORM" in | |
Darwin:*) | |
case "$NGX_MACHINE" in | |
amd64 | x86_64 | i386) | |
echo "adding extra linking options needed by LuaJIT" | |
ngx_feature_libs="$ngx_feature_libs -pagezero_size 10000 -image_base 100000000" | |
;; | |
*) | |
;; |
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
def on_msg(subject, sid, reply, msg) #:nodoc: | |
return unless subscriber = @subs[sid] | |
if cb = subscriber[:callback] | |
case cb.arity | |
when 0 then cb.call | |
when 1 then cb.call(msg) | |
when 2 then cb.call(msg, reply) | |
else cb.call(msg, reply, subject) | |
end | |
end |
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
MSG = /^MSG\s+(\S+)\s+(\S+)\s+((\S+)\s+)?(\d+)$/i #:nodoc: | |
OK = /^\+OK/i #:nodoc: | |
ERR = /^-ERR\s+('.+')?/i #:nodoc: | |
PING = /^PING/i #:nodoc: | |
PONG = /^PONG/i #:nodoc: | |
INFO = /^INFO\s+(.+)/i #:nodoc: | |
# Responses | |
CR_LF = ("\r\n".freeze) #:nodoc: | |
CR_LF_SIZE = (CR_LF.bytesize) #:nodoc: |
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
#!/bin/bash | |
# have to hand install this one sorry http://www.cmake.org/files/v2.8/cmake-2.8.3-Darwin-universal.tar.gz | |
if [ "$1" == "cleanup" ]; then | |
echo "Cleaning up old luajit install" | |
cd /usr/local/share | |
sudo rm -rf lua luajit-2.0.0-beta6 |
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
[1] % grep EINPROGRESS **/* | |
apr-1/apr_errno.h:/** @see APR_STATUS_IS_EINPROGRESS */ | |
apr-1/apr_errno.h:#ifdef EINPROGRESS | |
apr-1/apr_errno.h:#define APR_EINPROGRESS EINPROGRESS | |
apr-1/apr_errno.h:#define APR_EINPROGRESS (APR_OS_START_CANONERR + 17) | |
apr-1/apr_errno.h:#define SOCEINPROGRESS (SOCBASEERR+36) /* Operation now in progress */ | |
apr-1/apr_errno.h:#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \ | |
apr-1/apr_errno.h: || (s) == APR_OS_START_SYSERR + SOCEINPROGRESS) | |
apr-1/apr_errno.h:#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \ | |
apr-1/apr_errno.h: || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS) |
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
module('NATS', package.seeall) | |
require('list') | |
require ("datadumper") | |
NATS = {} | |
NATS.client = require('socket').tcp() | |
NATS.url = require('socket.url') | |
NATS.pending = {} |
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
% nc -l -p 4222 | |
fdf | |
dfdasf | |
Can't grab 0.0.0.0:4222 with bind |