各种语言实现字符串反转

JS 1function str_reverse(str) { 2 return str.split("").reverse().join(""); 3} PHP 1function str_reverse($str){ 2 return implode( array_reverse( str_split($str) ) ); 3} Python 1def str_reverse(string): 2 L = list(string) 3 L.reverse() 4 return ''.join(L)

七月 31, 2014

解决firefox和IE9对icon font字体的跨域访问问题

nginx.conf 1location ~* \.(eot|ttf|woff)$ { 2 add_header Access-Control-Allow-Origin *; 3}

六月 18, 2014

js 实现数字三位一逗号

1var num = 123456789; 2var num_str = num.toLocaleString();

三月 4, 2014

PHP操作Word/Excel/PowerPoint

PHPWord PHPExcel PHPPowerPoint

一月 24, 2014

Python 写的一个挑车牌小程序(西安)

去年 10 月份为了选车牌,研究发现的,现在贴出来,祝大家选到自己心仪的车牌:) 1# coding=utf-8 2import os 3import sys 4import urllib2 5import random 6import time 7 8_t = '%d' %time.time() 9_r = '%d' %(random.random()*1000) 10_fname = 'num_list_%s.txt' 11 12_c1 = {'_t': '%s', '_list': ('L')}; 13_c2 = {'_t': '%d', '_list': range(1, 2)}; 14_c3 = {'_t': '%s', '_list': ('X')}; 15_c4 = {'_t': '%d', '_list': range(0, 10)}; 16_c5 = {'_t': '%d', '_list': range(0, 10)}; 17 18url = 'http://117.36.53.122:9085/zzxh/business/BusinessAction.do?' 19url += 'actiontype=xhgzvalidate&timeStamp='+_t+_r+'&hpzl=02&hphm1=A' 20url += '&hphm2='+_c1['_t']+'&hphm3='+_c2['_t']+'&hphm4='+_c3['_t']+'&hphm5='+_c4['_t']+'&hphm6='+_c5['_t'] 21num = _c1['_t']+_c2['_t']+_c3['_t']+_c4['_t']+_c5['_t'] 22 23### get remote content 24def file_clear(fname): 25 _f = open(fname, 'w+') 26 _f.write('Generated by mrasong at '+time.strftime('%Y-%m-%d %H:%M:%S')+'\n') 27 _f.close() 28 return 29 30def file_get_contents(url): 31 try: 32 _f = urllib2.urlopen(url, timeout=5) 33 _content = _f.read() 34 _content = _content.decode('gbk').encode('utf-8') 35 return _content.strip()+'\n' 36 except Exception, e: 37 return e 38 39def file_put_contents(fname, data): 40 _f = open(fname, 'a'); 41 _f.write(str(data)) 42 _f.close() 43 return 44 45for _n1 in _c1['_list']: 46 _file_name = _fname % _n1 47 file_clear(_file_name) 48 for _n2 in _c2['_list']: 49 for _n3 in _c3['_list']: 50 for _n4 in _c4['_list']: 51 for _n5 in _c5['_list']: 52 #url 53 _u = (url % ( _n1, _n2, _n3, _n4, _n5, )) 54 #car num 55 _num = (num % ( _n1, _n2, _n3, _n4, _n5, )) 56 _content = file_get_contents(_u) 57 58 if( _content[0:2]!='00' ): 59 continue 60 61 _content = _num+'\t'+_content[2:] 62 file_put_contents(_file_name, _content) 63 print(_num) 64 #end _c5 65 #end _c4 66 #end _c3 67 #end _c2 68 #os.system('pause') 69 70#end _c1 附: ...

一月 13, 2014

mongodb close() 引发的PHP-FPM进程“血案”

公司的日志统计数据库使用 PHP+MongoDB 进行数据日志统计。 今天运维同事发现 php-fpm 进程数居高不下,只有在 reload 后才恢复,但是之后又一直处于上升状态。 查看了 php-fpm.conf 文件,更改了设置还是无效。 ...

一月 7, 2014

typecho 多用户版

尝试着将 0.9 版的 typecho 改为多用户版,待测试正常后放出。

十二月 24, 2013

simcms 后台入口文件破解

base64_decode , eval 解密前:adm.bak.php 1<?php 2// Copyright(C) 2013 www.simcms.net, All rights reserved. 3$OOO0O0O00=__FILE__;$OOO000000=urldecode('%74%68%36%73%62%65%68%71%6c%61%34%63%6f%5f%73%61%64%66%70%6e%72');$OO00O0000=648;$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};$OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16};$OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000000{5};$O0O0000O0='OOO0000O0';eval(($$O0O0000O0('JE9PME9PMDAwMD0kT09PMDAwMDAwezE3fS4kT09PMDAwMDAwezEyfS4kT09PMDAwMDAwezE4f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fLNUueSlR+jGKPoYDJUPet2BvYbV3co5JkS5e1SlEWbIosjI4Wm9DcJiPq8lvWyrAso9dnYdR85a2JdVfWJrDajlcWoLKWyiRcSGfLNUueSlR+jGKPoYfnJrvWo9KObhTDordWm9DcJiPq8waPo9EkylvW78a/7IA6yrZuS9E13M7q8waPUBE8wdABUasTYdO/zYfP5seZdvoZdvuVYZ2ddZE7Used7vaq8wPeSlynmh2imh2iNM24UaeTUB2zUdZJUVcPo9EkylvWNUaE79oDjGevN5ueMlKOS5wn7WYEn0pSD0S0V0S3/XltLXlw+pYO+pSknXpDHWXC/Y7Q0csE8waPjlEP78a/S5e1o5wnJZEG2K2jJrs6oM33NYfgJZEG2K2jJrs6oM3378n/JrsDSlOL0csQoVfn7lv15rZPjlvW5rA6orvWNMPQ7M2kjrw/zYfLj9ELSlOL0csQoVfn7loQj9Kto5DQmh21NM3Do9sQjVCLbV2kjrw/bVmWm9DcJiPQ79KOS5wnJrKimIEi7GKijMmQ0csco5JkS5e1SlEW5renSi/Q0csQjIeu3l2vNM3Do9sQjVCLbV2kjrw/bVmWm9DcJiPq8w== 解密后:adm.php 1<?php 2/** 3 * decrypted by mrasong 4 * @mrasong 2013-12-23 5 */ 6include('common.inc.php'); 7include(INC_DIR.'permission.func.php'); 8include(INC_DIR .'html.func.php'); 9include ('index/page.php'); 10 11$domain = "localhost"; 12 13$LOCALDOMAIN = $_SERVER["HTTP_HOST"]; 14 15/* fuck the authorization 16if(strstr($LOCALDOMAIN,$domain)== false){ 17 exit("你的授权域名不正确!"); 18}*/ 19 20$mod = isset($_GET['mod']) ?$_GET['mod'] : 'main'; 21if (!is_admin_login()) $mod = 'login'; 22if (!file_exists('admin/'.$mod .'.php')) exit('error url'); 23permission_chk(); 24include('admin/'.$mod .'.php'); 附 PHP 文件:simcms.adm.php.zip ...

十二月 23, 2013

升级,换模板

升级、换皮,辞旧迎新!

十二月 20, 2013

小米抢购技巧(BUG)--[已失效]

工具: 1、chrome 或者 firefox 浏览器,建议用 chrome 浏览器,firefox 需安装 firebug 插件。 2、预约购买的小米账号。 准备: 提前打开抢购页面,并用已经预约的小米账号进行登录。 ...

十月 18, 2013