webfaction主机的邮件配置

我需要在webfaction的主机上使用email来给注册用户发邮件,它本机是不提供mail server的,需要单独配置邮件 email的配置,参考这个 http://docs.webfaction.com/user-guide/email.html 即新建mailbox,新建个发邮件账户,然后就是django中配置了。 django中配置参考这个: https://help.webfaction.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid;=181 ...

March 12, 2010 · notsobad

shell中求字符串的md5

shell中求字符串的md5 参考这篇文章http://ubuntuforums.org/showthread.php?t=532594 ~$ echo x x ~$ echo x| od -bc 0000000 170 012 x \n 0000002 ~$ echo x | md5sum 401b30e3b8b5d629635a5c613cdb7919 - ~$ echo -n x | md5sum | awk '{print $1}' 9dd4e461268c8034f5c8564e155c67a6 ~$ php -r 'echo md5("x");' 9dd4e461268c8034f5c8564e155c67a6 # 封装个函数 ~$ md5(){ echo -n $1 | md5sum | awk '{print $1}'; } ~$ md5 x 9dd4e461268c8034f5c8564e155c67a6

February 4, 2010 · notsobad

pac脚本tips

关于pac脚本,几点tip ie下pac脚本是会cache结果的,如果pac文件会经常变化,以前配置过pac,ie可能不会立即去取这个新的文件,可以改变pac文件的地址,如http://xxx.xx/xx.pac?r=$rand http://support.microsoft.com./kb/271361 ie下的session管理规则和firefox不一样,多个浏览器窗口session可能会不一样,所以pac脚本如果是一个需要登录认证的脚本动态产生,会导致ie取不到pac文件。 firefox下,多个如果在父窗口配置代理,弹出的新窗口却并没有使用这个代理,比较奇怪,需要在新窗口里面配置。 ...

February 1, 2010 · notsobad

查看jquery的代码实现

看到了篇文章 http://james.padolsey.com/javascript/under-jquerys-bonnet/ 查看jquery的代码实现 http://james.padolsey.com/jquery 做的很cool,如果你想知道jquery的attr方法是怎么实现的 http://james.padolsey.com/jquery/#v=1.4&fn;=jQuery.attr 访问上面的地址即可,比自己从几千行源码里翻要快些。 If there’s one thing all library users should be doing more, it’s peeling back the layer of abstraction and seeing what’s really happening underneath. This is the only way to gain a true understanding of what the library provides, and who knows, maybe you’ll find some gems that you didn’t know existed. ...

February 1, 2010 · notsobad

全文搜索工具

编译 sphinx ./configure --with-mysql ..... ERROR: cannot find MySQL include files. Check that you do have MySQL include files installed. The package name is typically 'mysql-devel'. .... 提示需要mysql-devel包,但是ubuntu里面没有叫这个名字的包,搜了一下,应该是这个 http://ubuntuforums.org/showthread.php?t=556317 apt-get install libmysql++-dev make && sudo make install 安装完成 几个相关的文档 django-sphinx http://github.com/dcramer/django-sphinx http://www.davidcramer.net/code/65/setting-up-django-with-sphinx.html http://www.sphinxsearch.com/ http://www.davidcramer.net/code/117/announcing- django-sphinx-200.html http://code.google.com/p/django-sphinx/ sphinx需要启动daemon,绑定主机、端口,在共享主机下,比较难操作,似乎xapian是更好的选择。 ...

January 24, 2010 · notsobad

php代码格式化工具

对于一些缩进不好的代码,可以利用这些工具来进行缩进美化下。 http://www.codeassembly.com/examples/beautifier.php http://www.beautifyphp.com/ 水木上有人传了sina微博泄漏代码,是个文本,全部都在一行里,没法看 我用sed处理了下, cat att.php\?s.261.77749.629.txt | iconv -f gb2312 -t utf8 | sed -e 's/;/;\n/g' -e 's#//#\n//#g' -e 's#\*/#\*/\n#g' -e 's/\}/\}\n/g' 然后再用http://www.codeassembly.com/examples/beautifier.php 格式化了下,基本能看了 ...

January 15, 2010 · notsobad

利用nmap来解析ip段

nmap支持很多中ip段的格式 ~$ nmap -n -sL 10.16.1-2.3-4 | awk '/Host/{print $2}' 10.16.1.3 10.16.1.4 10.16.2.3 10.16.2.4 ~$ nmap -n -sL 10.16.1-10.1 | awk '/Host/{print $2}' 10.16.1.1 10.16.2.1 10.16.3.1 10.16.4.1 10.16.5.1 10.16.6.1 10.16.7.1 10.16.8.1 10.16.9.1 10.16.10.1 -sL 列出扫描目标,不向目标发送数据,但是会做dns反向解析,可以加-n,去掉dns查询。 参考: -sL (List Scan) . The list scan is a degenerate form of host discovery that simply lists each host of the network(s) specified, without sending any packets to the target hosts. By default, Nmap still does reverse-DNS resolution on the hosts to learn their names. It is often surprising how much useful information simple hostnames give out. For example, fw.chi is the name of one company´s Chicago firewall. Nmap also reports the total number of IP addresses at the end. The list scan is a good sanity check to ensure that you have proper IP addresses for your targets. If the hosts sport domain names you do not recognize, it is worth investigating further to prevent scanning the wrong company´s network. Since the idea is to simply print a list of target hosts, options for higher level functionality such as port scanning, OS detection, or ping scanning cannot be combined with this. If you wish to disable ping scanning while still performing such higher level functionality, read up on the -PN option. ...

January 15, 2010 · notsobad

shell获取本机ip

获取本机ip ifconfig eth0 | sed -n 's/^\s*inet addr://p' | awk '{ print $1 }' 但是ifconfig的输出,有可能有中文。 ~$ ifconfig eth0 eth0 Link encap:以太网 硬件地址 ****** inet 地址:****** 广播:**** 掩码:***** inet6 地址: fe80::21a:a0ff:feab:1961/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1 接收数据包:38100 错误:0 丢弃:0 过载:0 帧数:0 发送数据包:34026 错误:0 丢弃:0 过载:0 载波:0 碰撞:0 发送队列长度:1000 接收字节:20977069 (20.9 MB) 发送字节:6029574 (6.0 MB) 中断:16 改一下才能通用: ...

January 15, 2010 · notsobad

利用reST来写文档

利用reST来写文档,然后用rst2html,rst2pdf来编译成html和pdf。 关于reST,我以后会再详细介绍一下。 509 ~/script/notsobad/reST/php_standard>tree . |-- Makefile |-- main.rst |-- main.style |-- php-standard.html `-- php-standard.pdf 0 directories, 5 files 510 ~/script/notsobad/reST/php_standard>cat Makefile all: php-standard.pdf php-standard.html php-standard.pdf: main.rst rst2pdf main.rst -o php-standard.pdf; php-standard.html: main.rst rst2html -ts -l zh_cn main.rst > php-standard.html clean: rm php-standard.* 511 ~/script/notsobad/reST/php_standard>make make: 没有什么可以做的为 'all' 512 ~/script/notsobad/reST/php_standard>rm php-standard.* 513 ~/script/notsobad/reST/php_standard>make rst2pdf main.rst -o php-standard.pdf; rst2html -ts -l zh_cn main.rst > php-standard.html

January 13, 2010 · notsobad

svn忽略文件

svn里面经常会有一些不必要的文件,比如.tmp,.swp等,这是因为添加的时候没注意 正确的应该是设置忽略文件,svn增加一个目录,先不增加里面的文件。 svn add php_standard/ --depth empty 然后设置忽略文件 ~$ svn propset svn:ignore "*.pdf" php_standard/ 设置属性 “svn:ignore” 于 “php_standard” ~$ ~$ svn propget svn:ignore *.pdf 或者忽略整个目录的内容 ...

January 12, 2010 · notsobad