‘技术相关’ 分类的存档
如题,懂的入。 Sub ToggleComment () ‘DESCRIPTION: Toggle Comments a selected block of text. Dim win Set win = ActiveWindow If win.type <> "Text" Then MsgBox "This macro can only be run when a text editor window is active." Else StartLine = ActiveDocument.Selection.TopLine EndLine = ActiveDocument.Selection.BottomLine If EndLine < StartLine Then Temp = StartLine StartLine = EndLine [...]
本空间支持SSH,一来为了cross wall,二来整理网站什么的也能方便点,比如打个包,解个包,check out点代码什么的。 好了,直接贴代码吧。 #!/bin/bash # # Backup web source code and database data to a tarball # Also can send it to your email as a attachment # # crontab -e # 0 0 * * * /home/burgess/backup.sh >/dev/null 2>&1 # # set variables web_path=~/public_html db_name=your_db_name db_user=your_db_user db_pass=your_db_pass email=burgess@163.com email_title="Web Backup – xyh.org [...]
几天前服务器根目录空间使用100%导致MySQL使用出错,看了下发现是/var/log/maillog文件太大了,直接使用>/var/log/maillog清空暂时了事。 今天研究了下,发现可以通过修改/etc/syslog.conf文件来过滤无用的信息。修改如下: 把 mail.* -/var/log/maillog 替换为 mail.notice -/var/log/maillog
近来找到一个网站上有不少网络电视直播,但是网站做的广告太多,不想每次都去人家那里,于是自己花了几天时间用Python脚本把列表给取了来,自己用cmp.swf做了这么个东西。 不截图了,直接上地址 http://tv.xcyh.org/ 其中很多地址都是WMP格式的,没关系用FLASH和JS交互在FLASH上弄了一层WMP控件就OK了。 P.S.页面很干净的说,WMP控件上双击可以全屏,按ESC恢复,点下面出现的“停止播放并返回播放器”可以返回FLASH界面!
有的时候我们想知道未跳转前的内容,可是Python的urllib2却自动跟随跳转,研究了下库里的代码,发现我们修改下就可以了。 注释的三行代码可以返回当前的code,比如301或302什么的,如果只想知道code,那么只要去掉这三行注释再把return response注释了就可以了。 “debug_handler = urllib2.HTTPHandler(debuglevel = 1)”是调试跟踪用的,不想跟踪改为0就可以了。 import urllib2 import socket class SimpleRedirectHandler(urllib2.HTTPRedirectHandler): def http_error_301(self, req, response, code, msg, headers): # result = urllib2.HTTPRedirectHandler.http_error_301(self, req, response, code, msg, headers) # result.status = code # return result return response http_error_302 = http_error_303 = http_error_307 = http_error_301 def unRedirectUrl(url): socket.setdefaulttimeout(90) req = urllib2.Request(url) [...]

