Skip to content

Instantly share code, notes, and snippets.

View pcdinh's full-sized avatar

Pham Cong Dinh pcdinh

View GitHub Profile
/*
* Displays linux /proc/pid/stat in human-readable format
*
* Build: gcc -o procstat procstat.c
* Usage: procstat pid
* cat /proc/pid/stat | procstat
*
* Homepage: http://www.brokestream.com/procstat.html
* Version : 2009-03-05
*
sb = Sebastian Bergmann <[email protected]>
dotxp = Tobias Schlitt <[email protected]>
mlively = Michael Lively Jr. <[email protected]>
lewismic = Mike Lewis <[email protected]>
[root@testserver redis]# uname -a
Linux testserver 2.6.18-92.1.18.el5 #1 SMP Wed Nov 12 09:30:27 EST 2008 i686 i686 i386 GNU/Linux
[root@testserver redis]# cat /proc/cpuinfo | grep CPU
model name : Intel(R) Xeon(TM) CPU 3.06GHz
model name : Intel(R) Xeon(TM) CPU 3.06GHz
model name : Intel(R) Xeon(TM) CPU 3.06GHz
model name : Intel(R) Xeon(TM) CPU 3.06GHz
[root@testserver redis]# free -m
/* `Rounded Corners
----------------------------------------------------------------------------------------------------*/
.round_all {
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.round_top {
ssh -f remote_user@remote_server -L 6378:remote_server:6379 -N
# -f -- backgrounds ssh right before execution of the command
# -L -- Forwards localhost:6378 to remote_server:6379 (encrypted and authenticated)
# -N -- Don't execute a remote command, just forward the port
# Start a redis server on remote_server on port 6379:
redis-server
# on the local machine telnet localhost 6378
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
<?php
$link = mysqli_connect("localhost", "root", "123456", "spicacms");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Select queries return a resultset */
-- Database schemas for SpicaCMS --
DROP TABLE IF EXISTS categories;
CREATE TABLE categories (
cat_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
cat_name VARCHAR(255) NOT NULL,
cat_left INT UNSIGNED NOT NULL,
cat_right INT UNSIGNED NOT NULL,
PRIMARY KEY (cat_id)
);
INSERT INTO categories VALUES (NULL, 'CEO', 1, 16);
svn co http://svn.php.net/repository/pecl/apc/trunk/ apc
function _ajax_request(url, data, callback, type, method) {
if (jQuery.isFunction(data)) {
callback = data;
data = {};
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,