Skip to content

Instantly share code, notes, and snippets.

View pcdinh's full-sized avatar

Pham Cong Dinh pcdinh

View GitHub Profile
# Orphan relation in "category_post_rel"
SELECT post_id FROM category_post_rel cp
WHERE NOT EXISTS (SELECT * FROM posts p WHERE cp.post_id = p.post_id)
# Posts that have no category yet
SELECT post_id FROM posts p
WHERE NOT EXISTS (SELECT * FROM category_post_rel cp WHERE cp.post_id = p.post_id)
SELECT p.post_id, p.post_title, p.post_created_dtime, cp.cat_id, cp.post_id -- , c.cat_name
// Creating a plugin with $.myNS.public_method1() and $.myNS.public_method2() methods, a few different ways.
(function($){
var private_var,
myNS = $.myNS = {},
public_method2;
myNS.public_method1 = function(){
private_method();
$context = stream_context_create($opts);
stream_context_set_option($context, "http", "protocol_version", 1.1);
'stream_context' => $context
$request_xml = $client->__getLastRequestHeaders() .
$client->__getLastRequest();
$response_xml = $client->__getLastResponseHeaders() .
$client->__getLastResponse();
print "Response:".$response_xml;
print "Request:".$request_xml;
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;
Linux 2.6.9-89.0.11.ELsmp - 03/13/2010
146 root 5 -10 0 0 0 S 0.0 0.0 0:00.00 [aio/7]
12:00:01 AM CPU %user %nice %system %iowait %idle
12:10:01 AM all 8.32 0.00 0.57 0.02 91.10
12:20:01 AM all 8.30 0.00 0.55 0.03 91.13
12:30:01 AM all 8.18 0.00 0.72 0.03 91.08
12:40:01 AM all 8.87 0.00 0.61 0.04 90.48
12:50:01 AM all 7.73 0.00 0.50 0.03 91.74
01:00:01 AM all 8.83 0.00 0.66 0.02 90.49
01:10:01 AM all 8.46 0.00 0.56 0.03 90.95
+--------+-------+-----------+-------+---------+------+----------------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+--------+-------+-----------+-------+---------+------+----------------+------------------------------------------------------------------------------------------------------+
| 427830 | wlc15 | localhost | wlc15 | Query | 184 | Locked | INSERT INTO jos_track_components(id,component,userid,userip,date) VALUES(0,'wlcvideos',0,'203.81.72. |
| 427832 | wlc15 | localhost | wlc15 | Query | 180 | Locked | INSERT INTO jos_track_components(id,component,userid,userip,date) VALUES(0,'wlcvideos',0,'88.233.142 |
| 427843 | wlc15 | localhost | wlc15 | Query | 180 | Locked | INSERT INTO jos_track_components(id,component,userid,userip,date) VALUE
if ($request_uri = /templates/wlc/css/css.gzip.php) {
set $css_gzip 1;
expires 2d;
}
if ($request_uri = /templates/wlc/lib/js/js.php) {
set $js_php 1;
expires 2d;
}
if ($request_uri = /modules/mod_yoo_carousel/mod_yoo_carousel.js.php) {
set $js_mod_yoo_carousel 1;
Linux 2.6.9-89.0.11.ELsmp (183463-web1) 03/17/2010
12:00:01 AM CPU %user %nice %system %iowait %idle
12:10:01 AM all 14.09 0.00 0.69 0.03 85.20
12:20:01 AM all 13.77 0.00 0.71 0.02 85.51
12:30:01 AM all 13.68 0.00 0.93 0.02 85.37
12:40:01 AM all 12.58 0.00 0.63 0.02 86.78
12:50:01 AM all 13.22 0.00 0.65 0.02 86.11
01:00:01 AM all 14.74 0.00 0.80 0.03 84.42
01:10:01 AM all 17.01 0.00 1.17 0.01 81.81
#pre requisites
aptitude install -y build-essential libtool libltdl3-dev libgd2-xpm-dev libmcrypt-dev libxml2-dev libmysqlclient15-dev flex m4 awk automake autoconf bison make libbz2-dev libpcre3-dev libssl-dev zlib1g-dev vim re2c
aptitude install -y mysql-client mysql-client mysql-common mysql-server mysql-server mysql-server-core
aptitude install -y libtidy-dev curl libcurl4-openssl-dev libcurl3 libcurl3-gnutls zlib1g zlib1g-dev libxslt1-dev libzip-dev libzip1 libxml2 libsnmp-base libsnmp15 libxml2-dev libsnmp-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev zlib1g zlib1g-dev libfreetype6 libfreetype6-dev libbz2-dev libxpm4-dev libmcrypt-dev libmcrypt4
aptitude install -y libxml2-dev libevent-dev
#modify php-fpm config at /usr/local/etc/php-pfm.conf
#copy php-fpm init script under sapi/fpm/php-fpm to /etc/init.d/
#get php from svn
UserA at host1 -> UserB at host2: [UserA@host1 ~]ssh UserB@host2
=> no password required
1. In host1 as UserA
UserA@host1:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/UserA/.ssh/id_rsa):
Created directory '/home/UserA/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again: