Skip to content

Instantly share code, notes, and snippets.

@fasthold
fasthold / install-14.04.sh
Last active April 15, 2021 04:52
装好ubuntu server后的那些事
# 请注意修改部分参数,如安装mysql-server时,设置 MySQL root 密码,以便自动安装
# 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 / install-ffmpeg.sh
Last active December 20, 2015 05:19
Install ffmpeg and useful encoders (h264,mp3...)
# From http://my.oschina.net/michaelyuanyuan/blog/68616
# Set a download dir
download_dir=~/downloads
# Install H264 encoder
cd $download_dir
git clone git://git.videolan.org/x264.git x264
cd x264
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
@fasthold
fasthold / gist:6438598
Created September 4, 2013 15:26
Some php.ini settings snippet for Puphpet.com
display_errors = On,
error_reporting = 2047,
short_open_tag = Off,
memory_limit = 512M,
allow_url_fopen = On,
post_max_size = 1024M,
max_file_uploads = 1000,
upload_max_filesize = 1024M,
@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:
<?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 / 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"
@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 / 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 / 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);