This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//based on http://www.cnblogs.com/enjoyeclipse/archive/2013/01/18/2865700.html | |
function latlng2xy($lat, $lng, $zoom){ | |
if (abs($lat) > 85.0511287798066){ | |
return false; | |
} | |
$sin_phi = sin($lat * M_PI / 180); | |
$norm_x = $lng / 180; | |
$norm_y = (0.5 * log((1 + $sin_phi) / (1 - $sin_phi))) / M_PI; | |
$tileRow = pow(2, $zoom) * ((1 - $norm_y) / 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on http://stackoverflow.com/questions/23577931/get-offset-from-imagemagick-trim/23578928?noredirect=1#23578928 | |
convert -debug Coder longyan_1.png -trim longyan_1.trimed.png 2>&1 | sed -n '/Setting up oFFs chunk/ s/.*x=/x=/p' | |
# x=181, y=118, units=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 日志切割时间 | |
vi /etc/crontab | |
# 把cron.daily的时间改为0 0 | |
# 日志切割文件存储格式 | |
vi /etc/logrotate.d/nginx | |
/var/log/nginx/*.log { | |
daily | |
missingok | |
rotate 52 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//based on http://jason.pureconcepts.net/2013/09/php-convert-uniqid-to-timestamp/ | |
echo echo date('Y-m-d H:i:s', hexdec(substr('53796ed677000', 0, -5))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: supervisord | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /etc/php5/mods-available | |
sudo ln -s ../conf.d/mcrypt.so | |
sudo php5enmod mcrypt | |
sudo /etc/init.d/apache2 restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get remove php5-snmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Laravel in Subfolder (rename public to subfolder name) | |
===INTRO=== | |
Assume we need http://localhost/miao/ instead of http://localhost/laravel_app/public/ | |
===FILES=== | |
|laravel_app | |
|-app | |
|-bootstrap | |
|-miao(rename from public) | |
|-vendor | |
|-server.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install python-software-properties | |
sudo add-apt-repository ppa:ondrej/php5-oldstable | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install php5 php5-fpm php5-curl php5-gd php5-intl php5-imagick php5-imap php5-mcrypt php5-memcached php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-mysqlnd php5-xcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 个性化日期显示 | |
* @static | |
* @access public | |
* @param datetime $times 日期 | |
* @return string 返回大致日期 | |
* @example 示例 ueTime('') | |
* @author http://segmentfault.com/q/1010000000650101 | |
*/ |
OlderNewer