Skip to content

Instantly share code, notes, and snippets.

View 1999's full-sized avatar

Dmitrii Sorin 1999

View GitHub Profile
./configure \
--prefix=/opt/local \
--exec-prefix=/opt/local \
--sysconfdir=/etc/opt/httpd \
--enable-so \
--disable-cgi \
--with-port=81 \
--enable-rewrite=static \
--with-mpm=prefork
server {
if ( $host ~ ^allcafe.(info|ru)$ ) {
rewrite ^/(.*)$ http://www.allcafe.info/$1 permanent;
}
if ( $host ~* ^www\.([a-z]+)\.allcafe\.(info|ru)$ ) {
set $domain $1;
rewrite ^/(.*)$ http://$domain.allcafe.info/$1 permanent;
}
<?php
$joinedURI = implode( '/', $url );
$pageObj = getValueFromRegistry( '__database' )->select()
->from( 'pages' )
->columns( '*' )
->where( 'LEFT( ?, LENGTH( uri ) ) = uri', $joinedURI )
->where( 'visible = 1' )
->orderBy( array( 'LENGTH( uri ) DESC' ) )
server {
if ( $host ~ ^allcafe\.(info|ru)$ ) {
rewrite ^/(.*)$ http://www.allcafe.info/$1 permanent;
}
if ( $host ~* ^www\.([a-z]+)\.allcafe\.(info|ru)$ ) {
set $domain $1;
rewrite ^/(.*)$ http://$domain.allcafe.info/$1 permanent;
}
./configure \
--prefix=/opt/local \
--conf-path=/etc/opt/nginx/nginx.conf \
--pid-path=/opt/local/var/run/nginx.pid \
--error-log-path=/opt/local/var/log/nginx/error.log \
--http-log-path=/opt/local/var/log/nginx/access.log \
--user=ubuntu \
--group=ubuntu
# libssl-dev - библиотека для md5 функций OpenSSL
We couldn’t find that file to show.
<?php
$cnn = new AMQPConnect();
# подсоединяемся
$exch = new AMQPExchange( $cnn );
$exch->declare( 'testing', 'direct', AMQP_DURABLE );
if ( true === isset( $_GET['publish'] ) ) {
for ( $i=1; $i<=5; $i++ ) {
@1999
1999 / gist:738943
Created December 13, 2010 12:26
php-fpm
./configure \
--prefix=/opt/php \
--sysconfdir=/etc/opt/php \
--enable-fpm \
--disable-cgi \
--with-config-file-path=/etc/opt/php \
--with-config-file-scan-dir=/etc/opt/php/conf.d/ \
--enable-zip \
--with-gettext \
--disable-ftp \
@1999
1999 / gist:1042431
Created June 23, 2011 12:10
map-reduce на выборку последних веток комментов
{
map: function(doc) {
if (doc.subtype === 'pm') {
return;
}
if (typeof doc.private !== 'undefined' && doc.private === 1) {
return;
}
@1999
1999 / md5.js
Created August 3, 2011 10:31
MD5 method for String object
String.prototype.md5 = function() {
var safe_add = function(x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
var rol = function(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));