Skip to content

Instantly share code, notes, and snippets.

#! /bin/sh
### BEGIN INIT INFO
# Provides: php-fastcgi
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop php-cgi in external FASTCGI mode
# Description: Start and stop php-cgi in external FASTCGI mode
### END INIT INFO
START=yes
# Which user runs PHP? (default: www-data)
EXEC_AS_USER=www-data
# Host and TCP port for FASTCGI-Listener (default: localhost:9000)
FCGI_HOST=localhost
FCGI_PORT=9000
# Environment variables, which are processed by PHP
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
@abhinavsingh
abhinavsingh / gist:2552185
Created April 29, 2012 17:44
PHP-5.4.1 `make test` summary on ubuntu 11.10
=====================================================================
TIME END 2012-04-29 17:38:09
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 51
Exts tested : 26
---------------------------------------------------------------------
@abhinavsingh
abhinavsingh / gist:2644878
Created May 9, 2012 14:26
nginx installation
## dependencies
sudo apt-get install libpcre3-dev zlib1g-dev libssl-dev
## user/group config
sudo groupadd nginx
sudo useradd -M --gid nginx nginx
## configure and install
./configure --prefix=/usr --user=nginx --group=nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-http_ssl_module
@abhinavsingh
abhinavsingh / gist:2760834
Created May 21, 2012 06:39
Libevent release-2.0.19-stable `make verify` summary
make check-TESTS
Running tests:
EVPORT
Skipping test
KQUEUE
test-eof: OKAY
test-weof: OKAY
test-time:
OKAY
test-changelist:
@abhinavsingh
abhinavsingh / search_indexes.py
Created June 5, 2012 19:34
haystack events module search index
import datetime
from haystack import indexes
from events.models import *
class EventIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
location = indexes.LocationField(model_attr='get_location')
def get_model(self):
@abhinavsingh
abhinavsingh / gist:3033163
Created July 2, 2012 13:01
sockjs-protocol test results with sockjs-erlang on mac osx R14B04
........E...........................F......F............................
======================================================================
ERROR: test_invalid_callback (__main__.HtmlFile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "sockjs-protocol-dev.py", line 1036, in test_invalid_callback
r = GET(base_url + '/a/a/htmlfile?c=' + callback)
File "/Users/abhinavsingh/git/sockjs-protocol/utils_03.py", line 289, in GET
return SynchronousHttpRequest('GET', url, **kwargs)
File "/Users/abhinavsingh/git/sockjs-protocol/utils_03.py", line 269, in SynchronousHttpRequest
@abhinavsingh
abhinavsingh / gist:3707888
Created September 12, 2012 16:27
JAXLXml Constructor Examples
$ ./jaxlctl shell
jaxl 1> $name = 'node-name';
jaxl 2> $ns = 'my:xml:ns';
jaxl 3> $attrs = array('k1'=>'v1', 'k2'=>'v2');
jaxl 4> $text = 'this is an example';
jaxl 5>
jaxl 5> $xml_obj = new JAXLXml($name, $ns, $attrs, $text);
jaxl 6> echo $xml_obj->to_string();
<node-name xmlns="my:xml:ns" k1="v1" k2="v2">this is an example</node-name>
jaxl 7>
@abhinavsingh
abhinavsingh / gist:3707942
Created September 12, 2012 16:35
JAXLXml Constructor Examples showing sanitization of attributes and text
$ ./jaxlctl shell
jaxl 1> $xml_obj = new JAXLXml('msg', array(), '<a href=""></a>');
jaxl 2> echo $xml_obj->to_string();
<msg>&lt;a href=&quot;&quot;&gt;&lt;/a&gt;</msg>
jaxl 3>
jaxl 3> $xml_obj = new JAXLXml('msg', array('a'=>'some < tag data >'), '<a href="javascript:void(0);"></a>');
jaxl 4> echo $xml_obj->to_string();
<msg a="some &lt; tag data &gt;">&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;</msg>
jaxl 5>
jaxl 5> quit