Skip to content

Instantly share code, notes, and snippets.

@carlessistare
carlessistare / init_cassandra
Created June 11, 2013 14:38
Initialise Cassandra instance with PHP
require_once 'Cassandra.php';
$servers = array(
array(
'host' => '192.168.1.74',
'port' => 9160,
'use-framed-transport' => true,
'send-timeout-ms' => 1000,
'receive-timeout-ms' => 1000
)
@carlessistare
carlessistare / vim-search-replace
Created June 11, 2013 14:39
Vim search replace
:%s/urlschemeUserLog__\w*/urlschemeUserLog/g
@carlessistare
carlessistare / svn-externals
Created June 11, 2013 14:40
Config svn externals
cd ad4rtb/libext/
vim externals
A4SFWK http://ad4sdevsrv.ad4s.local/ws_fwk/trunk/A4SFWK/
svn propset svn:externals . -F externals
svn update
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
@carlessistare
carlessistare / run-hiphop
Created June 11, 2013 14:42
How to run hiphop from shell
cd hiphop/hiphop-php/
export CMAKE_PREFIX_PATH=`/bin/pwd`/../
export HPHP_HOME=`/bin/pwd`
export HPHP_LIB=`/bin/pwd`/bin
find . -name "*.php" > files.list
sudo rm -R /tmp/hphp_*
../hphp/hphp --input-list=files.list -k 1 --log=3 --include-path="." --force=1 --cluster-count=50 -v "AllDynamic=true"
sudo /tmp/hphp_zJVsIX/program -m server -v "Server.SourceRoot=`pwd`" -v "Server.DefaultDocument=public/index.php" -p 8080
curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
mkdir testzf2/
cd testzf2/
vim composer.json
################
{
"name": "zendframework/testzf2",
"description": "Skeleton Application for ZF2",
@carlessistare
carlessistare / install-scribe
Created June 11, 2013 14:46
Install Scribe Server
http://snippets.notmyidea.org/2009/07/30/using-scribe-log-server-with-php/
sudo apt-get install libboost-dev flex bison libtool automake autoconf pkg-config libevent-dev autoconf libtool php5 php-config g++ libcrypto++-dev libssl-dev libboost1.42-all-dev
svn co http://svn.apache.org/repos/asf/thrift/trunk thrift
cd thrift/
Problems with uint32_t
sudo vim /usr/share/applications/eclipse.desktop
[Desktop Entry]
Type=Application
Terminal=false
Name=Eclipse Kepler
Icon=/opt/eclipse-kepler/icon.xpm
Exec=/opt/eclipse-kepler/eclipse
@carlessistare
carlessistare / Minify-all-windows-ubuntu
Created July 19, 2013 20:28
Minify all windows ubuntu
sudo apt-get install compizconfig-settings-manager
@carlessistare
carlessistare / tuning_nginx_nodejs
Created September 2, 2013 20:34
Tuning Nginx for heavy loading with nodejs as upstream. Short requests and a lot of concurrence.
# This number should be, at maximum, the number of CPU cores on your system.
# (since nginx doesn't benefit from more than one worker per CPU.)
worker_processes 8;
# Determines how many clients will be served by each worker process.
# (Max clients = worker_connections * worker_processes)
# "Max clients" is also limited by the number of socket connections available on the system (~64k)
# run ss -s and u'll see a timewait param
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed.