Skip to content

Instantly share code, notes, and snippets.

@fasthold
fasthold / php-5.3.ini
Last active August 29, 2015 14:04
给其他安装脚本提供支持。非特殊情况勿改。 php.ini for php5.3
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@fasthold
fasthold / ubuntu-12.04-server-aliyun-mirror.sources.list
Last active August 29, 2015 14:04
给其他安装脚本提供支持。非特殊情况勿改。
deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
@fasthold
fasthold / gist:3deb4ac26becb1b2aec6
Created July 2, 2014 07:17
PHP执行shell捕获输出
<?php
if ( $res = popen("ls 2>&1","r")){
while ( !feof($res) ) $result .= fgets( $res, 1024 );
pclose($res);
echo $result;
}
# 请注意修改部分参数,如安装mysql-server时,设置 MySQL root 密码,以便自动安装
# 更换为aliyun的源镜像
#mkdir ~/installations
#mkdir backups
#cd ~/installations
#https://gist.githubusercontent.com/fasthold/6d0ac7528a7c528eb886/raw/4cbd8f4709c3c4ec1d2fbbb3e4f3dd65e9694aab/ubuntu-12.04-server-aliyun-mirror.sources.list
#sudo mv /etc/apt/sources.list ~/installations/backups/sources.list
#sudo cp ~/installations/ubuntu-12.04-server-aliyun-mirror.sources.list /etc/apt/sources.list
@fasthold
fasthold / base62_encode-and-base62_decode.php
Created March 19, 2014 02:09
base62_encode and base62_decode
<?php
// from http://encode-base62.nichabi.com/php-function.php
function base62_encode ($data) {
$outstring = '';
$len = strlen($data);
for ($i = 0; $i < $len; $i += 8) {
$chunk = substr($data, $i, 8);
$outlen = ceil((strlen($chunk) * 8) / 6);
$x = bin2hex($chunk);
@fasthold
fasthold / digitalocean-install.sh
Created December 12, 2013 16:11
用于digital ocean的vps初始安装
# 用于digital ocean的vps
# System related
sudo apt-get update
sudo apt-get -y install build-essential ssh curl software-properties-common python-software-properties python g++ make
# Editor
sudo apt-get -y install vim
# VCS
@fasthold
fasthold / application.php
Last active December 27, 2015 23:49
MongoDB configurations for Zend Framework Skeleton
<?php
return array(
'environment' => 'development',
'database' => array(
'adapter' => 'mongodb', // set to 'mongodb'
/** @see http://cn2.php.net/manual/en/mongoclient.construct.php */
'params' => array(
'connection_string' => 'mongodb://localhost:27017',
'dbname' => 'wow',
@fasthold
fasthold / sync-backups.ftp
Created October 25, 2013 03:16
使用 ScriptFTP 进行远程备份同步。这是 ScriptFTP所用的脚本
# The host, user name and password are stored in variables.
# Change the text between the quotes with your own settings.
$hostname="192.168.1.x"
$user="username"
$password="password"
# Variables are also used to store the local and remote path
# of the website.
$localwebfolder="D:\path\to\backup\folder"
$remotewebfolder="/remote/sub/foler"
<?php
/**
* Class for working with wood Adjacency List
* see down sql 'show create table'
*
* @author Alexander Kapliy <[email protected]>
*/
class AdjacencyList {
protected $tbl;
@fasthold
fasthold / php-5.5.ini
Created September 6, 2013 03:14
Modified php.ini for PHP 5.5
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order: