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 | |
/** | |
* Find and recover un-continous id of WordPress post. | |
* | |
* Will make empty draft using these id for edit them later. | |
* Also change revision or auto-draft to draft. | |
* | |
* @package fwolfweb | |
* @subpackage wordpress | |
* @copyright Copyright 2010, Fwolf |
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
;==================================================================== | |
[Fwolf] | |
;在 PHP4 中使用 date 等函数的时候,并不需要考虑时区问题,会自动获得本地时间, | |
;但 PHP5 中则不行,如果你们有设置好时区, | |
;同样的代码在不同的系统可能会产生莫名其妙的问题(比如 Windows 和 Unix 之间)。 | |
;想要正常使用时间函数,需要在 php.ini 中设置统一的时区: | |
date.timezone = PRC | |
;也有一个函数,只是需要在程序中使用 | |
;date_default_timezone_set('Asia/Shanghai'); |
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
;==================================================================== | |
[Fwolf] | |
date.timezone = PRC | |
display_errors = on | |
error_log = /var/log/php.err | |
include_path = ".:/var/www/vhosts/fwolf.com/httpdocs/include" | |
post_max_size = 16M | |
;session.save_path = "/var/lib/php/session" | |
upload_max_filesize = 10M |
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/bash | |
#==================================================================== | |
# mt-mon.sh | |
# | |
# Copyright (c) 2011, Fwolf <[email protected]> | |
# All rights reserved. | |
# Distributed under the GNU General Public License, version 3.0. | |
# | |
# Monitor system mem and load, if too high, restart some service. |
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/bash | |
# https://gist.github.com/fwolf/5856230 | |
#ps aux --width 80 | sort -nrk +6 | head -n 15 | |
# bsdtime is shorter than cputime, hh:mm:ss vs MMM:SS | |
ps -eo 'user,pid,%cpu,%mem,rss,vsz,stime,bsdtime,s,cmd' --sort '-rss,-vsz' --width 80 | head -n 16 | |
echo | |
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/bash | |
# Author unknown | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
declare -A snowflakes | |
declare -A lastflakes |
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 | |
$blah="blah"; $s=microtime(true); for($i=0;$i<100000;$i++) 'omgwtf'.$blah."\n"; echo microtime(true)-$s . "\n"; $s=microtime(true); for($i=0;$i<100000;$i++) "omgwtf{$blah}\n"; echo microtime(true)-$s . "\n"; |
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
for ($j = 2; $j < 63; $j ++) { | |
$x = $j; $i = 1; $y = $x; | |
while ($y < 100000000000000) { | |
$i ++; | |
$y = pow($x, $i); | |
} | |
$i --; | |
$y = pow($x, $i); | |
echo "$x^$i = $y, length " . strlen($y) . "\n"; | |
} |
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
#! /usr/bin/php | |
<?php | |
/** | |
* btc38-reminder.php | |
* | |
* Copyright 2013 Fwolf <[email protected]> | |
* All rights reserved. | |
* | |
* Distributed under the MIT License. | |
* http://opensource.org/licenses/mit-license |
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
#! /usr/bin/php | |
<?php | |
/** | |
* btc38-okcoin-price-compare.php | |
* | |
* Copyright 2014 Fwolf <[email protected]> | |
* All rights reserved. | |
* | |
* Distributed under the MIT License. | |
* http://opensource.org/licenses/mit-license |
OlderNewer